trafficmonitor/app/DTOs/AuthDTO.php

27 lines
505 B
PHP

<?php
namespace App\DTOs;
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(),
);
}
}