PHP 错误:类“Illuminate/Foundation/Auth/Admin”

当我尝试使用修补程序插入管理员数据时,我遇到了 php 错误问题。我正在创建一个多重身份验证用户,其中一个用于用户,一个用于管理员。

PHP 错误:在第 13 行的 c:/S/htdocs/iV/app/Models/Admin.php 中找不到类“Illuminate/Foundation/Auth/Admin”

我该如何解决该错误?

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',

    ];

https://img1.sycdn.imooc.com/65a9d5590001197712340174.jpg

我尝试删除composer.lock文件,然后再次安装它,我也这样做了。

composer dump-autoload
composer install --no-scripts
composer update


红颜莎娜
浏览 67回答 1
1回答

忽然笑

改变这个use Illuminate\Foundation\Auth\Admin as Authenticatable;到use Illuminate\Foundation\Auth\User as Authenticatable;因为Illuminate\Foundation\Auth\User它是来自 laravel core 的核心代码,并且没有Admin类
打开App,查看更多内容
随时随地看视频慕课网APP