/**
  * Handle the command.
  *
  * @param UrlGenerator $url
  * @return LinkInterface|null
  */
 public function handle(UrlGenerator $url)
 {
     /* @var LinkInterface $link */
     foreach ($this->links as $link) {
         if ($url->to($this->root) == $link->getUrl()) {
             return $link;
         }
     }
     return null;
 }
 /**
  * Make a route.
  *
  * @param                    $route
  * @param  array             $parameters
  * @return mixed|null|string
  */
 public function make($route, array $parameters = [])
 {
     if (method_exists($this, $method = $this->str->camel(str_replace('.', '_', $route)))) {
         $parameters['parameters'] = $parameters;
         return $this->container->call([$this, $method], $parameters);
     }
     if (!str_contains($route, '.') && ($stream = $this->entry->getStreamSlug())) {
         $route = "{$stream}.{$route}";
     }
     if (!str_contains($route, '::') && ($namespace = $this->locator->locate($this->entry))) {
         $route = "{$namespace}::{$route}";
     }
     return $this->url->make($route, $this->entry, $parameters);
 }
Exemple #3
0
 /**
  * Return the asset path to a compiled asset collection.
  *
  * @param         $collection
  * @param  array $filters
  * @return string
  */
 public function asset($collection, array $filters = [])
 {
     if (!isset($this->collections[$collection])) {
         $this->add($collection, $collection, $filters);
     }
     return $this->url->asset($this->getPath($collection, $filters));
 }
 /**
  * Return the URL to a compiled asset collection.
  *
  * @param        $collection
  * @param  array $filters
  * @return string
  */
 public function url($collection, array $filters = [], array $parameters = [], $secure = null)
 {
     if (!isset($this->collections[$collection])) {
         $this->add($collection, $collection, $filters);
     }
     if (!($path = $this->getPath($collection, $filters))) {
         return null;
     }
     return $this->url->asset($this->getPath($collection, $filters), $parameters, $secure);
 }
 /**
  * Return the URL data.
  *
  * @return array
  */
 protected function urlData()
 {
     return ['previous' => $this->url->previous()];
 }
 /**
  * Return the URL to an image.
  *
  * @param array $parameters
  * @param null  $secure
  * @return string
  */
 public function url(array $parameters = [], $secure = null)
 {
     return $this->url->asset($this->path(), $parameters, $secure);
 }