Skip to content

Commit

Permalink
fix(users): ensure search filters are properly applied
Browse files Browse the repository at this point in the history
  • Loading branch information
warlof committed Jul 14, 2019
1 parent d84518f commit 7495c42
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/Http/Controllers/DiscordController.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,15 @@ public function getUsersData()
->editColumn('nick', function($row){
return $row->nick;
})
->filterColumn('user_name', function ($query, $keyword) {
$sql = 'LOWER(' . (new CharacterInfo())->getTable() . '.name) LIKE ?';
$query->orWhereRaw($sql, ["%{$keyword}%"]);
})
->orderColumn('user_id', '-value $1')
->filterColumn('user_id', function ($query, $keyword) {
$sql = 'LOWER(' . (new UserSetting())->getTable() . '.value) LIKE ?';
$query->orWhereRaw($sql, ["%{$keyword}%"]);
})
->removeColumn('refresh_token')
->removeColumn('access_token')
->removeColumn('expires_at')
Expand Down
3 changes: 2 additions & 1 deletion src/resources/views/users/list.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@
data: null,
targets: -1,
defaultContent: '<button class="btn btn-xs btn-info">Roles</button> <button class="btn btn-xs btn-danger">Remove</button>',
orderable: false
orderable: false,
searchable: false
}
@endif
],
Expand Down

0 comments on commit 7495c42

Please sign in to comment.