当我尝试使用修补程序插入管理员数据时,我遇到了 php 错误问题。我正在创建一个多重身份验证用户,其中一个用于用户,一个用于管理员。PHP 错误:在第 13 行的 c:/S/htdocs/iV/app/Models/Admin.php 中找不到类“Illuminate/Foundation/Auth/Admin”我该如何解决该错误?Admin<?phpnamespace App\Models;use Illuminate\Database\Eloquent\Factories\HasFactory;use Illuminate\Database\Eloquent\Model;use Illuminate\Contracts\Auth\MustVerifyEmail;use Illuminate\Foundation\Auth\Admin as Authenticatable;use Illuminate\Notifications\Notifiable;use App\Notifications\AdminResetPasswordNotification;class Admin extends Authenticatable{ use HasFactory, Notifiable; protected $guard = 'admin'; /** * The attributes that are mass assignable. * * @var array */ protected $fillable = [ 'name', 'email', 'password', ]; /** * The attributes that should be hidden for arrays. * * @var array */ protected $hidden = [ 'password', 'remember_token', ]; /** * The attributes that should be cast to native types. * * @var array */ protected $casts = [ 'email_verified_at' => 'datetime', ];} 我尝试删除composer.lock文件,然后再次安装它,我也这样做了。composer dump-autoload
composer install --no-scripts
composer update
1 回答
忽然笑
TA贡献1806条经验 获得超5个赞
改变这个
use Illuminate\Foundation\Auth\Admin as Authenticatable;
到
use Illuminate\Foundation\Auth\User as Authenticatable;
因为Illuminate\Foundation\Auth\User
它是来自 laravel core 的核心代码,并且没有Admin
类
- 1 回答
- 0 关注
- 66 浏览
添加回答
举报
0/150
提交
取消