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