public function __construct() { $this->positionTop = \Model\Banner\ModelName::where('positionTop', '=', '1')->first(); $this->positionRight = \Model\Banner\ModelName::where('positionRight', '=', '1')->first(); $this->positionCenter = \Model\Banner\ModelName::where('positionCenter', '=', '1')->first(); $this->positionBottom = \Model\Banner\ModelName::where('positionBottom', '=', '1')->first(); }
public function categoryPage(\Model\Category\ModelName $category) { $category_id = $category->id; $posts = \Model\Post\ModelName::where('category_id', '=', $category_id)->get(); $positionTop = \Model\Banner\ModelName::where('positionTop', '=', '1')->first(); $positionRight = \Model\Banner\ModelName::where('positionRight', '=', '1')->first(); $positionCenter = \Model\Banner\ModelName::where('positionCenter', '=', '1')->first(); $positionBottom = \Model\Banner\ModelName::where('positionBottom', '=', '1')->first(); $categories = \Model\Category\ModelName::all(); $backgroundMain = \Model\Background\ModelName::where('published', '=', true)->first(); return view('Front::category.index', ['posts' => $posts, 'category' => $category, 'positionTop' => $positionTop, 'positionRight' => $positionRight, 'positionCenter' => $positionCenter, 'positionBottom' => $positionBottom, 'categories' => $categories, 'backgroundMain' => $backgroundMain]); }