use AuthorizesRequests {
resourceAbilityMap as protected resourceAbilityMapTrait;
}
public function __construct()
{
$this->authorizeResource(User::class, 'user');
}
protected function resourceAbilityMap(): array
{
$ability = $this->resourceAbilityMapTrait();
$ability['status'] = 'update';
$ability['restore'] = 'restore';
return $ability;
}
public function status(){}
public function restore(){}
上面例子列举添加 status
方法 对应 update
策略 , restore
方法对应 restore
策略, restore
策略需要自己添加