/** * Find a page by URI. * * @param array|string $uri * * @return null|Model|Collection */ public function findByUri($uri) { $query = $this->model->join('page_urls', 'page_urls.page_id', '=', 'pages.id')->select('pages.*')->where('pages.' . Model::ATTR_SITE, '=', $this->site->getId()); if (is_array($uri)) { return $query->where('location', 'in', $uri)->get(); } return $query->where('location', '=', $uri)->first(); }
/** * @param SiteModelInterface $site * * @return SiteModelInterface */ public function save(SiteModelInterface $site) { return $site->save(); }
/** * Determine whether a URL is already being used by a page in the CMS. * * @param string $path * * @return bool */ public function isAvailable($path) { return !$this->model->where(Model::ATTR_SITE, '=', $this->site->getId())->where(Model::ATTR_LOCATION, '=', $path)->exists(); }
public function execute(Builder $query) { return $query->join('asset_site', 'asset.id', '=', 'asset_site.asset_id')->where('asset_site.site_id', '=', $this->site->getId()); }
/** * @param Builder $query * @param SiteInterface $site * * @return Buider */ public function scopeWhereSite(Builder $query, SiteInterface $site) { return $query->join('person_site', 'people.id', '=', 'person_site.person_id')->where('person_site.site_id', '=', $site->getId()); }
/** * @param SiteInterface $site * * @return Collection */ public function findBySite(SiteModelInterface $site) { return $this->model->where(Model::ATTR_SITE, '=', $site->getId())->orderBy(Model::ATTR_NAME, 'asc')->get(); }
public function scopeWhereSiteIs(Builder $query, Site $site) { return $query->where('site_id', '=', $site->getId()); }
/** * @param Site $site * * @return bool */ public function hasSite(Site $site) { return $this->sites()->where(SiteModel::ATTR_ID, '=', $site->getId())->exists(); }
/** * @param SiteInterface $site * * @return TagInterface */ public function findBySite(SiteInterface $site) { return $this->model->select('tags.*')->where('tags.site_id', $site->getId())->appliedToALivePage()->orderBy('group')->orderBy('name')->get(); }