Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] allow enum binding #352

Merged
merged 1 commit into from
Sep 8, 2023
Merged

Conversation

fabio-ivona
Copy link
Contributor

Hi,

this PR will enable enum binding in modal parameters, this will allow to call

<button type="button" wire:click="$dispatch('openModal', {'component':'invoices.select-invoice','arguments':{'type':'outbound','status':'pending',}})">
    select invoice
</button>

with a modal like this one:

class SelectInvoice extends ModalComponent
{
    #[Rule('required')]
    public \App\Enums\Type $type;

    #[Rule('nullable')]
    public \App\Enums\Status $status;

    //...
}

before this fix, you will encounter this exception: Target [App\Enums\Type] is not instantiable.

with 6 lines of code, the enum value is resolved to its calss

@PhiloNL PhiloNL merged commit 0f64fc4 into wire-elements:main Sep 8, 2023
@PhiloNL
Copy link
Contributor

PhiloNL commented Sep 8, 2023

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants