@@ -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 | } |
@@ -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') |
@@ -51,8 +51,7 @@ |
||
| 51 | 51 | protected function getAllContacts($custID, $shared = false) |
| 52 | 52 | { |
| 53 | 53 | return CustomerContacts::where('cust_id', $custID) |
| 54 | - ->when($shared, function($q) |
|
| 55 | - { |
|
| 54 | + ->when($shared, function($q) { |
|
| 56 | 55 | $q->where('shared', 1); |
| 57 | 56 | }) |
| 58 | 57 | ->with('CustomerContactPhones') |
@@ -24,8 +24,7 @@ |
||
| 24 | 24 | protected function getNotes($custID, $shared = false) |
| 25 | 25 | { |
| 26 | 26 | return CustomerNotes::where('cust_id', $custID) |
| 27 | - ->when($shared, function($q) |
|
| 28 | - { |
|
| 27 | + ->when($shared, function($q) { |
|
| 29 | 28 | $q->where('shared', 1); |
| 30 | 29 | }) |
| 31 | 30 | ->orderBy('urgent', 'DESC') |
@@ -24,8 +24,7 @@ |
||
| 24 | 24 | protected function getAllFiles($custID, $shared = false) |
| 25 | 25 | { |
| 26 | 26 | return CustomerFiles::where('cust_id', $custID) |
| 27 | - ->when($shared, function($q) |
|
| 28 | - { |
|
| 27 | + ->when($shared, function($q) { |
|
| 29 | 28 | $q->where('shared', 1); |
| 30 | 29 | }) |
| 31 | 30 | ->with('Files') |
@@ -76,32 +76,26 @@ discard block |
||
| 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 | }) |
@@ -112,8 +106,7 @@ discard block |
||
| 112 | 106 | protected function getAllCustomers($pagination, $sort, $includeSystems = false) |
| 113 | 107 | { |
| 114 | 108 | return Customers::orderBy($sort->sortField, $sort->sortType) |
| 115 | - ->when($includeSystems, function($q) |
|
| 116 | - { |
|
| 109 | + ->when($includeSystems, function($q) { |
|
| 117 | 110 | $q->with('CustomerSystems.SystemTypes') |
| 118 | 111 | ->with('ParentSystems.SystemTypes'); |
| 119 | 112 | }) |