22 lines
536 B
PHP
22 lines
536 B
PHP
|
<?php
|
||
|
|
||
|
namespace App\Http;
|
||
|
|
||
|
use Symfony\Component\HttpFoundation\JsonResponse;
|
||
|
|
||
|
class ErrorResponse extends JsonResponse {
|
||
|
public function __construct($code, $message, $data = null, $status = 400, $headers = [], $json = false) {
|
||
|
parent::__construct(
|
||
|
[
|
||
|
'error' => [
|
||
|
'code' => $code,
|
||
|
'message' => $message,
|
||
|
'data' => $data,
|
||
|
],
|
||
|
],
|
||
|
$status,
|
||
|
$headers,
|
||
|
$json,
|
||
|
);
|
||
|
}
|
||
|
}
|