Want to access all of our courses? (30 h 09 min)
You also get:
Already a member? Login here
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!
Tell us what you like or what we can improve
Feel free to share anything you like or dislike about this page or the platform in general.
Your feedback has been received. We truly appreciate you taking the time to help us improve.
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 remember