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);
 }
Beispiel #2
0
 public function __construct()
 {
     $this->beforeFilter(function () {
         View::share('catnav', Category::all());
     });
 }
 public function getIndex()
 {
     return View::make('categories.index')->with('categories', Category::all());
 }