| Conditions | 5 |
| Paths | 4 |
| Total Lines | 16 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 41 | public function handle() |
||
| 42 | { |
||
| 43 | //si ens passen l'id, l'agafem, però sino mostrem tots els id amb l'ajuda del Trait. |
||
| 44 | $id = $this->argument('id') ? $this->argument('id') : $this->askForUsers(); |
||
| 45 | |||
| 46 | $user = User::findOrFail($id); |
||
| 47 | |||
| 48 | try { |
||
| 49 | $user->update([ |
||
| 50 | 'name' => $this->argument('name') ? $this->argument('name') : $this->ask('User name?'), |
||
| 51 | 'email' => $this->argument('email') ? $this->argument('user_id') : $this->ask('User email?'), |
||
| 52 | ]); |
||
| 53 | } catch (Exception $e) { |
||
|
|
|||
| 54 | $this->error('error'.$e); |
||
| 55 | } |
||
| 56 | $this->info('User has been edited succesfully'); |
||
| 57 | } |
||
| 59 |