FEATURE #1427: add basic homepage support

This commit is contained in:
Michal Kváček
2016-02-15 17:09:50 +01:00
parent 36fc280f55
commit 6d0e6e26f6
3 changed files with 72 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
<?php
namespace App\Http\Controllers\Visitor;
use App\Http\Requests;
use App\Models\Content;
use Symfony\Component\Process\Exception\InvalidArgumentException;
class Homepage extends ContentPage
{
public function getIndex()
{
// try to find some homepage
$page = Content::where('is_homepage', 1)
->where('status', '!=', Content::STATUS_DELETED)
->first();
// test if we have any homepage
if (!$page) {
throw new InvalidArgumentException('Cannot load home page!');
}
// render page
return $this->renderPage($page);
}
}