60 lines
1.5 KiB
PHP
60 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Modules\UserAdjustments\Traits;
|
|
|
|
/**
|
|
* @property string $username [unique]
|
|
* @property string|null $first_name
|
|
* @property string|null $last_name
|
|
* @property string|null $phone
|
|
* @property \Illuminate\Support\Facades\Date|null $phone_verified_at
|
|
* @property string $locale [default: tk]
|
|
* @property bool $password_must_be_changed [default: false]
|
|
* @property bool $must_fill_profile [default: false]
|
|
* @property null|array<string, int|string|null> $options
|
|
*/
|
|
trait UserAdjustments
|
|
{
|
|
/**
|
|
* Get the attributes that should be cast.
|
|
*
|
|
* @return array<string, string>
|
|
*/
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'email_verified_at' => 'datetime',
|
|
'phone_verified_at' => 'datetime',
|
|
'password_must_be_changed' => 'bool',
|
|
'must_fill_profile' => 'bool',
|
|
'options' => 'array',
|
|
'custom_fields' => 'array',
|
|
'password' => 'hashed',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Get option from options
|
|
*/
|
|
public function getOption(string $option): null|int|string
|
|
{
|
|
return $this->options && array_key_exists($option, $this->options) ? $this->options[$option] : '';
|
|
}
|
|
|
|
/**
|
|
* Passport serie
|
|
*/
|
|
public function passport_serie(): string
|
|
{
|
|
return (string) $this->getOption('passport_serie');
|
|
}
|
|
|
|
/**
|
|
* Passport id
|
|
*/
|
|
public function passport_id(): string
|
|
{
|
|
return (string) $this->getOption('passport_id');
|
|
}
|
|
}
|