-
Notifications
You must be signed in to change notification settings - Fork 79
Description
Package Version
v1.0.10
Laravel Version
v12.x.x
PHP Version
PHP 8.3.20
Problem description
I am attempting to add an activity timeline sidebar to a resource using the following code:
ActivityLogTimelineTableAction::make('Activities')
->withRelations(['hasManyThroughRelation', 'belongsToManyRelation']);
However, when using hasManyThrough or belongsToMany relationships, the timeline throws a SQL error:
SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'id' in SELECT is ambiguous
It seems the query generated does not alias the id column properly, returning ambiguity when joining tables. This issue only occurs when certain relationships like hasManyThrough or belongsToMany are used.
Expected behavior
Expected Behavior:
The timeline should handle complex relationships without generating ambiguous column errors.
Steps to reproduce
Steps to Reproduce
-
Create a Filament resource that includes an
ActivityLogTimelineTableAction
sidebar. -
In the
table()
method or corresponding section of your resource, define the timeline action like this:ActivityLogTimelineTableAction::make('Activities') ->withRelations(['hasManyThroughRelation', 'belongsToManyRelation']);
-
Ensure that the specified relations (
hasManyThroughRelation
,belongsToManyRelation
) are valid and defined in your model. -
Navigate to the resource page in the Filament admin panel.
-
When the page loads, observe the error thrown:
SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'id' in SELECT is ambiguous
This issue occurs due to unqualified id
columns in the generated SQL query when using complex relationships like hasManyThrough
or belongsToMany
.
Reproduction repository (issue will be closed if this is not valid)
no