Tutorial by Examples

Exceptions in Laravel are handled by App\Exceptions\Handler.php This file contains two functions by default. Report & Render. We will only be using the first public function report(Exception $e) The report method is used to log exceptions or send them to an external service like BugSnag...
app\Exceptions\Handler.php public function render($request, Exception $exception) { if ($exception instanceof ModelNotFoundException) { abort(404); } return parent::render($request, $exception); } You can catch / handle any exception that is thrown in Laravel.

Page 1 of 1