I have two route groups in my Laravel application, one for an API and one for the website itself. I've added the following code in global.php
for error handling of my API.
- App::error(function(ModelNotFoundException $e)
- {
- return Response::json('', 404);
- });
But not this obviously also has effect on my normal website, where I want to return a normal view when the ModelNotFoundException
occurs. Like so:
- App::error(function(ModelNotFoundException $e)
- {
- return Response::view('404.html', [], 404);
- });
How can I setup different error handlers for different route groups?