如何在JosephSilber / bouncer的“能力”中添加组?

时间:2019-05-07 16:05:50

标签: php laravel acl

我想创建一组能力;我制作了一个自定义模型App \ Models \ Role和App \ Models \ Ability来覆盖Bouncer。

namespace App\Models;

use Silber\Bouncer\Database\Role as BouncerRole;

class Role extends BouncerRole
{

}

namespace App\Models;

use Silber\Bouncer\Database\Ability as BouncerAbility;

class Ability extends BouncerAbility
{
    protected $fillable = [
        'name', 'title', 'entity_id', 'entity_type', 'only_owned', 'options', 'scope', 'group_id'
    ];

    public function group()
    {
        return $this->belongsTo(Group::class);
    }
}

但是当我查询Role :: with('abilities')-> get()能力为空时,尽管当我使用Bouncer的方法时,能力就会出现

0 个答案:

没有答案