Using $ input-> all () instead of Input :: all () Laravel-5

I try to use it $input->all()unlike Input::all()in Laravel-5, but it does not seem to like it, although I pass an Input link to a function, for example:

/**
 * Search for a specified resource.
 *
 * @return Response
 */
public function search(Booking $booking, Input $input)
{
    dd($input->all()); // this doesn't work

    dd(Input::all()); // this DOES work

}

The error I get is:

Call to undefined method Illuminate\Support\Facades\Input::all()

Does anyone have a solution to this problem?

+4
source share
2 answers

I do not think that you should enter Facades into your controllers. Input- This is the facade for Illuminate\Http\Request, and the binding of the service container request. So, according to the documentation, in Laravel 5 you can do Request::all(), and in Laravel 5.1 you can do$request->all()

http://laravel.com/docs/5.0/requests#retrieving-input http://laravel.com/docs/5.1/requests#retrieving-input

EDIT: : fooobar.com/questions/278303/...

EDIT3: , , - , , . , DI Facades - , L5 + DI. , , , , . , - . , - .

+6

- Laravel, .

Laravel 4.2 Input:: all(), Input:: get(), Laravel 5 onwards,

: https://laravel.com/docs/5.2/requests

Laravel 5.0 , config/app.php "" = > \\\::

, "Input:: all()"

, , , "Enter" "" Laravel 5.0 .

+1
source

All Articles