@@ -59,7 +59,7 @@ |
||
59 | 59 | $mail->to($emailAddress)->send(new TestEmail); |
60 | 60 | Log::info('Test email sent to '.$emailAddress); |
61 | 61 | } |
62 | - catch (\Exception $e) |
|
62 | + catch(\Exception $e) |
|
63 | 63 | { |
64 | 64 | Log::alert('Test Email to '.$emailAddress.' failed. Reason - ', array($e)); |
65 | 65 | return $e->getMessage(); |
@@ -96,14 +96,14 @@ |
||
96 | 96 | ->when(isset($searchData->name), function($q) use ($searchData) |
97 | 97 | { |
98 | 98 | $q->where('name', 'like', '%'.$searchData->name.'%') |
99 | - ->orWhere('cust_id', 'like', '%'.$searchData->name.'%') |
|
100 | - ->orWhere('dba_name', 'like', '%'.$searchData->name.'%'); |
|
99 | + ->orWhere('cust_id', 'like', '%'.$searchData->name.'%') |
|
100 | + ->orWhere('dba_name', 'like', '%'.$searchData->name.'%'); |
|
101 | 101 | }) |
102 | 102 | // Search by equipment type |
103 | 103 | ->when($includeSystems, function($q) |
104 | 104 | { |
105 | 105 | $q->with('CustomerSystems.SystemTypes') |
106 | - ->with('ParentSystems.SystemTypes'); |
|
106 | + ->with('ParentSystems.SystemTypes'); |
|
107 | 107 | }) |
108 | 108 | ->paginate($pagination->perPage); |
109 | 109 | } |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | $sort = $this->getSortFields($request); |
17 | 17 | |
18 | 18 | // Determine if the search request is blank - if so, return all customers |
19 | - if((array)$searchData) |
|
19 | + if((array) $searchData) |
|
20 | 20 | { |
21 | 21 | $results = $this->searchFor($searchData, $pagination, $sort, true); |
22 | 22 | } |
@@ -78,11 +78,11 @@ discard block |
||
78 | 78 | // Search equipment field |
79 | 79 | ->when(isset($searchData->equipment), function($q) use ($searchData) |
80 | 80 | { |
81 | - $q->whereHas('ParentSystems.SystemTypes', function ($qry) use ($searchData) |
|
81 | + $q->whereHas('ParentSystems.SystemTypes', function($qry) use ($searchData) |
|
82 | 82 | { |
83 | 83 | $qry->where('sys_id', $searchData->equipment); |
84 | 84 | }) |
85 | - ->orWhereHas('CustomerSystems.SystemTypes', function ($qry) use ($searchData) |
|
85 | + ->orWhereHas('CustomerSystems.SystemTypes', function($qry) use ($searchData) |
|
86 | 86 | { |
87 | 87 | $qry->where('sys_id', $searchData->equipment); |
88 | 88 | }); |
@@ -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 | }) |
@@ -146,7 +146,7 @@ |
||
146 | 146 | // Remove all extra charachters from the phone number. Number should be stored as 10 digit direct number |
147 | 147 | protected function cleanPhoneNumber($number) |
148 | 148 | { |
149 | - $newNumber = preg_replace('~.*(\d{3})[^\d]*(\d{3})[^\d]*(\d{4}).*~', '$1$2$3', $number); |
|
149 | + $newNumber = preg_replace('~.*(\d{3})[^\d]*(\d{3})[^\d]*(\d{4}).*~', '$1$2$3', $number); |
|
150 | 150 | Log::debug('Phone number '.$number.' cleaned to '.$newNumber); |
151 | 151 | return $newNumber; |
152 | 152 | } |