Skip to content

Conversation

@theofanisv
Copy link
Contributor

@theofanisv theofanisv commented Dec 5, 2025

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:

class Admin extends User {
 // ...
}

$users = User::all();

assert($users[0] instanceof \App\Models\User);
assert($users[1] instanceof \App\Models\Admin);

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

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

@github-project-automation github-project-automation bot moved this from Todo to In Progress in Roadmap Dec 5, 2025
@danharrin
Copy link
Member

whoops

@danharrin danharrin added the bug Something isn't working label Dec 5, 2025
@danharrin danharrin added this to the v4 milestone Dec 5, 2025
@danharrin danharrin merged commit aceb6da into filamentphp:4.x Dec 5, 2025
1 check passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Roadmap Dec 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants