Skip to main content

Filament PHP Table: field list is ambiguous

Updated 1 min readMarkdown
Filament PHP Table: field list is ambiguous

When adding a search to a Filament table, you might come across an error like this:

SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'email' in field list is ambiguous.

The issue arises from joining two or more tables with the same column name as the one you are attempting to search. The fix is to pass the column and table name into the ->searchable() function:

// Example Join
Users::query()
->join('contacts', 'contacts.user_id', '=', 'users.id');

// TextColumn is searchable on contacts when both tables have the email column
Tables\Columns\TextColumn::make('email')->searchable(['contacts.email'])->sortable(),

About the author

  • Guy Warner is a Salt Lake City software engineer with 20+ years building PHP/MySQL/AWS SaaS products, with 10+ years of Laravel in production. He was Chief Technology Officer (CTO) and VP of Development at Monitorbase in credit monitoring, handling 7M+ monthly queries, where he led 12+ developers and migrated to SingleStore. He founded Eco Moving Utah, a moving tote rental business, and builds Bin X, rental business software. He has a B.S. in Political Science, University of Utah.

No comments yet. Be the first to comment.

More from this blog