Laravel背包权限管理器错误:未定义的索引:模型

发布于 2025-02-10 23:48:52 字数 132 浏览 2 评论 0原文

我在文档官员之后安装了许可人包。

但是,当我添加新用户时,我会得到一个例外:未定义的索引:模型

我的用户模型是标准的(App \ Models \ User :: Class),但我找不到解决方案...

谢谢

I installed the PermissionManager package following the documentation Official.

But, when i add a new user i get an exception : Undefined index: model

My User model is standard (App\Models\User::class) but I can't find a solution...

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

雪落纷纷 2025-02-17 23:48:52

是的,我的模型是:

<?php

namespace App\Models;

use Backpack\CRUD\app\Models\Traits\CrudTrait;

use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Spatie\Permission\Traits\HasRoles;
//use Laravel\Sanctum\HasApiTokens;
//use Illuminate\Contracts\Auth\MustVerifyEmail;
//use Illuminate\Database\Eloquent\Factories\HasFactory;


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',
    ];
}

我检查我的配置文件并与官方文档进行比较,但是对我来说还可以...

例外是:
[1]: https://i.sstatic.net.net/ypsj6.png

06-27 15:29:20] local.error:未定义的索引:型号{“异常”:“ [object](errorexception(code:0):Undefined Index:e:\ laragon \ laragar \ www \ lara_boltr \ vendor \ vendor \ vendor \ vendor \ vendor \ vendor \ vendor \ vendor backpack \ crud \ src \ app \ library \ crudpanel \ traits \ fakefields.php:42)
[stacktrace]

我已经检查了所有文件,但是我会理解一个错误
我的背包版本是5.0

Yes, my model is :

<?php

namespace App\Models;

use Backpack\CRUD\app\Models\Traits\CrudTrait;

use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Spatie\Permission\Traits\HasRoles;
//use Laravel\Sanctum\HasApiTokens;
//use Illuminate\Contracts\Auth\MustVerifyEmail;
//use Illuminate\Database\Eloquent\Factories\HasFactory;


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',
    ];
}

I check my configuration files and compare with official documentation, but for me it's OK...

The exception is :
[1]: https://i.sstatic.net/ypSJ6.png

[2022-06-27 15:29:20] local.ERROR: Undefined index: model {"exception":"[object] (ErrorException(code: 0): Undefined index: model at E:\laragon\www\lara_boltr\vendor\backpack\crud\src\app\Library\CrudPanel\Traits\FakeFields.php:42)
[stacktrace]

I've checked all files, but i'dont understand where is a mistake
My Backpack version is 5.0

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文