Skip to content

Instantly share code, notes, and snippets.

@anaxamaxan
Created April 25, 2014 05:41
Show Gist options
  • Save anaxamaxan/11278707 to your computer and use it in GitHub Desktop.
Save anaxamaxan/11278707 to your computer and use it in GitHub Desktop.
Catching ModelNotFoundException
App::error(function(\Illuminate\Database\Eloquent\ModelNotFoundException $e){
Log::error($e);
if (Request::ajax() or Request::is('api/*')) {
return Response::json(['flash'=>trans('application.resource_not_found')],404);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment