{@inheritdoc}

@param string|\Ems\Contracts\Core\AppliesToResource $resource

@return self
960123
public function by($resource)
    {
        $resourceName = $resource instanceof AppliesToResource ? $resource->resourceName() : $resource;

        return new static($this->model, $resourceName);
    }
768845
public function nest(self $resource)
    {
        foreach ($this->routes as $route) {
            if ($route->getAction()[1] === "show") {
                $this->set($resource->forget()->setPrefix($this->getNestedPrefix($route->getPattern()))); break;
            }
        }

        return $this;
    }
275509
public function setResource( $resource )
	{
		if( !is_resource( $resource ) )
			throw new InvalidArgumentException( 'Must be a valid image resource' );
		if( $this->resource )
			imagedestroy( $this->resource );

		$this->resource	= $resource;
		$this->width	= imagesx( $resource );
		$this->height	= imagesy( $resource );

		if( function_exists( 'imageantialias' ) )
			imageantialias( $this->resource, TRUE );

		imagealphablending( $this->resource, FALSE );											//  disable alpha blending in favour to
		imagesavealpha( $this->resource, TRUE );											//  copying the complete alpha channel
	}
566083
protected function resolveTransformerForResource($resource)
    {
        $transformer = null;

        if ($this->transformerResolver !== null) {
            $transformer = $this->transformerResolver->resolve($resource);
        }

        return $transformer;
    }
1237759
protected function detectRules(AppliesToResource $resource)
    {

        if (!$this->ruleDetector) {
            throw new UnConfiguredException("You have to assign a rule detector to detect rules");
        }

        return $this->ruleDetector->detectRules($resource, $this->relations);
    }
841287
public static function createFromResource(Resource $resource, array $options = [])
    {
        $entity = new self();

        $entity->applyResource($resource);

        return $entity;
    }
256603
protected function _loadResource($resource) {
        return $this->cache([__METHOD__, $resource], function() use ($resource) {
            $data = $this->getLocaleBundle()->loadResource(null, $resource);

            if ($parent = $this->getParentLocale()) {
                $data = array_merge(
                    $parent->getLocaleBundle()->loadResource(null, $resource),
                    $data
                );
            }

            return $data;
        });
    }
1047045
public function addSecondaryResource(ResourceNode $resource)
    {
        if (!$this->secondaryResources->contains($resource)) {
            $this->secondaryResources->add($resource);
        }

        return $this;
    }
1304714
public function detectRules(AppliesToResource $resource, $relationDepth=1)
    {
        $type = $this->typeProvider->xType($resource);
        return $this->ruleConverter->toRule($type, $relationDepth);
    }
526488
public function checkResource($resource)
    {
        $resource =
            $resource instanceof Resource
                ? $resource
                : $this->getResourceBySlug($resource);

        $checked = $this->cache->remember($resource->slug, function () use (
            $resource
        ) {
            return $resource->check($this->getCurrentAction());
        });

        $resource->targets = $checked->targets;

        return $resource;
    }
764389
public function putAction( $resource )
	{
		$response = $this->createAdmin( $resource )->put( $this->getPsrRequest(), new Response() );
		return $this->setPsrResponse( $response );
	}
578783
public function make(array $rules, AppliesToResource $resource=null)
    {

        if (!$resource) {
            return null;
        }

        $rules = array_merge($this->detectRules($resource), $rules);

        return $this->createObject(GenericValidator::class)->setRules($rules);

    }
429157
protected function handleResource($resource) {
		if ($resource instanceof Resource) {
			return $resource;
		}
		
		// Is not a local resource
		if (preg_match('~^[a-z]+:~', $resource)) {
			$slashPos = strrpos($resource, '/');
			
			$base = substr($resource, 0, $slashPos);
			$name = substr($resource, $slashPos + 1);
			
			$resource = new Resource($name, $base, $base, $this->metadataManager);
		} else {
			$resource = new Resource($resource, $this->basePath, $this->baseUrl, $this->metadataManager);
		}
		
		if ($this->hashAppend) {
			$resource->setHashAppend(true);
		}
		
		return $resource;
	}
414555
public function addResource(string ...$resource)
    {
        foreach ($resource as $_resource)
        {
            $this->resourceRegistry->save($_resource);
        }
    }
1284932
public function prependResource($resource) {
		$resource = $this->handleResource($resource);
		
		$this->resources->unshift($resource);
		return $resource;
	}
154942
public T setAppResource(String resource) {
    checkNotNull(resource, "resource");
    builder.appResource = resource;
    return self();
  }
183759
public function addResource(ResourceInterface $resource)
    {
        if (!$this->trackResources) {
            return $this;
        }

        $this->resources[] = $resource;

        return $this;
    }