app/Http/Controllers/OrderController.php
/**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
Store a newly created resource in storage.
Store a newly created resource in storage .
public function store(Request $request)
    {
        $invoice_code = "INV_" . date('YmdHis') .  $request->user_id . $request->product_id;
        Order::create([
            'user_id' => $request->user_id,
            'product_id' => $request->product_id,
            'status_id' => $request->status_id,
            'quantity' => $request->quantity,
            'invoice_code' => $invoice_code
        ]);
        return redirect()->back()->with('status', 'Add to Cart success!');
    }
public function store ( Request $ request ) { $ invoice_code = " INV_ " . date ( 'YmdHis' ) . $ request -> user_id . $ request -> product_id ; Order :: create ( [ 'user_id' => $ request -> user_id , 'product_id' => $ request -> product_id , 'status_id' => $ request -> status_id , 'quantity' => $ request -> quantity , 'invoice_code' => $ invoice_code ] ) ; return redirect ( ) -> back ( ) -> with ( 'status' , 'Add to Cart success!' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .