| Conditions | 5 |
| Paths | 9 |
| Total Lines | 24 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 4 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 40 | public function handle() |
||
| 41 | { |
||
| 42 | $user = $this->argument('user'); |
||
| 43 | $user_list = User::select('username')->where('username', 'like', '%'.$user.'%')->orWhere('realname','like', '%'.$user.'%')->get(); |
||
| 44 | $names = []; |
||
| 45 | |||
| 46 | if (count($user_list) < 1 ) { |
||
| 47 | $this->info('No user found.'); |
||
| 48 | return; |
||
| 49 | } |
||
| 50 | foreach ($user_list as $i) { |
||
| 51 | array_push($names,$i->username); |
||
| 52 | } |
||
| 53 | if (count($names) > 1) { |
||
| 54 | $name = $this->choice('Who would you like to remove?',$names, false); |
||
| 55 | } |
||
| 56 | else { |
||
| 57 | $name = $names[0]; |
||
| 58 | } |
||
| 59 | if ($this->confirm('Do you wish to remove '.$name.'?')) { |
||
| 60 | $remove_user = User::select('user_id')->where('username', $name)->delete(); |
||
| 61 | $this->info('User deleted.'); |
||
| 62 | } |
||
| 63 | } |
||
| 64 | } |
||
| 65 |
Adding a
@returnannotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.