I have a query which show information from two tables in foreach loop on my blade view. This is the controller
public function details( $id ){
$details = Item::find($id)->report;
return view('details', compact('details'));
}
On my view I have
@foreach($details as $itemDetails)
....
@endforeach
Is it possible to show before foreach single variable from this query like?
{{ $details->id }}
@foreach($details as $itemDetails)
....
@endforeach
I want to get the $id.
idoutside loop because if I want it from the foreach loop I need to put foreach outside one div which then render multiple divs because of the loop...{{ dd($details) }}collect($details)->first()->id