trafficmonitor/app/DTOs/AuthDTO.php
2025-11-05 18:58:37 +09:00

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(),
);
}
}