mirror of
https://github.com/Deathgarden-Rebirth/Deathgarden_Rebirth-Rewrite.git
synced 2026-03-21 18:04:46 -05:00
33 lines
742 B
PHP
33 lines
742 B
PHP
<?php
|
|
|
|
namespace App\Classes\Frontend;
|
|
|
|
use App\View\Components\Auth\User;
|
|
use Illuminate\Support\Carbon;
|
|
use JsonSerializable;
|
|
|
|
class ChatMessage implements JsonSerializable
|
|
{
|
|
public function __construct(
|
|
public string $gameId,
|
|
public string $userId,
|
|
public Carbon $messageTime,
|
|
public string $message,
|
|
)
|
|
{}
|
|
|
|
public function getUser(): ?\App\Models\User\User
|
|
{
|
|
return \App\Models\User\User::find($this->userId);
|
|
}
|
|
|
|
public function jsonSerialize(): array
|
|
{
|
|
return [
|
|
'gameId' => $this->gameId,
|
|
'userId' => $this->userId,
|
|
'messageTime' => $this->messageTime->toJSON(),
|
|
'message' => $this->message,
|
|
];
|
|
}
|
|
} |