26 lines
662 B
PHP
26 lines
662 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Api\V1\Chat\Resources;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class MessageResource extends JsonResource
|
|
{
|
|
/**
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'conversation_id' => $this->conversation_id,
|
|
'body' => $this->body,
|
|
'seen_at' => $this->seen_at,
|
|
'user' => new ChatUserResource($this->whenLoaded('user')),
|
|
'created_at' => $this->created_at,
|
|
'updated_at' => $this->updated_at,
|
|
];
|
|
}
|
|
}
|