mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-04-27 22:14:40 -05:00
f52662a061
This is a "Alpha" commit. Its meant for Alpha testing. Features are still being developed. Please note, you must setup at least a FREE account with pusher and set the corresponding fields in you `.env` file. In the coming commits I will introducing a fallback so that once the FREE pusher DAILY limits are reached, it will fall back to tradiational database pulling every 3 seconds to get new messages. There are still features that need to be added: 1. Emoji's 2. Statuses 3. User Tagging 4. Users List 5. Delete own messages, and staff moderation and more ...
28 lines
760 B
PHP
28 lines
760 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'), // Mar 4th, 2018 at 02:15:16 PM,
|
|
'updated_at' => $this->updated_at
|
|
];
|
|
}
|
|
}
|