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?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire