11
This commit is contained in:
@@ -30,6 +30,19 @@ class User extends Model
|
||||
*/
|
||||
public $timestamps = true;
|
||||
|
||||
// 指定日期字段存储格式为时间戳
|
||||
protected $dateFormat = 'U';
|
||||
|
||||
//设置黑名单
|
||||
protected $guarded = ['id','created_at','updated_at'];
|
||||
|
||||
protected $casts = [
|
||||
// 'updated_at' => 'datetime:Y-m-d H:i:s', // 指定序列化格式
|
||||
// 'created_at' => 'datetime:Y-m-d H:i:s', // 指定序列化格式
|
||||
'updated_at' => 'timestamp', // 指定序列化格式
|
||||
'created_at' => 'timestamp', // 指定序列化格式
|
||||
];
|
||||
|
||||
public static function getUser($userId)
|
||||
{
|
||||
$user = User::first()->select(['id','name','sex','role','avatar','email','password'])
|
||||
|
||||
Reference in New Issue
Block a user