| Conditions | 5 |
| Paths | 9 |
| Total Lines | 20 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 14 | public function search($key) |
||
| 15 | { |
||
| 16 | $result = []; |
||
| 17 | if(strlen($key) >= 2){ |
||
| 18 | $ret = self::where('pcode', $key) |
||
| 19 | ->orWhereRaw('MATCH(`title`) AGAINST (? IN BOOLEAN MODE)',[$key]) |
||
| 20 | ->select('pcode', 'title') |
||
| 21 | ->limit(120) |
||
| 22 | ->get()->all(); |
||
| 23 | if(!empty($ret)){ |
||
| 24 | $result += $ret; |
||
| 25 | } |
||
| 26 | } |
||
| 27 | $problemModel = new ProblemModel(); |
||
| 28 | foreach ($result as $p_index => $p) { |
||
| 29 | if($problemModel->isBlocked($p['pid'])){ |
||
| 30 | unset($result[$p_index]); |
||
| 31 | } |
||
| 32 | } |
||
| 33 | return $result; |
||
| 34 | } |
||
| 36 |