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
+7 -7
View File
@@ -3,24 +3,24 @@
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();
$page = $this->content->getHomepage();
// test if we have any homepage
if (!$page) {
throw new InvalidArgumentException('Cannot load home page!');
return view('errors.homepageNotAvailable');
}
// render page
return $this->renderPage($page);
try {
return $this->renderPage($page);
} catch (\Exception $e) {
return view('errors.homepageNotAvailable');
}
}
}