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
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

Action::make('insert_coupons')
  ->form([TextInput::make('qty')->numeric()])
  ->action(function($data, $livewire) {
      $parent_id = $livewire->parent_recorrd_id;
      $qty = (int) $data['qty'];
      // Build a loop and create all the records as normal

       // Send notification of records created
    })
Was this page helpful?