i am trying to display an array inside a view but it says undefined index this is the code inside the controller
$collection = [];
foreach($drugss as $r){
$collection[] = DB::table('drugs')->where('id', $r['drug_id'])->get();
}
// dd($collection);
return view('billing')->withDrugs($collection)->withPending($pending_orders);
and wen i type dd($collection) it shows that all the objects inside the array but i cant access them inside the view
this is the view
@foreach ($drugs as $drug)
<span >{{ $drug['generic_name']}}</span>
@endforeach
this is the array collection that i am sending to the view
