1

当我尝试使用修补程序为管理员插入数据时,我遇到了 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',
    ];
} 

在此处输入图像描述

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

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

1 回答 1

4

改变这个

use Illuminate\Foundation\Auth\Admin as Authenticatable;

use Illuminate\Foundation\Auth\User as Authenticatable;

因为Illuminate\Foundation\Auth\User它是来自 laravel 核心的核心代码,它没有Admin

于 2020-09-12T05:41:56.997 回答