dimanche 24 juillet 2022

Data Pass from controller to view

I want to display sum of column debit but when I pass data after sum value of column store in a variable, I pass the data from controller to view but laravel said its undefined can anyone help me with this ?

View.blade.php :

                      <tr>
                        <th>Total Debit:</th>
                        <td>
                          @foreach ($totaldebit as $tdebit)
                          
                          @endforeach
                        </td>
                      </tr>

UserController.php :

$tdebit = DB::table('debitemps')->sum('debit');
        return view('pages/payments/debit/debit',['workerlists'=>$data,'debitid'=>$id,'Empdebitdata'=>$dataEmp,'totaldebit'=>$tdebit]);


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire