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;
 }
示例#2
0
 public function postAdd()
 {
     $location = $this->request->input('location');
     $this->url = URL::findByLocation($location);
     if ($this->url && !$this->url->isForPage($this->page)) {
         // Url is being used for a different page.
         // Notify that the url is already in use so that the JS can load a prompt to move the url.
         return ['existing_url_id' => $this->url->getId()];
     } elseif (!$this->url) {
         URL::create($location, $this->page->getId());
     }
 }
示例#3
0
 public function store(Request $request, Page $page)
 {
     $this->auth($page);
     $location = $request->input('location');
     $url = URLFacade::findByLocation($location);
     if ($url && !$url->isForPage($page)) {
         // Url is being used for a different page.
         // Notify that the url is already in use so that the JS can load a prompt to move the url.
         return ['existing_url_id' => $url->getId()];
     }
     if (!$url) {
         URLFacade::create($location, $page);
     }
 }