I am using session in Laravel 5.1 and here is my Controller code :
Route::post('/task', function (Request $request) {
$validator = Validator::make($request->all(), [
'name' => 'required|max:255',
]);
if ($validator->fails()) {
return redirect('/')
->withInput()
->withErrors($validator);
}
});
I need to use session, and getting this error : Call to undefined method Illuminate\Support\Facades\Request::all()
Make sure you're importing the right Request class at the top of the file:
use Illuminate\Http\Request;
At the moment it looks like you're using the Request facade
There is also possible ways to use
use Illuminate\Http\Request;
instead of
use Illuminate\Support\Facades\Request;
at the top. hide "use Illuminate\Support\Facades\Request;"
Hope it works. Thank you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With