mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
37 lines
733 B
PHP
Executable File
37 lines
733 B
PHP
Executable File
<?php
|
|
|
|
namespace App\Entities\Chat;
|
|
|
|
use App\Entities\Usuarios\UserEntity;
|
|
use App\Models\Chat\ChatModel;
|
|
use App\Models\Usuarios\UserModel;
|
|
use CodeIgniter\Entity\Entity;
|
|
|
|
class ChatUserEntity extends Entity
|
|
{
|
|
protected $attributes = [
|
|
"id" => null,
|
|
"user_id" => null,
|
|
"chat_id" => null,
|
|
];
|
|
|
|
|
|
protected $casts = [
|
|
"user_id" => "integer",
|
|
"chat_id" => "integer",
|
|
];
|
|
|
|
public function chat() : ?ChatEntity
|
|
{
|
|
$m = model(ChatModel::class);
|
|
return $m->find($this->attributes['chat_id']);
|
|
|
|
}
|
|
public function user() : ?UserEntity
|
|
{
|
|
$m = model(UserModel::class);
|
|
return $m->find($this->attributes['user_id'])->withAvatar();
|
|
}
|
|
|
|
}
|