/**
  * Attempts to delete the given privilege
  *
  * @param ResourceInterface $privilege
  * @return boolean
  */
 public function delete(ResourceInterface $privilege)
 {
     /**
      * @var EloquentResource $privilege
      */
     return $privilege->delete();
 }
Example #2
0
 /**
  * Returns true if and only if the Resource exists in the ACL
  *
  * The $resource parameter can either be a Resource or a Resource identifier.
  *
  * @param  ResourceInterface|string $resource
  * @return boolean
  */
 public function has($resource)
 {
     if ($resource instanceof Resource) {
         $resourceId = $resource->getResourceId();
     } else {
         $resourceId = (string) $resource;
     }
     return isset($this->_resources[$resourceId]);
 }
 /**
  * Add a translation resource to the catalog.
  *
  * @param  ResourceInterface $resource The resource.
  * @return self
  */
 public function addResource(ResourceInterface $resource)
 {
     $langCode = $resource->sourceLanguage();
     if ($langCode) {
         foreach ($resource as $ident => $message) {
             $this->addEntryTranslation($ident, $langCode, $message);
         }
     } else {
         foreach ($resource as $ident => $translations) {
             $this->addEntry($ident, $translations);
         }
     }
     return $this;
 }
Example #4
0
 protected function throwExceptionIfNotLinkableResouce(ResourceInterface $resource)
 {
     $link = $resource->getSelfLink();
     if (!$link) {
         throw new InvalidArgumentException('This resource not contains a valid URI');
     }
 }