我想创建一组能力;我制作了一个自定义模型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的方法时,能力就会出现