當我嘗試使用修補程序插入管理員數據時,我遇到了 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 關注
- 132 瀏覽
添加回答
舉報
0/150
提交
取消