samedi 25 août 2018

Empty cart content when submitted

I have a really basic cart that simply sends off an email when submitted. But I can't get the items to clear out, I have an if statement on the checkout page to empty it but it does not seem to work properly.

Here is the code for that blade:

    <article class="lead-in-aside">
            @if(session()->has('success'))
                (Cart::content('empty'));
            @endif
            <h2>Check Out</h2>
            <form action=" " method="POST">
                
                <fieldset>
                    <div class="table-wrapper">
                        <div class="table-inner">
                            <table class="table-content">
                                <tbody>
                                    <tr>
                                        <th>Title</th>
                                        <th>Name</th>
                                        
                                    </tr>
                                    @foreach (Cart::content() as $item)
                                    <tr class="highlight">
                                        <td> </td>
                                        <input type="hidden" name="">
                                        <td></td>
                                        <input type="hidden" name="">
                                        </td> --}}
                                    </tr>
                                    @endforeach
                                </tbody>
                            </table>
                        </div>
                    </div>
                </fieldset>

And here is the code in the controller:

        Mail::send('emails.rental', [
        'name'=>$request->firstname,
        'company'=>$request->companyname,
        'phone'=>$request->phone,
        'email'=>$request->email,
        'msg'=>$request->message,
        'rental'=>$request->name,
        'pickup'=>$request->pickup_date,
        'return'=>$request->return_date,
        'location'=>$request->location
    ], 


        function($newRental) use ($request){
        $newRental->from($request->email, $request->firstname);


    });

    // Session::flash('success', 'Your Email was Sent!');

    return redirect()->back()->with('success', 'Your rental request has been sent');
 }



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2LqGc4J
via IFTTT

Aucun commentaire:

Enregistrer un commentaire