How to get All input of POST in Laravel

后端 未结 8 887
不知归路
不知归路 2021-02-03 17:10

I am using Laravel 5 and trying to get all input of POST variable in controller like this-

public function add_question()
{
    return Request::all();
}
<         


        
相关标签:
8条回答
  • 2021-02-03 17:55

    You should use the facade rather than Illuminate\Http\Request. Import it at the top:

    use Request;
    

    And make sure it doesn't conflict with the other class.

    Edit: This answer was written a few years ago. I now favour the approach suggested by shuvrow below.

    0 讨论(0)
  • 2021-02-03 18:01

    You can get all post data into this function :-

    $postData = $request->post();
    

    and if you want specific filed then use it :-

    $request->post('current-password');
    
    0 讨论(0)
提交回复
热议问题