2025-01-31 18:20:13 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
2021-10-14 13:35:17 +03:00
|
|
|
namespace openvk\Web\Models\Entities;
|
2025-01-31 18:20:13 +03:00
|
|
|
|
2021-10-14 13:35:17 +03:00
|
|
|
use openvk\Web\Models\RowModel;
|
|
|
|
use openvk\Web\Models\Repositories\Users;
|
|
|
|
|
|
|
|
class SupportAlias extends RowModel
|
|
|
|
{
|
|
|
|
protected $tableName = "support_names";
|
2025-01-31 18:20:13 +03:00
|
|
|
|
|
|
|
public function getUser(): User
|
2021-10-14 13:35:17 +03:00
|
|
|
{
|
2025-01-31 18:20:13 +03:00
|
|
|
return (new Users())->get($this->getRecord()->agent);
|
2021-10-14 13:35:17 +03:00
|
|
|
}
|
2025-01-31 18:20:13 +03:00
|
|
|
|
|
|
|
public function getName(): string
|
2021-10-14 13:35:17 +03:00
|
|
|
{
|
|
|
|
return $this->getRecord()->name;
|
|
|
|
}
|
2025-01-31 18:20:13 +03:00
|
|
|
|
|
|
|
public function getIcon(): ?string
|
2021-10-14 13:35:17 +03:00
|
|
|
{
|
|
|
|
return $this->getRecord()->icon;
|
|
|
|
}
|
2025-01-31 18:20:13 +03:00
|
|
|
|
|
|
|
public function shouldAppendNumber(): bool
|
2021-10-14 13:35:17 +03:00
|
|
|
{
|
|
|
|
return (bool) $this->getRecord()->numerate;
|
|
|
|
}
|
2025-01-31 18:20:13 +03:00
|
|
|
|
|
|
|
public function setAgent(User $agent): void
|
2021-10-14 13:35:17 +03:00
|
|
|
{
|
|
|
|
$this->stateChanges("agent", $agent->getId());
|
|
|
|
}
|
2025-01-31 18:20:13 +03:00
|
|
|
|
|
|
|
public function setNumeration(bool $numerate): void
|
2021-10-14 13:35:17 +03:00
|
|
|
{
|
|
|
|
$this->stateChanges("numerate", $numerate);
|
|
|
|
}
|
|
|
|
}
|