0

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.

1
  • Can you post how are you storing the livewire component into database ? Commented Nov 29, 2021 at 4:33

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Dear MANSOOR KOCHY, thanks.
You are always welcome

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.