Check if request is GET or POST

后端 未结 6 1288
离开以前
离开以前 2021-02-04 23:37

In my controller/action:

if(!empty($_POST))
{
    if(Auth::attempt(Input::get(\'data\')))
    {
        return Redirect::intended();
    }
    else
    {
                


        
6条回答
  •  萌比男神i
    2021-02-05 00:33

    The solutions above are outdated.

    As per Laravel documentation:

    $method = $request->method();
    
    if ($request->isMethod('post')) {
        //
    }
    

提交回复
热议问题