- Moved chat-related controllers, resources, requests, and DTOs into their respective `Chats` namespaces. - Updated route imports to reflect new namespace structure.
33 lines
754 B
PHP
33 lines
754 B
PHP
<?php
|
|
|
|
namespace App\Http\Resources\Chats;
|
|
|
|
use App\Data\Chats\ChatResponseDto;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\JsonApi\JsonApiResource;
|
|
|
|
/**
|
|
* @property ChatResponseDto $resource
|
|
*/
|
|
class ChatResponseResource extends JsonApiResource
|
|
{
|
|
public function type(): string
|
|
{
|
|
return 'chats';
|
|
}
|
|
|
|
public function resolveResourceIdentifier($request): string
|
|
{
|
|
return (string) $this->resource->id;
|
|
}
|
|
|
|
public function toAttributes(Request $request): array
|
|
{
|
|
return [
|
|
'title' => $this->resource->title,
|
|
'createdAt' => $this->resource->createdAt->toIso8601String(),
|
|
'updatedAt' => $this->resource->updatedAt->toIso8601String(),
|
|
];
|
|
}
|
|
}
|