PHP Трейт App\Traits\RestExceptionHandlerTrait

Показать файл Открыть проект

Защищенные методы

Метод Описание
badRequest ( string $message = 'Bad request', integer $statusCode = 400 ) : Illuminate\Http\JsonResponse Return JSON response for bad request.
getJsonResponseForException ( Illuminate\Http\Request $request, Exception $e ) : Illuminate\Http\JsonResponse Create a new JSON response based on exception type.
internalError ( string $message = 'Internal error', integer $statusCode = 500 ) : Illuminate\Http\JsonResponse Return JSON response for internal error.
jsonResponse ( array $payload = null, integer $statusCode = 404 ) : Illuminate\Http\JsonResponse Return JSON response.
notFound ( string $message = 'Not found', integer $statusCode = 404 ) : Illuminate\Http\JsonResponse Return JSON response for not found.
unauthorized ( string $message = 'Unauthorized', integer $statusCode = 401 ) : Illuminate\Http\JsonResponse Return JSON response for unauthorized.

Описание методов

badRequest() защищенный метод

Return JSON response for bad request.
protected badRequest ( string $message = 'Bad request', integer $statusCode = 400 ) : Illuminate\Http\JsonResponse
$message string
$statusCode integer
Результат Illuminate\Http\JsonResponse

getJsonResponseForException() защищенный метод

Create a new JSON response based on exception type.
protected getJsonResponseForException ( Illuminate\Http\Request $request, Exception $e ) : Illuminate\Http\JsonResponse
$request Illuminate\Http\Request
$e Exception
Результат Illuminate\Http\JsonResponse

internalError() защищенный метод

Return JSON response for internal error.
protected internalError ( string $message = 'Internal error', integer $statusCode = 500 ) : Illuminate\Http\JsonResponse
$message string
$statusCode integer
Результат Illuminate\Http\JsonResponse

jsonResponse() защищенный метод

Return JSON response.
protected jsonResponse ( array $payload = null, integer $statusCode = 404 ) : Illuminate\Http\JsonResponse
$payload array
$statusCode integer
Результат Illuminate\Http\JsonResponse

notFound() защищенный метод

Return JSON response for not found.
protected notFound ( string $message = 'Not found', integer $statusCode = 404 ) : Illuminate\Http\JsonResponse
$message string
$statusCode integer
Результат Illuminate\Http\JsonResponse

unauthorized() защищенный метод

Return JSON response for unauthorized.
protected unauthorized ( string $message = 'Unauthorized', integer $statusCode = 401 ) : Illuminate\Http\JsonResponse
$message string
$statusCode integer
Результат Illuminate\Http\JsonResponse