REFACTORING: another ugly commit full of refactored code
This commit is contained in:
@@ -2,9 +2,10 @@
|
||||
|
||||
namespace App\Http\Controllers\Visitor;
|
||||
|
||||
use App\Models\Content\Content as ContentModel;
|
||||
use App\CMS\Contracts\Repositories\Content;
|
||||
use App\CMS\Helpers\PageRenderer;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Content\Content;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class ContentPage extends Controller
|
||||
@@ -43,11 +44,10 @@ class ContentPage extends Controller
|
||||
* @return mixed
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function renderPage(Content $page)
|
||||
protected function renderPage(ContentModel $page)
|
||||
{
|
||||
// test if loaded page is visible or not
|
||||
if ($page->status == Content::STATUS_PROTECTED && !Auth::user()) {
|
||||
// throw new \Exception('Cannot access protected resources');
|
||||
if ($page->isProtected() && !Auth::user()) {
|
||||
abort(404);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
namespace App\Http\Controllers\Visitor;
|
||||
|
||||
use App\Http\Requests;
|
||||
|
||||
class Homepage extends ContentPage
|
||||
{
|
||||
public function getIndex()
|
||||
@@ -17,10 +15,6 @@ class Homepage extends ContentPage
|
||||
}
|
||||
|
||||
// render page
|
||||
// try {
|
||||
return $this->renderPage($page);
|
||||
// } catch (\Exception $e) {
|
||||
// return view('errors.homepageNotAvailable', ['exception' => $e, 'reason' => 'exception']);
|
||||
// }
|
||||
return $this->renderPage($page);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user