| Conditions | 3 |
| Paths | 3 |
| Total Lines | 18 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 13 | public function search($key) |
||
| 14 | { |
||
| 15 | $result = []; |
||
| 16 | //group name or gcode find |
||
| 17 | if(strlen($key) >= 2){ |
||
| 18 | $ret = self::where(function($query) use ($key){ |
||
| 19 | $query->whereRaw('MATCH(`name`) AGAINST (? IN BOOLEAN MODE)',[$key]) |
||
| 20 | ->orWhere('gcode', $key); |
||
| 21 | }) |
||
| 22 | ->where('public',1) |
||
| 23 | ->select('gid','gcode', 'img', 'name', 'description') |
||
| 24 | ->get()->all(); |
||
| 25 | if(!empty($ret)){ |
||
| 26 | $result += $ret; |
||
| 27 | } |
||
| 28 | } |
||
| 29 | |||
| 30 | return $result; |
||
| 31 | } |
||
| 33 |