| Conditions | 4 |
| Paths | 8 |
| Total Lines | 20 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| 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 | foreach ($user_list as $i) { |
||
| 46 | array_push($names,$i->username); |
||
| 47 | } |
||
| 48 | if (count($names) > 1) { |
||
| 49 | $name = $this->choice('Who would you like to remove?',$names, false); |
||
| 50 | } |
||
| 51 | else { |
||
| 52 | $name = $names[0]; |
||
| 53 | } |
||
| 54 | if ($this->confirm('Do you wish to remove '.$name.'?')) { |
||
| 55 | $remove_user = User::select('user_id')->where('username', $name)->first(); |
||
| 56 | User::find($remove_user->user_id)->delete(); |
||
| 57 | $this->info('User deleted.'); |
||
| 58 | } |
||
| 59 | } |
||
| 60 | } |
||
| 61 |
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.