Authority\Rule::isRelevant PHP Method

isRelevant() public method

Determine if current rule is relevant based on an action and resource
public isRelevant ( string $action, string | mixed $resource ) : boolean
$action string Action in question
$resource string | mixed Name of resource or instance of object
return boolean
    public function isRelevant($action, $resource)
    {
        return $this->matchesAction($action) && $this->matchesResource($resource);
    }

Usage Example

 /**
  * Determine if current rule is relevant based on an action and resource
  *
  * @param string|array  $action Action in question
  * @param string|mixed  $resource Name of resource or instance of object
  * @return boolean
  */
 public function isRelevant($action, $resource)
 {
     // Nested resources can be passed through a associative array, this way conditions which are
     // dependent upon the association will work when using a class.
     $resource = is_array($resource) ? head(array_keys($resource)) : $resource;
     return parent::isRelevant($action, $resource);
 }