我按照文档Official安装了PermissionManager包。
但是,当我添加一个新用户时,我得到一个异常:Undefined index: model
我的用户模型是标准的(AppModelsUser::class),但我找不到解决方案…
感谢是的,我的模型是:
<?php
namespace AppModels;
use BackpackCRUDappModelsTraitsCrudTrait;
use IlluminateNotificationsNotifiable;
use IlluminateFoundationAuthUser as Authenticatable;
use SpatiePermissionTraitsHasRoles;
//use LaravelSanctumHasApiTokens;
//use IlluminateContractsAuthMustVerifyEmail;
//use IlluminateDatabaseEloquentFactoriesHasFactory;
class User extends Authenticatable
{
use CrudTrait;
use HasRoles;
use Notifiable;
//use HasApiTokens, HasFactory, Notifiable ;
// protected $guard = 'web';
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'name',
'email',
'password',
];
/**
* The attributes that should be hidden for serialization.
*
* @var array<int, string>
*/
protected $hidden = [
'password',
'remember_token',
];
/**
* The attributes that should be cast.
*
* @var array<string, string>
*/
protected $casts = [
'email_verified_at' => 'datetime',
];
}
我检查了我的配置文件,并与官方文档进行了比较,但对我来说,这是OK的…
例外是:[1]: https://i.stack.imgur.com/ypSJ6.png
[2022-06-27 15:29:20] local。ERROR: Undefined index: model {"exception"; "[object] (ErrorException(code: 0): Undefined index: model at E:laragonwwwlara_boltrvendorbackpackcrudsrcappLibraryCrudPanelTraitsFakeFields.php:42)(加)
我检查了所有的文件,但我不知道哪里有错误我的背包版本是5.0