Esempio n. 1
0
 /**
  * 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();
 }
Esempio n. 2
0
 /**
  * @param SiteModelInterface $site
  *
  * @return SiteModelInterface
  */
 public function save(SiteModelInterface $site)
 {
     return $site->save();
 }
Esempio n. 3
0
 /**
  * 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();
 }
Esempio n. 4
0
 public function execute(Builder $query)
 {
     return $query->join('asset_site', 'asset.id', '=', 'asset_site.asset_id')->where('asset_site.site_id', '=', $this->site->getId());
 }
Esempio n. 5
0
 /**
  * @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());
 }
Esempio n. 6
0
 /**
  * @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();
 }
Esempio n. 7
0
 public function scopeWhereSiteIs(Builder $query, Site $site)
 {
     return $query->where('site_id', '=', $site->getId());
 }
Esempio n. 8
0
 /**
  * @param Site $site
  *
  * @return bool
  */
 public function hasSite(Site $site)
 {
     return $this->sites()->where(SiteModel::ATTR_ID, '=', $site->getId())->exists();
 }
Esempio n. 9
0
 /**
  * @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();
 }