Silber\Bouncer\Clipboard::checkGetId PHP Method

checkGetId() protected method

Determine if the given authority has the given ability, and return the ability ID.
protected checkGetId ( Model $authority, string $ability, Model | string | null $model = null ) : integer | boolean | null
$authority Illuminate\Database\Eloquent\Model
$ability string
$model Illuminate\Database\Eloquent\Model | string | null
return integer | boolean | null
    protected function checkGetId(Model $authority, $ability, $model = null)
    {
        $applicable = $this->compileAbilityIdentifiers($ability, $model);
        // We will first check if any of the applicable abilities have been forbidden.
        // If so, we'll return false right away, so as to not pass the check. Then,
        // we'll check if any of them have been allowed & return the matched ID.
        $forbiddenId = $this->findMatchingAbility($this->getForbiddenAbilities($authority), $applicable, $model, $authority);
        if ($forbiddenId) {
            return false;
        }
        return $this->findMatchingAbility($this->getAbilities($authority), $applicable, $model, $authority);
    }