private function getSubcategory($subcategory) { $subcat = Category::where('slug', $subcategory)->where('is_active', true)->first(); if (!$subcat) { abort(404); } return $subcat; }
/** * Fetch site category for the main (drop-down) menu. * * @param View $view */ public function composeView(View $view) { $view->with('stores', Category::where('is_active', true)->where('parent_id', null)->get()); }