@@ -42,8 +42,8 @@ |
||
| 42 | 42 | // Process all of the search filters to search for a tech tip |
| 43 | 43 | protected function searchFor($search) |
| 44 | 44 | { |
| 45 | - $searchText = isset($search['text']) ? explode(' ', $search['text']) : null; |
|
| 46 | - $type = isset($search['type']) ? $search['type'] : null; |
|
| 45 | + $searchText = isset($search['text']) ? explode(' ', $search['text']) : null; |
|
| 46 | + $type = isset($search['type']) ? $search['type'] : null; |
|
| 47 | 47 | $sys = isset($search['sys_id']) ? $search['sys_id'] : null; |
| 48 | 48 | |
| 49 | 49 | return TechTips::orderBy('sticky', 'DESC') |
@@ -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 | }) |