Laravel Request::all() Should Not Be Called Statically

前端 未结 9 1554
迷失自我
迷失自我 2020-11-28 20:53

In Laravel, I\'m trying to call $input = Request::all(); on a store() method in my controller, but I\'m getting the following error:

9条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-28 21:06

    The facade is another Request class, access it with the full path:

    $input = \Request::all();
    

    From laravel 5 you can also access it through the request() function:

    $input = request()->all();
    

提交回复
热议问题