Action support single table inheritance record #18654
Merged
+1
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
I have a model that uses single table inheritance.
This can lead to different models being rendered by executing a query on the parent one, example:
Let's say I have a filament resource to display all users (mixed models) and run some actions that are common to both models. Then I have lost the ability to customize the fields of the action because the
recordKeyis not being sent in front-end (via the click handler) so later is not being sent back to the back-end.That is because the condition
$record::class === $table->getModel()will return false when (as per the example above) the record is Admin because the table model (parent model) is User. I changed the condition in order to accommodate the previous functionality (as much as I can understand) and support my use case.The condition I changed was implemented in #17786, but I do not understand how it solved that related issue. The filament resource and its actions were working correctly until that update.
In case my implementation is not accepted, can you please suggest a workaround in order to continue my use case?
Visual changes
No visual changes.
Functional changes
composer cscommand.