public function productDetail($sex, $classify, $id)
 {
     $product = Product::find($id);
     $products = Product::where('deleted_at', '=', null)->where('id', '<>', $id)->where('sex', '=', $sex)->where('classify', '=', $classify)->paginate(9);
     $context = ['product' => $product, 'products' => $products];
     return view('front.shop.Detail', $context);
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     // Start transaction!
     \DB::beginTransaction();
     try {
         $product = Product::find($id);
         if ($product) {
             $this->withdraw($product);
             //Product_I10n
             $productI10ns = Product_I10N::where('i18n_id', '=', $id)->get();
             if ($productI10ns) {
                 foreach ($productI10ns as $productI10n) {
                     $this->withdraw($productI10n);
                 }
             }
             // Commit
             \DB::commit();
             return Response::json(['result' => 'OK']);
         }
     } catch (\ValidationException $e) {
         // Rollback and then redirect
         DB::rollback();
         App::abort(404);
     }
     // Rollback
     DB::rollback();
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int $id
  *
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $product = Product::find($id);
     if ($product) {
         if ($product->delete()) {
             return response()->json(true);
         }
     }
     return response()->json('informatia nu s-a putut sterge', 500);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('products')->truncate();
     \App\Models\Product\Product::create(['providerId' => 1, 'categoryId' => 1, 'name' => 'Televizor samsung', 'description' => 'descriere 1', 'image' => 'produs1.png', 'position' => 1, 'active' => 1, 'slug' => 'prod1']);
 }
 public function __construct($name, $cost, DiscountStrategy $discount = null, ContentStrategy $content = null, $period = self::PERIOD_MONTH)
 {
     parent::__construct($name, $cost, $discount, $content);
     $this->period = $period;
 }
示例#6
0
 /**
  * @param int $count
  */
 public function setCount($count)
 {
     $this->count = $this->product->isCountable() ? $count : 1;
 }