Replies: 1 comment 4 replies
-
@tabuna no idea ? :/ |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'd like to filter a table with a relationship by the relation's attribute.
example: Let's say I have a table with all my posts, and a column is displaying the author name. But when I entered something in the author filter, I can only use the author's id. It returns no result when I enter an author's name.
In list screen
public function query(): array { return [ 'posts' => Post::filters()->with('author')->defaultSort('id', 'desc')->paginate() ]; }
in list layout (not sure if that's the best way to do that BTW)
TD::make('author', 'Author') ->filter(TD::FILTER_TEXT) ->render(function ($post) { return Author::where('id', $post->author)->first()->name; }),
So my table show my author's name but I can only use his ID to filter, not his name :/
Thanks
Beta Was this translation helpful? Give feedback.
All reactions