In my controller/action:
if(!empty($_POST)) { if(Auth::attempt(Input::get('data'))) { return Redirect::intended(); } else { Session::flash('error_message',''); } }
Is there a method in Laravel
to check if the request is POST
or GET
?
The result of request. method == "POST" is a boolean value - True if the current request from a user was performed using the HTTP "POST" method, of False otherwise (usually that means HTTP "GET", but there are also other methods).
According to Laravels docs, there's a Request method to check it, so you could just do:
$method = Request::method();
or
if (Request::isMethod('post')) { // }
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