@@ -76,32 +76,26 @@ |
||
76 | 76 | { |
77 | 77 | return Customers::orderBy($sort->sortField, $sort->sortType) |
78 | 78 | // Search equipment field |
79 | - ->when(isset($searchData->equipment), function($q) use ($searchData) |
|
80 | - { |
|
81 | - $q->whereHas('ParentSystems.SystemTypes', function($qry) use ($searchData) |
|
82 | - { |
|
79 | + ->when(isset($searchData->equipment), function($q) use ($searchData) { |
|
80 | + $q->whereHas('ParentSystems.SystemTypes', function($qry) use ($searchData) { |
|
83 | 81 | $qry->where('sys_id', $searchData->equipment); |
84 | 82 | }) |
85 | - ->orWhereHas('CustomerSystems.SystemTypes', function($qry) use ($searchData) |
|
86 | - { |
|
83 | + ->orWhereHas('CustomerSystems.SystemTypes', function($qry) use ($searchData) { |
|
87 | 84 | $qry->where('sys_id', $searchData->equipment); |
88 | 85 | }); |
89 | 86 | }) |
90 | 87 | // Search city field |
91 | - ->when(isset($searchData->city), function($q) use ($searchData) |
|
92 | - { |
|
88 | + ->when(isset($searchData->city), function($q) use ($searchData) { |
|
93 | 89 | $q->where('city', 'like', '%'.$searchData->city.'%'); |
94 | 90 | }) |
95 | 91 | // Search name field |
96 | - ->when(isset($searchData->name), function($q) use ($searchData) |
|
97 | - { |
|
92 | + ->when(isset($searchData->name), function($q) use ($searchData) { |
|
98 | 93 | $q->where('name', 'like', '%'.$searchData->name.'%') |
99 | 94 | ->orWhere('cust_id', 'like', '%'.$searchData->name.'%') |
100 | 95 | ->orWhere('dba_name', 'like', '%'.$searchData->name.'%'); |
101 | 96 | }) |
102 | 97 | // Search by equipment type |
103 | - ->when($includeSystems, function($q) |
|
104 | - { |
|
98 | + ->when($includeSystems, function($q) { |
|
105 | 99 | $q->with('CustomerSystems.SystemTypes') |
106 | 100 | ->with('ParentSystems.SystemTypes'); |
107 | 101 | }) |