示例#1
0
 private function getSubcategory($subcategory)
 {
     $subcat = Category::where('slug', $subcategory)->where('is_active', true)->first();
     if (!$subcat) {
         abort(404);
     }
     return $subcat;
 }
示例#2
0
 /**
  * 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());
 }