diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 03fffb7..5552f78 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -44,11 +44,11 @@ class Handler extends ExceptionHandler */ public function register() { - // $this->renderable(function (\Symfony\Component\HttpKernel\Exception\NotFoundHttpException $e, Request $request) { - // if ($request->acceptsJson()) { - // return response()->json(['status' => 404, 'msg' => '资源不存在', 'data' => null], 200); - // } - // }); + $this->renderable(function (\Illuminate\Database\Eloquent\ModelNotFoundException $e, Request $request) { + if ($request->acceptsJson()) { + return response()->json(['status' => 404, 'msg' => '资源不存在', 'data' => null], 200); + } + }); $this->renderable(function (\Illuminate\Validation\ValidationException $e, Request $request) { if ($request->acceptsJson()) { $errors = $e->validator->errors();