User.php
1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
namespace App\Models\User;
//use Illuminate\Contracts\Auth\MustVerifyEmail;
use App\Models\Base;
//use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Base
{
// use HasApiTokens, HasFactory, Notifiable;
const ROLE_MANAGER = 0;//超级管理员
const TYPE_ONE = 1;
const STATUS_ZERO = 0;
protected $table = 'gl_project_user';
//自动维护create_at创建时间 updated_at修改时间
public $timestamps = true;
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
// 'name',
'email',
'password',
];
/**
* The attributes that should be hidden for serialization.
*
* @var array<int, string>
*/
protected $hidden = [
// 'password',
'remember_token',
];
/**
* The attributes that should be cast.
*
* @var array<string, string>
*/
protected $casts = [
'email_verified_at' => 'datetime',
'created_at' => 'datetime:Y-m-d H:i:s',
'updated_at' => 'datetime:Y-m-d H:i:s',
];
/**
* @remark :获取名称
* @name :getName
* @author :lyh
* @method :post
* @time :2023/8/8 15:00
*/
public function getName($id){
$info = $this->read(['id'=>$id],['id','name']);
if($info === false){
return '用户不存在';
}
return $info['name'];
}
}