/** * Set grant information * * @param string $action action type * @param string|array $type value type * @param mixed $value values * @return $this * @throws InvalidArgumentException */ public function set($action, $type, $value = null) { if (array_key_exists($action, Action::all()) === false) { throw new InvalidArgumentException(['name' => 'action', 'value' => $action]); } $this->attributes[$action] = $this->makeValue($type, $value); return $this; }
/** * 요청한 action 을 현재 permission 에서 체크 가능한지 여부 판별 * * @param string $action action keyword * @return bool */ protected function support($action) { return array_search($action, array_merge($this->actions, Action::all())) !== false; }