public function edit($id) { $orders = Order::with('product')->where('order_unique_id', $id)->get(); $products = Product::lists('product_name', 'id'); $title = "Edit order ( {$id})"; return view('order.edit', compact('orders', 'title', 'products', 'id')); }
public function run() { $faker = Faker::create(); $categoriesIds = Category::lists('id')->all(); $ProductsIds = Product::lists('id')->all(); foreach (range(1, Product::count()) as $index) { DB::table('category_product')->insert(['category_id' => $faker->randomElement($categoriesIds), 'product_id' => $index]); } }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { $edit = true; //hien thi ten khach hang $order = Order::find($id); $transaction = Transaction::lists('id', 'id'); $product = Product::lists('name', 'id'); return view('orders.edit', compact('order', 'transaction', 'product', 'edit')); }
/** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function create() { $products = Product::lists('name', 'id'); $users = User::lists('name', 'id'); return view('problem.create')->with(['products' => $products, 'users' => $users]); }