Beispiel #1
0
 public function loadProductInTransaction($newTrans, $userId, $role, $productId)
 {
     $product = Products::find($productId);
     if ($role == 1) {
         $cost = $product->member;
     } else {
         $cost = $product->non_member;
     }
     $pay_bonus = $product->pay_bonus;
     $detail = new \SalesTransactionDetails();
     $detail->transaction_id = $newTrans->id;
     $detail->date = now();
     $detail->purchased_by = $userId;
     $detail->amount = $cost;
     $detail->product_id = $productId;
     $detail->pay_bonus = $pay_bonus;
     $detail->shipping = $product->shipping_handling;
     $detail->save();
     $this->updateTransaction($newTrans, $detail);
     return $newTrans;
 }
Beispiel #2
0
 /**
  * Remove the specified resource from storage.
  *
  * @param   $request
  * @return \Illuminate\Http\Response
  */
 public function destroy(Request $request)
 {
     $products = Products::find($request->input('id'));
     $products->delete();
     return "Products record successfully deleted #" . $products->input('id');
 }
 public function destroy($id)
 {
     Products::find($id)->delete();
     return redirect()->route('products');
 }