Replies: 2 comments 1 reply
-
Hi, did you manage to solve this issue? |
Beta Was this translation helpful? Give feedback.
1 reply
-
Inside query function you have to join relation table public function query(): Builder
{
return Article::query()->join('bdt_user', 'bdt_article.author_id', '=', 'bdt_user.id');
} Then you can make collumn searchable like that: Column::make('Autor', 'author_id')
->searchable(static function(Builder $query, $searchTerm) {
return $query->orWhere('bdt_user.firstname', $searchTerm)->orWhere('bdt_user.lastname', $searchTerm);
})
->sortable(static function(Builder $query, $direction) {
return $query->orderBy(User::select('bdt_user.firstname')->whereColumn('bdt_article.author_id', 'bdt_user.id'), $direction);
}), |
Beta Was this translation helpful? Give feedback.
0 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.
-
Hi guys,
I am trying now to use your new feature searachble(), unfortunately, I am not able to make it work.
My application has a model TeamTennisOption, which has statistics and the name of each tennis player is in the model Team, so my mission is to list all tennis players and after that to search in that table.
Here is the column with the name of each player:
When I check the laravel debugbar, it seems the code is not making the join:
select count(*) as aggregate from
team_tennis_optionswhere
gender= 'f' and
rank> 0 and
playing= 1 and (
team_tennis_options.
ranklike '%ash%' or
team_tennis_options.
old_ranklike '%ash%')
Can you please help me to solve this issue?
Beta Was this translation helpful? Give feedback.
All reactions