Skip to content

Component with public property with Collection type #388

Answered by PhiloNL
lukasleitsch asked this question in Q&A
Discussion options

You must be logged in to vote

I think this is because the argument matches the public property. Try using IDs and computed properties instead, for example:

class AddNewParticipants extends ModalComponent
{
  public $participantsIds;

  #[Computed]
  public function participants()
  {
    return User::findMany($participantsIds);
  }
}
<button
  wire:click="$dispatch('openModal', { component: 'add-new-participants', arguments: { participantsIds: [2, 4, 5] } })"
>
  @lang('Add')
</x-button>

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@felixbeer
Comment options

Answer selected by lukasleitsch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #384 on November 12, 2023 15:02.