예제 #1
0
 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     $cart = new Cart();
     view()->share('categories', tbl_categories::all());
     view()->share('cart_count', $cart->count());
 }
예제 #2
0
 public function deleteCategory($cid)
 {
     $product_list = tbl_product::where('category', '=', $cid)->get();
     if (count($product_list) > 0) {
         foreach ($product_list as $p) {
             $product = tbl_product::find($p->id);
             $product->delete();
         }
     }
     $category = tbl_categories::find($cid);
     $category->delete();
     return Redirect::back();
 }