FEATURE #1427: add basic homepage support
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user