public function __construct()
{
- $this->data['global'] = Settings::find(1);
+ $this->data['global'] = Settings::find(1)->withFakes()->getDecodedAttributes();
}
+ public function index($slug = 'home')
+ {
+ $class = CMSPage::getPageClass();
+ $page = $class::findBySlug($slug);
+
+ if (!$page) {
+ $this->_404();
+ }
+
+ $this->data['title'] = $page->title;
+ $this->data['page'] = $page->withFakes()->getDecodedAttributes();
+
+ return view('pages.' . $page->template, $this->data);
+ }
+
protected function _404()
{
abort(404, 'Please go back to our <a href="' . url('') . '">homepage</a>.');