reportable(function (Throwable $e) { // }); } /** * Report or log an exception. * * @param \Exception $exception * @return void */ public function report(Throwable $exception) { parent::report($exception); } public function render($request, Throwable $exception) { if ($exception instanceof ModelNotFoundException && $request->wantsJson()) { return response()->json(['message' => 'Not Found!'], 404); } if ( strpos($request->getRequestUri(), '/api/', 0) === 0 && get_class($exception) === NotFoundHttpException::class ) { return response()->json(['message' => 'Not Found!'], 404); } return parent::render($request, $exception); } }