| Conditions | 4 |
| Paths | 6 |
| Total Lines | 20 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 11 | public function search($key) |
||
| 12 | { |
||
| 13 | $result = []; |
||
| 14 | //email find |
||
| 15 | $ret = self::where('email',$key) |
||
| 16 | ->select('id','avatar', 'name', 'describes', 'professional_rate') |
||
| 17 | ->first(); |
||
| 18 | if(!empty($ret)){ |
||
| 19 | $result[] = $ret; |
||
| 20 | } |
||
| 21 | //user name find |
||
| 22 | if(strlen($key) >= 2){ |
||
| 23 | $ret = self::whereRaw('MATCH(`name`) AGAINST (? IN BOOLEAN MODE)',[$key]) |
||
| 24 | ->select('id','avatar', 'name', 'describes', 'professional_rate') |
||
| 25 | ->get()->all(); |
||
| 26 | if(!empty($ret)){ |
||
| 27 | $result += $ret; |
||
| 28 | } |
||
| 29 | } |
||
| 30 | return $result; |
||
| 31 | } |
||
| 33 |