Файловый менеджер - Редактировать - /var/www/html/back/app/Domain/ResourceResponse.php
Назад
<?php declare(strict_types=1); namespace App\Responses; use Illuminate\Contracts\Support\Responsable; use Illuminate\Http\JsonResponse; use Illuminate\Support\Facades\Context; final readonly class ResourceResponse implements Responsable { public function __construct( private mixed $data, private int $status ) { } public function toResponse($request): JsonResponse { $requestId = Context::get(key: 'request_id'); $timestamp = Context::get(key: 'timestamp'); return new JsonResponse( data: [ 'status' => $this->status, 'data' => $this->data, 'metadata' => [ 'request_id' => $requestId, 'timestamp' => $timestamp ], ], status: $this->status ); } public static function example(): array { return [ 'data' => [ 'status' => 1, 'data' => [], 'metadata' => [ 'request_id' => '', 'timestamp' => '' ], ], 'status' => 1 ]; } }
| ver. 1.4 |
Github
|
.
| PHP 8.3.30 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка