getStatusCode(); $message = Response::$statusTexts[$code]; return $this->errorResponse($message,$code); } if($exception instanceof ModelNotFoundException) { $model = strtolower(class_basename($exception->getModel())); return $this->errorResponse(trans('errors.model_not_found',['model'=>$model]), Response::HTTP_NOT_FOUND); } if($exception instanceof ValidationException) { $errors = $exception->validator->errors()->getMessages(); return $this->errorResponse($errors, Response::HTTP_UNPROCESSABLE_ENTITY); } if ($exception instanceof \ErrorException) { return $this->errorResponse($exception->getMessage(),Response::HTTP_INTERNAL_SERVER_ERROR); } if( env('APP_DEBUG', false)) { return parent::render($request,$exception); } return $this->errorResponse(trans('errors.unexpected_error'), Response::HTTP_INTERNAL_SERVER_ERROR); } }