Lesson 06/34 · 4:32 min
Full repository for this course
Thanks for this tutorial. Would it be ok to add this to api routes 404 errors only? Keeping regular http 404 errors to default 404 web page
public function register() { $this->renderable(function (NotFoundHttpException $e) { if ( request()->is('api/*') ) { return response()->json([ 'message' => 'Object not found' ], 404); } }); }
Yes, that's one way of doing it. Another way is request()->expectsJson(), from what I remember
request()->expectsJson()
Thanks for this tutotrial!
Thanks for this tutorial. Would it be ok to add this to api routes 404 errors only? Keeping regular http 404 errors to default 404 web page
Yes, that's one way of doing it. Another way is
request()->expectsJson()
, from what I rememberThanks for this tutotrial!