I have multiple livewire components e.g. opd.patient-count, opd.visit-count, opd.checkup-count
and so on. I would like to store these components name into database then call by user role. Anyway, It does not work once I tried as below.
foreach ...
echo '<livewire:opd.patient-count />';
endforeach ...
Any advice or guidance on this would be greatly appreciated, Thanks.
CodePudding user response:
As I understand your problem, You can achieve using this syntax instead
@foreach($components as $eachComponent)
@livewire($eachComponent,['componentData' => $data])
@endforeach
in this code above, the component name is assigned accordingly using a blade @foreach
directive and iterate over each element and make the component.