I want a request a data from operation i made in controller, when i try my code the output total is null.
I try this code
$total += $request->jumlah_pinjaman;
$data = [
'tanggal' => $request->tanggal,
'no_bukti' => $request->no_bukti,
'jumlah_pinjaman' => $request->jumlah_pinjaman,
'uraian' => $request->uraian,
'user_id' => $request->user_id,
'total' => $request->$total
];
dd($data);
And the output is
array:6 [
"tanggal" => "2023-11-29"
"no_bukti" => "KSB231129290"
"jumlah_pinjaman" => "100000"
"uraian" => "garapan"
"user_id" => "2"
"total" => null
]
I want a total is not null
2
Answers
should be