mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-02-11 05:59:57 -06:00
28 lines
727 B
PHP
28 lines
727 B
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use App\Helpers\Bbcode;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class ChatMessageResource extends JsonResource
|
|
{
|
|
/**
|
|
* Transform the resource into an array.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @return array
|
|
*/
|
|
public function toArray($request)
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'user' => new UserResource($this->whenLoaded('user')),
|
|
'chatroom' => new ChatRoomResource($this->whenLoaded('chatroom')),
|
|
'message' => Bbcode::parse($this->message),
|
|
'created_at' => $this->created_at->format('F jS h:i A'),
|
|
'updated_at' => $this->updated_at
|
|
];
|
|
}
|
|
}
|