FEATURE #1427: add homepage functionality.

Displaying homepage now depends on module handler
This commit is contained in:
Michal Kváček
2016-02-17 13:24:16 +01:00
parent 6d0e6e26f6
commit 37a698b631
15 changed files with 329 additions and 38 deletions
+35
View File
@@ -31,6 +31,41 @@ class Content extends Model
const STATUS_PROTECTED = 'protected';
const STATUS_PUBLIC = 'public';
/**
* Getter for query with setup filter for non-deleted and non-draft pages
*/
protected function getPageQuery()
{
return Content::where('status', '!=', Content::STATUS_DELETED)
->where('status', '!=', Content::STATUS_DRAFT);
}
/**
* Getter for homepage content page
*
* @return Content
*/
public function getHomepage()
{
return $this->getPageQuery()
->where('is_homepage', 1)
->first();
}
/**
* Getter for any page specified by its url.
*
* @param $url
*
* @return Content
*/
public function getByURL($url)
{
return $this->getPageQuery()
->where('url', $url)
->first();
}
/**
* Getter for overview of all content pages of given handler (module type)
*