Пример #1
0
 /**
  * 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);
 }
Пример #2
0
 /**
  * Set the stream.
  *
  * @param EntryInterface $entry
  * @param                $config
  */
 protected function setStream(EntryInterface $entry, &$config)
 {
     $config['fields']['stream'] = $entry->getStreamSlug();
     $config['fields']['namespace'] = $entry->getStreamNamespace();
 }
Пример #3
0
 /**
  * Return the view URL.
  *
  * @return string
  */
 public function viewUrl()
 {
     return url(implode('/', array_unique(array_filter(['admin', $this->object->getStreamNamespace(), $this->object->getStreamSlug(), 'view', $this->object->getId()]))));
 }