Question : return response not found laravel api response
Answered by : snippets
// In Laravel 9
// Update register() in App/Exceptions/Handler.php
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
public function register()
{ $this->renderable(function (NotFoundHttpException $e, $request) { if ($request->is('api/*')) { return response()->json([ 'message' => 'Not found.' ], 404); } });
}
Source : | Last Update : Sat, 25 Jun 22