I'm having a route group that looks following:
web.php
Route::group( ['middleware' => 'auth', 'prefix' => 'ajax'],
function() {
Route::post( 'checkTheName', function( Request $request ) {
return response()->json( 'Something important' );
} );
}
);
Is this possible with Laravel to check whether incoming request is an AJAX request for all routes in a group (and if not, throw eg. a 404 status)? I find it kinda pointless checking it within every child route post. Thats why I would like to make a global check if request is within the route group scope.
Using Laravel 5.5