mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
message refactor
This commit is contained in:
@ -1,6 +1,8 @@
|
||||
<?php
|
||||
namespace App\Entities\Usuarios;
|
||||
|
||||
use App\Entities\Chat\ChatNotificationEntity;
|
||||
use App\Models\ChatNotification;
|
||||
use CodeIgniter\Entity;
|
||||
|
||||
class UserEntity extends \CodeIgniter\Entity\Entity
|
||||
@ -55,4 +57,20 @@ class UserEntity extends \CodeIgniter\Entity\Entity
|
||||
{
|
||||
return $this->getFullName();
|
||||
}
|
||||
public function withAvatar() : self
|
||||
{
|
||||
$users = auth()->getProvider();
|
||||
$this->attributes["avatar"] = md5($users->findById($this->attributes['id'])->getEmail());
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Return an array of ChatNotificationEntities that belongs to the user
|
||||
*
|
||||
* @return array<ChatNotificationEntity>
|
||||
*/
|
||||
public function chatNotifications() : array
|
||||
{
|
||||
$m = model(ChatNotification::class);
|
||||
return $m->where('user_id',$this->attributes['id'])->findAll() ?? [];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user