@@ -85,13 +85,13 @@ |
||
85 | 85 | ->when(isset($searchData->name), function($q) use ($searchData) |
86 | 86 | { |
87 | 87 | $q->where('name', 'like', '%'.$searchData->name.'%') |
88 | - ->orWhere('cust_id', 'like', '%'.$searchData->name.'%') |
|
89 | - ->orWhere('dba_name', 'like', '%'.$searchData->name.'%'); |
|
88 | + ->orWhere('cust_id', 'like', '%'.$searchData->name.'%') |
|
89 | + ->orWhere('dba_name', 'like', '%'.$searchData->name.'%'); |
|
90 | 90 | }) |
91 | 91 | ->when($includeSystems, function($q) |
92 | 92 | { |
93 | 93 | $q->with('CustomerSystems.SystemTypes') |
94 | - ->with('ParentSystems.SystemTypes'); |
|
94 | + ->with('ParentSystems.SystemTypes'); |
|
95 | 95 | }) |
96 | 96 | ->paginate($pagination->perPage); |
97 | 97 | } |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | $pagination = $this->getPagination($request); |
17 | 17 | $sort = $this->getSortFields($request); |
18 | 18 | |
19 | - if((array)$searchData) |
|
19 | + if((array) $searchData) |
|
20 | 20 | { |
21 | 21 | $results = $this->searchFor($searchData, $pagination, $sort, true); |
22 | 22 | } |
@@ -67,11 +67,11 @@ discard block |
||
67 | 67 | // Search equipment field |
68 | 68 | ->when(isset($searchData->equipment), function($q) use ($searchData) |
69 | 69 | { |
70 | - $q->whereHas('ParentSystems.SystemTypes', function ($qry) use ($searchData) |
|
70 | + $q->whereHas('ParentSystems.SystemTypes', function($qry) use ($searchData) |
|
71 | 71 | { |
72 | 72 | $qry->where('sys_id', $searchData->equipment); |
73 | 73 | }) |
74 | - ->orWhereHas('CustomerSystems.SystemTypes', function ($qry) use ($searchData) |
|
74 | + ->orWhereHas('CustomerSystems.SystemTypes', function($qry) use ($searchData) |
|
75 | 75 | { |
76 | 76 | $qry->where('sys_id', $searchData->equipment); |
77 | 77 | }); |
@@ -65,31 +65,25 @@ discard block |
||
65 | 65 | { |
66 | 66 | return Customers::orderBy($sort->sortField, $sort->sortType) |
67 | 67 | // Search equipment field |
68 | - ->when(isset($searchData->equipment), function($q) use ($searchData) |
|
69 | - { |
|
70 | - $q->whereHas('ParentSystems.SystemTypes', function ($qry) use ($searchData) |
|
71 | - { |
|
68 | + ->when(isset($searchData->equipment), function($q) use ($searchData) { |
|
69 | + $q->whereHas('ParentSystems.SystemTypes', function ($qry) use ($searchData) { |
|
72 | 70 | $qry->where('sys_id', $searchData->equipment); |
73 | 71 | }) |
74 | - ->orWhereHas('CustomerSystems.SystemTypes', function ($qry) use ($searchData) |
|
75 | - { |
|
72 | + ->orWhereHas('CustomerSystems.SystemTypes', function ($qry) use ($searchData) { |
|
76 | 73 | $qry->where('sys_id', $searchData->equipment); |
77 | 74 | }); |
78 | 75 | }) |
79 | 76 | // Search city field |
80 | - ->when(isset($searchData->city), function($q) use ($searchData) |
|
81 | - { |
|
77 | + ->when(isset($searchData->city), function($q) use ($searchData) { |
|
82 | 78 | $q->where('city', 'like', '%'.$searchData->city.'%'); |
83 | 79 | }) |
84 | 80 | // Search name field |
85 | - ->when(isset($searchData->name), function($q) use ($searchData) |
|
86 | - { |
|
81 | + ->when(isset($searchData->name), function($q) use ($searchData) { |
|
87 | 82 | $q->where('name', 'like', '%'.$searchData->name.'%') |
88 | 83 | ->orWhere('cust_id', 'like', '%'.$searchData->name.'%') |
89 | 84 | ->orWhere('dba_name', 'like', '%'.$searchData->name.'%'); |
90 | 85 | }) |
91 | - ->when($includeSystems, function($q) |
|
92 | - { |
|
86 | + ->when($includeSystems, function($q) { |
|
93 | 87 | $q->with('CustomerSystems.SystemTypes') |
94 | 88 | ->with('ParentSystems.SystemTypes'); |
95 | 89 | }) |
@@ -100,8 +94,7 @@ discard block |
||
100 | 94 | protected function getAllCustomers($pagination, $sort, $includeSystems = false) |
101 | 95 | { |
102 | 96 | return Customers::orderBy($sort->sortField, $sort->sortType) |
103 | - ->when($includeSystems, function($q) |
|
104 | - { |
|
97 | + ->when($includeSystems, function($q) { |
|
105 | 98 | $q->with('CustomerSystems.SystemTypes') |
106 | 99 | ->with('ParentSystems.SystemTypes'); |
107 | 100 | }) |