|
@@ -314,9 +314,16 @@ class AdminController extends Controller
|
|
|
|
|
|
$companyID = $request->get('company');
|
|
|
if($companyID){
|
|
|
- $patients = $patients->whereHas('companyClients', function($qry)use($companyID){
|
|
|
- return $qry->where('company_id', $companyID);
|
|
|
+ if($companyID == 'NONE'){
|
|
|
+ $patients = $patients->doesntHave('companyClients');
|
|
|
+ }else{
|
|
|
+ $patients = $patients->whereHas('companyClients', function($qry)use($companyID){
|
|
|
+ if($companyID != 'ANY'){
|
|
|
+ return $qry->where('company_id', $companyID);
|
|
|
+ }
|
|
|
});
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
$sortBy = $request->input('sort_by') ?: 'name_first';
|