Nested routes capture the relation between a resource and another resource.

@param self $resource
@return self
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;
    }
1212816
public function load($resource, $type = null): RouteCollection
    {
        if ($this->loaded) {
            throw new \RuntimeException('Do not add the "extra" loader twice.', 1500587713);
        }

        $routes = new RouteCollection();
        $this->addModuleRoutes($routes);

        $this->loaded = true;

        return $routes;
    }
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;
    }
1278996
protected function collectResource($resource)
    {
        if ($resource instanceof MissingValue) {
            return $resource;
        }

        $collects = $this->collects();

        $this->collection = $collects && ! $resource->first() instanceof $collects
            ? $resource->mapInto($collects)
            : $resource->toBase();

        return $resource instanceof AbstractPaginator
                    ? $resource->setCollection($this->collection)
                    : $this->collection;
    }
84206
public function with($relationships)
    {
        foreach ($this->resources as $resource) {
            $resource->with($relationships);
        }

        return $this;
    }
968198
public function appendResource($resource) {
		$resource = $this->handleResource($resource);
		
		$this->resources[] = $resource;
		return $resource;
	}
622347
public static function httpError(string $resource, string $error) : self
    {
        return new self(
            sprintf('Could not fetch HTTP resource "%s": %s', $resource, $error)
        );
    }
419293
public function apply($resource){
		return parent::apply(
			parent::apply(
				$resource,
				parent::HORIZONTAL,
				2,1,0,0,0
			),
			parent::VERTICAL,
			2,1,0,0,0
		);
	}
1086796
public function load($resource, $type = null)
    {
        if ($this->loaded) {
            throw new RuntimeException('Do not add this loader twice');
        }

        $routes = new RouteCollection();

        $routes->add($this->inputControllerRouteName, new Route($this->inputResizeControllerRoute, [
            '_controller' => 'elcodi.controller.metric_input:addEntryAction',
        ]));

        $this->loaded = true;

        return $routes;
    }
668604
protected function resolveRelativeResource($base, $resource)
    {
        // Return resource path based on relative resource path
        foreach (['', '.min.js', '.js'] as $ext) {
            // Map resource
            if ($base instanceof ModuleResource) {
                $next = $base->getRelativeResource($resource . $ext);
            } else {
                $next = rtrim($base, '/') . '/' . $resource . $ext;
            }
            // Ensure resource exists
            if ($this->resourceExists($next)) {
                return $next;
            }
        }
        return null;
    }
1284932
public function prependResource($resource) {
		$resource = $this->handleResource($resource);
		
		$this->resources->unshift($resource);
		return $resource;
	}
1307755
public function resourceId($id) : self
    {
        $this->id = ($id instanceof \Illuminate\Database\Eloquent\Model) ? $id->getKey() : $id;

        return $this;
    }
169718
public function setContainer($container) : Router
    {
        $this->container = $container;
        $this->routeController->setContainer($container);
        $this->resourceController->setRouter($this);

        return $this;
    }
320157
public function patchAction( $resource, $related )
	{
		$response = $this->createClient( $resource, $related )->patch( $this->getPsrRequest(), new Response() );
		return $this->setPsrResponse( $response );
	}
104714
public function getPublicRelationshipUri($resource, $relationshipName)
    {
        return $this->getPublicUri($resource, $this->resourceControllerActionName,
            $this->getRelationshipControllerArguments($resource, $relationshipName));
    }
62044
public function setResource($rel, $resource)
    {
        if (is_array($resource)) {
            foreach ($resource as $r) {
                $this->addResource($rel, $r);
            }

            return $this;
        }

        if (!($resource instanceof Hal)) {
            throw new \InvalidArgumentException('$resource should be of type array or Nocarrier\Hal');
        }

        $this->resources[$rel][] = $resource;

        return $this;
    }
300548
public function addCollection(self $collection)
    {
        // we need to remove all routes with the same names first because just replacing them
        // would not place the new route at the end of the merged array
        foreach ($collection->all() as $name => $route) {
            unset($this->routes[$name]);
            $this->routes[$name] = $route;
        }

        foreach ($collection->getResources() as $resource) {
            $this->addResource($resource);
        }
    }