Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

iphai's avatar
Level 1

Passing Query to Loop on Blade with viewData

Can you help me regarding the filament where I want to display a table that comes from a blade, I put this component in the Action->infolist, to display a table whose data is a query, if you use ->viewData['working_hours' => WorkingHours: :all() ] is successful, but if you use state or record an error still occurs, here is the component that passes it to the blade

TextEntry::make('company_id') ->weight(FontWeight::Bold) ->label('Company') ->formatStateUsing( function($state){ $work_hours = WorkHours::where('company_id', $state)->get(); return $work_hours; } ) ->view('components.workinghours') ->viewData([ 'working_hours' => fn($state) => $state ]) ,

The problem is that it doesn't display anything, only the header on the blade

0 likes
0 replies

Please or to participate in this conversation.