28 lines
529 B
PHP
28 lines
529 B
PHP
<?php
|
|
|
|
namespace App\DTOs;
|
|
|
|
use App\DTOs\CommonDTO;
|
|
use App\Services\Auth\AuthService;
|
|
|
|
class AuthDTO extends CommonDTO
|
|
{
|
|
public function __construct(
|
|
public bool $isLogin,
|
|
public ?int $uid = null,
|
|
public ?string $name = null,
|
|
public ?string $role = null
|
|
) {
|
|
parent::__construct();
|
|
}
|
|
public static function fromByAuthService(AuthService $service): self
|
|
{
|
|
return new self(
|
|
$service->isLoggedIn(),
|
|
$service->getUID(),
|
|
$service->getName(),
|
|
$service->getRole(),
|
|
);
|
|
}
|
|
}
|