@@ -88,7 +88,8 @@ |
||
88 | 88 | $this->line(''); |
89 | 89 | |
90 | 90 | $anticipate = []; |
91 | - foreach($updateList as $key => $up) { |
|
91 | + foreach($updateList as $key => $up) |
|
92 | + { |
|
92 | 93 | $opt = $key; |
93 | 94 | $anticipate[$opt] = $up; |
94 | 95 | } |
@@ -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 | }) |
@@ -26,8 +26,7 @@ |
||
26 | 26 | protected function getEquipment($custID, $shared = false) |
27 | 27 | { |
28 | 28 | return CustomerSystems::where('cust_id', $custID) |
29 | - ->when($shared, function($q) |
|
30 | - { |
|
29 | + ->when($shared, function($q) { |
|
31 | 30 | $q->where('shared', 1); |
32 | 31 | }) |
33 | 32 | ->with('CustomerSystemData') |