/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { $stock = $this->stock->find($id); if (is_null($stock)) { return Redirect::route('stocks.index'); } $terminals = Terminal::all(); $arrTerminals = array(); foreach ($terminals as $terminal) { $arrTerminals[$terminal->id] = $terminal->name; } $productss = Product::all(); $arrProducts = array(); foreach ($productss as $products) { $arrProducts[$products->id] = $products->title; } return View::make('stocks.edit', compact('stock'), array('terminals_selector' => $arrTerminals, 'products_selector' => $arrProducts, 'promo_type_selector' => Promo::getTypes())); }