app/Http/Controllers/CartController.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)
    {
         $prod_id=$request->input('id');
        $maxValue = Cart::where('product_id',$prod_id)->max('amount');
        $amount=$request->input('mont');
        $cart = new Cart;
        $cart->user_id=auth()->user()->id;
        $cart->user_name=auth()->user()->name;
        $cart->product_id = $prod_id;
        $cart->product_title = $request->input('title');
        $cart->slug=$request->input('slug');
        $cart->bid_time=Carbon::now();
        $cart->amount =$amount; 
        $cart->save();
        return redirect::back()->with('success', 'bid added');
    }
public function store ( Request $ request ) { $ prod_id = $ request -> input ( 'id' ) ; $ maxValue = Cart :: where ( 'product_id' , $ prod_id ) -> max ( 'amount' ) ; $ amount = $ request -> input ( 'mont' ) ; $ cart = new Cart ; $ cart -> user_id = auth ( ) -> user ( ) -> id ; $ cart -> user_name = auth ( ) -> user ( ) -> name ; $ cart -> product_id = $ prod_id ; $ cart -> product_title = $ request -> input ( 'title' ) ; $ cart -> slug = $ request -> input ( 'slug' ) ; $ cart -> bid_time = Carbon :: now ( ) ; $ cart -> amount = $ amount ; $ cart -> save ( ) ; return redirect :: back ( ) -> with ( 'success' , 'bid added' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .
// if ($maxValue<$request->input('price')){ //     $maxValue=$request->input('price'); // } //$amount=$request->input('price')+$request->input('mont');   // return redirect()->route('products.ind',[$request->input('slug')])->with('success', 'bid added');