wantsJson() && $exception instanceof ModelNotFoundException) { return response()->json(new StatusResource(['status' => 'KO', 'code' => 404, 'message' => 'Resource not found.']), 404); } return parent::render($request, $exception); } }