I have been trying to debug a problem for the past two days, my code, as follows, is first attempting to retrieve the category by its:
Controller
public function index(Request $request)
{
$stats = [
'done' => UserTransaction::where('status', UserTransaction::STATUS['done']),
'canceled' => UserTransaction::where('status', UserTransaction::STATUS['canceled']),
'waiting_payment' => UserTransaction::where('status', UserTransaction::STATUS['waiting_payment']),
];
return view('admin.transaction.index', compact('stats'));
}
UserTransaction.php
const STATUS = [
'done' => 'done',
'canceled' => 'canceled',
'waiting_payment' => 'waiting_payment',
];
index.blade.php
<h3 class="info">{!! $stats['done'] !!}</h3>
I see this error
Object of class Illuminate\Database\Eloquent\Builder could not be converted to string (View: C:\xampp3\htdocs\projects\webafra\tessa-admin\Modules\Transaction\Resources\views\admin\index.blade.php)
done
is an object You will have to look deeper into it for your string – RiggsFolly