调用未定义的方法 Illuminate\Support\Facades\Request::all()
Call to undefined method Illuminate\Support\Facades\Request::all()
我在 Laravel 5.1 中使用会话,这是我的控制器代码:
Route::post('/task', function (Request $request) {
$validator = Validator::make($request->all(), [
'name' => 'required|max:255',
]);
if ($validator->fails()) {
return redirect('/')
->withInput()
->withErrors($validator);
}
});
我需要使用会话,但出现此错误:
调用未定义的方法 Illuminate\Support\Facades\Request::all()
确保您在文件顶部导入正确的请求 class:
use Illuminate\Http\Request;
目前您似乎正在使用 Request facade
我在 Laravel 5.1 中使用会话,这是我的控制器代码:
Route::post('/task', function (Request $request) {
$validator = Validator::make($request->all(), [
'name' => 'required|max:255',
]);
if ($validator->fails()) {
return redirect('/')
->withInput()
->withErrors($validator);
}
});
我需要使用会话,但出现此错误: 调用未定义的方法 Illuminate\Support\Facades\Request::all()
确保您在文件顶部导入正确的请求 class:
use Illuminate\Http\Request;
目前您似乎正在使用 Request facade