92 lines
2.2 KiB
PHP
92 lines
2.2 KiB
PHP
<?php
|
||
|
||
namespace App\Models;
|
||
|
||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||
use Illuminate\Notifications\Notifiable;
|
||
use Laravel\Sanctum\HasApiTokens;
|
||
|
||
/**
|
||
* 用户信息模型
|
||
* @package App\Models
|
||
* @property int $id 用户ID
|
||
* @property string $username 用户账号
|
||
* @property string $password 密码
|
||
* @property string $nickname 用户昵称
|
||
* @property string $remark 备注
|
||
* @property int $dept_id 部门ID
|
||
* @property string $post_ids 岗位编号数组
|
||
* @property string $email 用户邮箱
|
||
* @property string $mobile 手机号码
|
||
* @property int $sex 用户性别
|
||
* @property string $avatar 头像地址
|
||
* @property int $status 帐号状态(0正常 1停用)
|
||
* @property string $login_ip 最后登录IP
|
||
* @property string $login_date 最后登录时间
|
||
* @property string $creator 创建者
|
||
* @property string $create_time 创建时间
|
||
* @property string $updater 更新者
|
||
* @property string $update_time 更新时间
|
||
* @property string $deleted 是否删除
|
||
* @property string $tenant_id 租户编号
|
||
*/
|
||
class User extends Authenticatable
|
||
{
|
||
/** @use HasFactory<\Database\Factories\UserFactory> */
|
||
use HasFactory, Notifiable, HasApiTokens;
|
||
|
||
protected $table = "system_users";
|
||
|
||
/**
|
||
* 可批量赋值的属性
|
||
*/
|
||
protected $fillable = [
|
||
'username',
|
||
'password',
|
||
'nickname',
|
||
'remark',
|
||
'dept_id',
|
||
'post_ids',
|
||
'email',
|
||
'mobile',
|
||
'sex',
|
||
'avatar',
|
||
'status',
|
||
'login_ip',
|
||
'login_date',
|
||
'creator',
|
||
'create_time',
|
||
'updater',
|
||
'update_time',
|
||
'deleted',
|
||
'tenant_id',
|
||
];
|
||
|
||
/**
|
||
* 隐藏属性
|
||
*/
|
||
protected $hidden = [
|
||
'password',
|
||
];
|
||
|
||
/**
|
||
* 自定义时间戳字段名
|
||
*/
|
||
const CREATED_AT = 'create_time';
|
||
const UPDATED_AT = 'update_time';
|
||
|
||
/**
|
||
* 类型转换
|
||
*/
|
||
protected function casts(): array
|
||
{
|
||
return [
|
||
'login_date' => 'datetime',
|
||
'create_time' => 'datetime',
|
||
'update_time' => 'datetime',
|
||
'password' => 'hashed',
|
||
];
|
||
}
|
||
}
|