[英]Class 'App\Model' not found after add Bican\Roles
我正在使用Bican Roles庫。 我將User.php更改為:
<?php
namespace App;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Bican\Roles\Traits\HasRoleAndPermission;
use Bican\Roles\Contracts\HasRoleAndPermission as HasRoleAndPermissionContract;
class User extends Model implements AuthenticatableContract, CanResetPasswordContract, HasRoleAndPermissionContract
{
use Authenticatable, CanResetPassword, HasRoleAndPermission,Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name', 'surnames', 'email', 'password','phone',
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password', 'remember_token',
];
}
嘗試注冊新用戶時,拋出以下錯誤:
找不到類別“ App \\ Model”
我試圖添加它
使用用戶;
等,但仍然無法正常工作,有什么想法嗎? 謝謝
您需要添加
use Illuminate\Database\Eloquent\Model;
在類聲明的頂部,不要use User;
您得到的錯誤是
找不到類別“ App \\ Model”
不
找不到類別“用戶”
嘗試
use Illuminate\Database\Eloquent\Model;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.