Change Table cacheAction method visibility to public#19457
Open
mathieutu wants to merge 1 commit intofilamentphp:4.xfrom
Open
Change Table cacheAction method visibility to public#19457mathieutu wants to merge 1 commit intofilamentphp:4.xfrom
cacheAction method visibility to public#19457mathieutu wants to merge 1 commit intofilamentphp:4.xfrom
Conversation
Signed-off-by: Mathieu TUDISCO <oss@mathieutu.dev>
Contributor
Author
|
Tests failing for an unrelated reason. |
danharrin
requested changes
Mar 9, 2026
Member
danharrin
left a comment
There was a problem hiding this comment.
I would prefer allow passing an Action instance directly to recordAction() instead of making this public
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Context
When working with Filament tables, it's possible to define a
recordActionto trigger an action when clicking on a row. However, this action must be registered beforehand (e.g. viarecordActions, which renders an unwanted button in the row).The ideal approach would be to pass an
Actioninstance directly torecordAction(), but as an intermediate step, being able to register an action viacacheAction()from outside theTableclass is already a significant improvement.Problem
The
cacheAction()method onTableisprotected, making it impossible to call it from a Livewire component or a resource page without resorting to workarounds.The only way to achieve the desired behavior was to use a closure bound to
$tableto bypass visibility:Solution
Make
cacheAction()public, allowing it to be called directly on theTableinstance:Future improvements
A natural follow-up would be to allow passing an
Actioninstance directly torecordAction(), removing the need to callcacheAction()altogether. This PR is a quick win in that direction, but also unlocking broader use cases.Visual changes
None
Functional changes
composer cscommand.