Create multiple records when click createAction
I have a CampaignCouponsRelationManager to add a coupon under the campaign.
i want that when the user clicks on "Create coupon", 100 coupons will be automatically created without opening the form in the modal.
What is the recommended way to do this?
Solution:Jump to solution
Assuming you are wanting to bulk create 100 coupons directly, you can use an normal header action:
https://filamentphp.com/docs/3.x/tables/actions#header-actions
```php...
7 Replies
Add a standard Laravel observer for me, when you create a Compaign it auto-inserts 100 coupons.
thanks!
but How do I prevent the modal from jumping when
Tables\Actions\CreateAction::make()?
Don't use a create action is you are just running an action and call the model directly.
My understanding was you are creating a record then want coupons created. If you want an action to create coupons then just use a normal action and run a loop for creationg in:
->action()
I'm new to filament so I don't know all the options yet.
how i can catch the click event?
You don't need too
Can you screenshot where you want this button to be that generated the coupons
Solution
Assuming you are wanting to bulk create 100 coupons directly, you can use an normal header action:
https://filamentphp.com/docs/3.x/tables/actions#header-actions
I will try and update. Thank you!