Last updated on March 8, 2015
Laravel’s Request class provides many methods for reading the HTTP request of the current request. One of these function is named ajax(). Using this function We can check the request type under controllers or route filters..etc. See the below example script.
Check for Ajax request in Laravel application
if (\Request::ajax()) { // } else { }
That’s it.