public function getEdit($id) { // Find the product using the user id $product = Product::find($id); // No such id if ($product == null) { return \View::make('redminportal::pages/404'); } $categories = array(); foreach (Category::all() as $category) { $categories[$category->id] = $category->name; } $tagString = ""; foreach ($product->tags as $tag) { if (!empty($tagString)) { $tagString .= ","; } $tagString .= $tag->name; } if (empty($product->options)) { $product_cn = (object) array('name' => $product->name, 'short_description' => $product->short_description, 'long_description' => $product->long_description); } else { $product_cn = json_decode($product->options); } return View::make('redminportal::products/edit')->with('product', $product)->with('product_cn', $product_cn)->with('imageUrl', 'assets/img/products/')->with('categories', $categories)->with('tagString', $tagString); }
public function testAll() { $categories = Category::all(); $this->assertTrue($categories != null); }