Silber\Bouncer\Clipboard::registerAt PHP Method

registerAt() public method

Register the clipboard at the given gate.
public registerAt ( Illuminate\Contracts\Auth\Access\Gate $gate ) : void
$gate Illuminate\Contracts\Auth\Access\Gate
return void
    public function registerAt(Gate $gate)
    {
        $gate->before(function ($authority, $ability, $arguments = [], $additional = null) {
            list($model, $additional) = $this->parseGateArguments($arguments, $additional);
            if (!is_null($additional)) {
                return;
            }
            if ($id = $this->checkGetId($authority, $ability, $model)) {
                return $this->allow('Bouncer granted permission via ability #' . $id);
            }
            // If the response from "checkGetId" is "false", then this ability
            // has been explicity forbidden. We'll return false so the gate
            // doesn't run any further checks. Otherwise we return null.
            return $id;
        });
    }