Exemplo n.º 1
0
 public function handle()
 {
     $url = $this->location !== null ? $this->location : URLHelper::fromTitle($this->page->getSite(), $this->prefix, $this->page->getTitle());
     $url = URLFacade::create($url, $this->page, true);
     Bus::dispatch(new MakeURLPrimary($url));
     return $url;
 }
Exemplo n.º 2
0
 public function __construct($link)
 {
     parent::__construct($link);
     if (is_numeric($link)) {
         $this->page = Page::find($link);
     } else {
         // Extract the query string and fragement
         $this->queryString = parse_url($link, PHP_URL_QUERY);
         $this->urlFragment = parse_url($link, PHP_URL_FRAGMENT);
         $path = URL::getInternalPath($link);
         $this->page = Page::findByUri($path);
     }
 }
Exemplo n.º 3
0
 /**
  * @param string $value
  */
 public function setPrimaryUriAttribute($value)
 {
     $this->attributes[self::ATTR_PRIMARY_URI] = URLHelper::sanitise($value);
 }
Exemplo n.º 4
0
 /**
  * @param string $value
  */
 public function setLocationAttribute($value)
 {
     $this->attributes[self::ATTR_LOCATION] = URLHelper::sanitise($value);
 }
Exemplo n.º 5
0
 public static function factory($link)
 {
     return is_numeric($link) || URL::isInternal($link) ? new Internal($link) : new External($link);
 }
Exemplo n.º 6
0
 public function setUrlAttribute($value)
 {
     $this->attributes['url'] = URL::makeRelative($value);
 }
Exemplo n.º 7
0
 public function setUrlAttribute($value)
 {
     $this->attributes[self::ATTR_URL] = URL::makeRelative($value);
 }
Exemplo n.º 8
0
 /**
  * @param string $location
  *
  * @return URLInterface
  */
 public function findByLocation($location)
 {
     return $this->model->where('location', '=', URLHelper::sanitise($location))->first();
 }
Exemplo n.º 9
0
 /**
  * @param string $location
  *
  * @return URLInterface
  */
 public function findByLocation($location)
 {
     return $this->model->where(Model::ATTR_SITE, '=', $this->site->getId())->where(Model::ATTR_LOCATION, '=', URLHelper::sanitise($location))->first();
 }