Exemplo n.º 1
0
 /**
  * @param ProductRequest $request
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function product_create(ProductRequest $request)
 {
     //        product::create(Request::all());
     //
     product::create($request->all());
     return redirect('add-product');
 }
Exemplo n.º 2
0
 public function detail($slug)
 {
     $product = product::where("slug", "=", $slug)->with('images', 'sizes')->first();
     if (!$product) {
         abort(404);
     }
     return view('product.detail', compact('product'));
 }
Exemplo n.º 3
0
 public function allcategory()
 {
     $products = product::get();
     // get all product
     $category = category::get();
     $id = "All Products";
     return view('Pages.products', compact('products', 'category', 'id'));
     // return products to index page
 }
Exemplo n.º 4
0
 public function run()
 {
     DB::table('images')->truncate();
     $products = product::all()->lists('id');
     $faker = Factory::create();
     foreach ($products as $product) {
         image::create(['image' => $faker->randomElement(["hoody_01_white.jpg", "hoody_01_green.jpg"]), 'imageable_id' => $product, 'imageable_type' => 'App\\product']);
     }
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     // $this->call(UserTableSeeder::class);
     user::create(['username' => 'puah', 'email' => '*****@*****.**']);
     user::create(['username' => 'yan', 'email' => '*****@*****.**', 'user_role' => 'admin']);
     product::create(['productname' => 'clothyan', 'product_price' => '50.00', 'quantity' => '10', 'product_desc' => 'this is good cloth']);
     product::create(['productname' => 'clothyan2', 'product_price' => '52.00', 'quantity' => '12']);
     Model::reguard();
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $products = \App\product::orderBy('product_id')->get();
     $categories = \App\Category::all();
     return view('pages/admin/eCommerce/products/index', compact('products', 'categories'));
 }
 /**
  * @param Request $request
  * @return \Illuminate\Http\RedirectResponse
  */
 public function addpost(Request $request)
 {
     $product = product::with('images')->find($request->input('id'));
     Cart::add($product->id, $product->name, $request->input('amount'), $product->price, ['size' => $request->input('size'), 'image' => $product->images[0]->image]);
     Session::flash('success', "Het product is toegevoegd aan de winkelwagen");
     return redirect()->back();
 }
Exemplo n.º 8
0
 public function destroy($id)
 {
     product::destroy($id);
     return redirect("/admin/products");
 }