Skip to content

feat: Add afterCreateUsing callback to Repeater for relationship items#19427

Open
dev wants to merge 2 commits intofilamentphp:4.xfrom
dev:4.x
Open

feat: Add afterCreateUsing callback to Repeater for relationship items#19427
dev wants to merge 2 commits intofilamentphp:4.xfrom
dev:4.x

Conversation

@dev
Copy link

@dev dev commented Mar 5, 2026

Description

This PR adds an afterCreateUsing() callback to the Repeater component when used with ->relationship().

Currently, the Repeater provides callbacks for mutating data before operations:

  • mutateRelationshipDataBeforeCreateUsing()
  • mutateRelationshipDataBeforeSaveUsing()
  • mutateRelationshipDataBeforeFillUsing()

However, there is no way to execute code after a new relationship record is created and saved. This is needed when the record's ID is required to perform additional operations, such as attaching data via a pivot
table.

The mutateRelationshipDataBeforeCreateUsing() callback cannot solve this because the record doesn't have an ID yet at that point.

Visual changes

N/A

Functional changes

  • Code style has been fixed by running the composer cs command.
  • Changes have been tested to not break existing functionality.
  • Documentation is up-to-date.

dev added 2 commits March 5, 2026 10:29
…ip items

Adds a new callback that is executed after a new relationship record is created and saved. This allows performing operations that require the record's ID, such as attaching pivot table data or creating related records.

The callback receives the original form data and the newly created model instance
@dev
Copy link
Author

dev commented Mar 5, 2026

@danharrin as you requested, I have reopened PR #19396 on 4.x.

@danharrin danharrin added enhancement New feature or request pending review labels Mar 5, 2026
@danharrin danharrin added this to the v4 milestone Mar 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request pending review

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

2 participants