vendredi 27 juillet 2018

How can I sum price on all page in the laravel?

My query like this :

$orders = DB::table('orders')->paginate(10);

My view blade like this :

@php($total = 0)
@foreach ($orders as $order)
    <tr>
        <td></td>
        <td></td>
        ....
    </tr>
    @php($total += $order->price)
@endforeach
...
Total : {!! $total !!}


From the script, I just get total price in one page

How can I get total price in the all page?



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

Aucun commentaire:

Enregistrer un commentaire