mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-04 07:14:37 -04:00
Merge pull request #9011 from turbo124/v5-develop
Update project filters to allow filtering and sorting by client
This commit is contained in:
commit
dbcc9008b6
@ -33,6 +33,9 @@ class ProjectFilters extends QueryFilters
|
||||
|
||||
return $this->builder->where(function ($query) use ($filter) {
|
||||
$query->where('name', 'like', '%'.$filter.'%')
|
||||
->orWhereHas('client', function ($q) use ($filter) {
|
||||
$q->where('name', 'like', '%'.$filter.'%');
|
||||
})
|
||||
->orWhere('public_notes', 'like', '%'.$filter.'%')
|
||||
->orWhere('private_notes', 'like', '%'.$filter.'%');
|
||||
});
|
||||
@ -57,6 +60,11 @@ class ProjectFilters extends QueryFilters
|
||||
{
|
||||
$sort_col = explode('|', $sort);
|
||||
|
||||
if ($sort_col[0] == 'client_id') {
|
||||
return $this->builder->orderBy(\App\Models\Client::select('name')
|
||||
->whereColumn('clients.id', 'projects.client_id'), $sort_col[1]);
|
||||
}
|
||||
|
||||
if (!is_array($sort_col) || count($sort_col) != 2) {
|
||||
return $this->builder;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user