39 lines
875 B
PHP
39 lines
875 B
PHP
<?php
|
|
|
|
namespace App\DTOs;
|
|
|
|
class UserDTO extends CommonDTO
|
|
{
|
|
public ?int $uid = null;
|
|
public ?string $id = null;
|
|
public ?string $passwd = null;
|
|
public ?string $passwd_confirm = null;
|
|
public ?string $email = null;
|
|
public ?string $mobile = null;
|
|
public ?string $role = null;
|
|
public ?string $status = null;
|
|
|
|
public function __construct(array $datas = [])
|
|
{
|
|
parent::__construct();
|
|
foreach ($datas as $key => $value) {
|
|
if (property_exists($this, $key)) {
|
|
$this->{$key} = $value;
|
|
}
|
|
}
|
|
}
|
|
public function toArray(): array
|
|
{
|
|
return [
|
|
'uid' => $this->uid,
|
|
'id' => $this->id,
|
|
'passwd' => $this->passwd,
|
|
'passwd_confirm' => $this->passwd_confirm,
|
|
'email' => $this->email,
|
|
'mobile' => $this->mobile,
|
|
'role' => $this->role,
|
|
'status' => $this->status,
|
|
];
|
|
}
|
|
}
|