Ejemplo n.º 1
0
 public function getIndex()
 {
     $categories = array();
     foreach (Category::all() as $category) {
         $categories[$category->id] = $category->name;
     }
     return View::make('products.index')->with('products', Product::all())->with('categories', $categories);
 }
Ejemplo n.º 2
0
 public function postDestroy()
 {
     $category = Category::find(Input::get('id'));
     if ($category) {
         $category->delete();
         return Redirect::to('admin/categories/index')->with('message', 'Category Deleted');
     }
     return Redirect::to('admin/categories/index')->with('message', 'Something went wrong, please try again!');
 }
Ejemplo n.º 3
0
 public function __construct()
 {
     $this->beforeFilter(function () {
         View::share('catnav', Category::all());
     });
 }
Ejemplo n.º 4
0
 public function getCategory($cat_id)
 {
     return View::make('store.category')->with('products', Product::where('category_id', '=', $cat_id)->paginate(6))->with('category', Category::find($cat_id));
 }