dd/app/Models/Users.php
2026-06-14 15:46:45 +08:00

36 lines
884 B
PHP
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace App\Models;
// 🚨 注意看:大厂规范,必须引入这个专门用于认证的基类,而不是普通的 Model
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
/**
* Class Users
* @package App\Models
*/
class Users extends Authenticatable // 💎 核心:这里改成继承 Authenticatable,而不是 Model!
{
use Notifiable;
// 如果你的表名就是 users,可以不写;如果是别的,在这里指定
protected $table = 'users';
/**
* 大厂规范:定义允许批量赋值的白名单字段
*/
protected $fillable = [
'name',
'password',
];
/**
* 大厂规范:敏感字段在序列化成数组或 JSON 时必须隐藏,防止泄露!
*/
protected $hidden = [
'password',
'remember_token',
];
}