Merge pull request #3167 from CihanSenturk/fix-company-list-page-sortable-issue

Fixed company list page sortable issue
This commit is contained in:
Cüneyt Şentürk 2024-05-22 10:29:17 +01:00 committed by GitHub
commit e4743947eb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 16 additions and 0 deletions

View File

@ -442,6 +442,22 @@ class Company extends Eloquent implements Ownable
->select('companies.*');
}
/**
* Sort by company phone
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @param $direction
*
* @return \Illuminate\Database\Eloquent\Builder
*/
public function phoneSortable($query, $direction)
{
return $query->join('settings', 'companies.id', '=', 'settings.company_id')
->where('key', 'company.phone')
->orderBy('value', $direction)
->select('companies.*');
}
/**
* Sort by company tax number
*