@@ -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') |
@@ -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 | }) |
@@ -49,8 +49,7 @@ discard block |
||
49 | 49 | return TechTips::orderBy('sticky', 'DESC') |
50 | 50 | ->orderBy('created_at', 'DESC') |
51 | 51 | // Search text fields |
52 | - ->when(!empty($searchText), function($q) use ($searchText) |
|
53 | - { |
|
52 | + ->when(!empty($searchText), function($q) use ($searchText) { |
|
54 | 53 | foreach($searchText as $text) |
55 | 54 | { |
56 | 55 | $q->orWhere('subject', 'like', '%'.$text.'%') |
@@ -59,15 +58,12 @@ discard block |
||
59 | 58 | } |
60 | 59 | }) |
61 | 60 | // Search Article Type fields |
62 | - ->when($type, function($q) use ($type) |
|
63 | - { |
|
61 | + ->when($type, function($q) use ($type) { |
|
64 | 62 | $q->whereIn('tip_type_id', $type); |
65 | 63 | }) |
66 | 64 | // Search equipment type fields |
67 | - ->when($sys, function($q) use ($sys) |
|
68 | - { |
|
69 | - $q->whereHas('SystemTypes', function($q2) use ($sys) |
|
70 | - { |
|
65 | + ->when($sys, function($q) use ($sys) { |
|
66 | + $q->whereHas('SystemTypes', function($q2) use ($sys) { |
|
71 | 67 | $q2->whereIn('system_types.sys_id', $sys); |
72 | 68 | }); |
73 | 69 | }) |
@@ -121,8 +121,7 @@ |
||
121 | 121 | protected function sendNotification($tip, $edit = false) |
122 | 122 | { |
123 | 123 | // $details = TechTips::find($tipID); |
124 | - $users = User::whereHas('UserSettings', function($q) |
|
125 | - { |
|
124 | + $users = User::whereHas('UserSettings', function($q) { |
|
126 | 125 | $q->where('em_tech_tip', true); |
127 | 126 | })->get(); |
128 | 127 |