© Sanjib Sinha 2017

Sanjib Sinha, Beginning Laravel, 10.1007/978-1-4842-2538-7_18

18. How Request, Response Work in Laravel 5

Sanjib Sinha

(1)Howrah, West Bengal, India

What Does Request Mean ?

When a user requests some pages, what happens? You have just learned that in the previous chapter. We can obtain that request instance and see how it looks. To do that we would like to make a kind of type­hinting our ‘Illuminate\Http\Request’ class on our controller constructor or method. Suppose we have a ‘TestController ’.

So the code will look like this:

//code starting<?php namespace App\Http\Controllers;    use Illuminate\Http\Request;    use Illuminate\Routing\Controller;class TestController extends Controller    {    protected $request;    /**        * ...

Get Beginning Laravel: A beginner's guide to application development with Laravel 5.3 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.