PHP Error: Class 'Illuminate/Foundation/Auth/Admin' [Laravel 8]
PHP Error: Class 'Illuminate/Foundation/Auth/Admin' [Laravel 8]
当我尝试使用 tinker 为管理员插入数据时,出现 php 错误。我正在创建一个多重身份验证用户,一个用于用户,一个用于管理员。
PHP Error: Class 'Illuminate/Foundation/Auth/Admin' not found in c:/S/htdocs/i-V/app/Models/Admin.php on line 13
如何解决该错误?
Admin
<?php
namespace 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
改变这个
use Illuminate\Foundation\Auth\Admin as Authenticatable;
到
use Illuminate\Foundation\Auth\User as Authenticatable;
as Illuminate\Foundation\Auth\User
它是来自 laravel 核心的核心代码,它没有 Admin
class
当我尝试使用 tinker 为管理员插入数据时,出现 php 错误。我正在创建一个多重身份验证用户,一个用于用户,一个用于管理员。
PHP Error: Class 'Illuminate/Foundation/Auth/Admin' not found in c:/S/htdocs/i-V/app/Models/Admin.php on line 13
如何解决该错误?
Admin
<?php
namespace 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
改变这个
use Illuminate\Foundation\Auth\Admin as Authenticatable;
到
use Illuminate\Foundation\Auth\User as Authenticatable;
as Illuminate\Foundation\Auth\User
它是来自 laravel 核心的核心代码,它没有 Admin
class