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); }