app/Http/Controllers/SanPhamController.php
/**
     * Remove the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
Remove the specified resource in storage.
Remove the specified resource in storage .
public function removeCart(Request $request)
    {
        if($request->id) {
            $cart = session()->get('cart');
            if(isset($cart[$request->id])) {
                unset($cart[$request->id]);
                session()->put('cart', $cart);
            }
            session()->flash('success', 'Product removed successfully');
        }
    }
public function removeCart ( Request $ request ) { if ( $ request -> id ) { $ cart = session ( ) -> get ( 'cart' ) ; if ( isset ( $ cart [ $ request -> id ] ) ) { unset ( $ cart [ $ request -> id ] ) ; session ( ) -> put ( 'cart' , $ cart ) ; } session ( ) -> flash ( 'success' , 'Product removed successfully' ) ; } }
Remove the specified resource in storage.
Remove the specified resource in storage .