public function destroy(Page $page, URL $url) { $this->auth($page); if (!$url->isPrimary()) { URLFacade::delete($url); } }
public function boot() { parent::boot(); Models\Asset::observe(CreationLogObserver::class); Models\AssetVersion::observe(CreationLogObserver::class); Models\Page::observe(CreationLogObserver::class); Models\PageVersion::observe(CreationLogObserver::class); Models\Asset::observe(SetSiteObserver::class); Models\Group::observe(SetSiteObserver::class); Models\Page::observe(SetSiteObserver::class); Models\Tag::observe(SetSiteObserver::class); Models\URL::observe(SetSiteObserver::class); Models\Page::observe(DeletionLogObserver::class); }
public function testScheme() { $url = new URL(['location' => 'test']); $this->assertEquals('webcal://localhost/test', $url->scheme('webcal')); }
/** * @param string $location * * @return URLInterface */ public function findByLocation($location) { return $this->model->where('location', '=', URLHelper::sanitise($location))->first(); }
/** * Returns the primary URL for the given page. * * @param PageInterface $page * * @return URLInterface */ public function page(PageInterface $page) { return $this->model->where(Model::ATTR_PAGE_ID, '=', $page->getId())->where(Model::ATTR_IS_PRIMARY, '=', true)->first(); }