FEATURE #1427: add homepage functionality.
Displaying homepage now depends on module handler
This commit is contained in:
@@ -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)
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user