In my Laravel blade template, I have a table in which I want to add another column after this code
<td>{{format_price($mission->amount)}}</td>
I added this :
@php
$amount_to_be_collected = DB::table('shipments')
->select('amount_to_be_collected')
->where('mission_id', $mission->id)
->get();
@endphp
<td>{{format_price($amount_to_be_collected)}}</td>
What is wrong with this code?
$amount_to_be_collectedis collection.@php --- @endphpis no good in the blade and putting a query in the blade is very bad. but nothing to do with SQL injection