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; }
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); } }
/** * @param string $value */ public function setPrimaryUriAttribute($value) { $this->attributes[self::ATTR_PRIMARY_URI] = URLHelper::sanitise($value); }
/** * @param string $value */ public function setLocationAttribute($value) { $this->attributes[self::ATTR_LOCATION] = URLHelper::sanitise($value); }
public static function factory($link) { return is_numeric($link) || URL::isInternal($link) ? new Internal($link) : new External($link); }
public function setUrlAttribute($value) { $this->attributes['url'] = URL::makeRelative($value); }
public function setUrlAttribute($value) { $this->attributes[self::ATTR_URL] = URL::makeRelative($value); }
/** * @param string $location * * @return URLInterface */ public function findByLocation($location) { return $this->model->where('location', '=', URLHelper::sanitise($location))->first(); }
/** * @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(); }