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;
});
}