Closed lukasleitsch closed 7 months ago
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>
A Modal Component with a Collection as public property can not be created and fails with
Method Illuminate\Support\Collection::resolveRouteBinding does not exist.
in https://github.com/wire-elements/modal/blob/0f64fc4c4be49a343a6e025d81629113d5ccdc93/src/Modal.php#L97The Modal tries to resolve the parameter
participants
and finds the parameter as public property with the type Collection. It seems that this type is not handled yet.In this case, I would like to care of resolving the parameters in the mount method and skip the resolving of the Modal Component.