Conditions | 6 |
Paths | 4 |
Total Lines | 18 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 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->askForTasks(); |
||
46 | |||
47 | $task = Task::findOrFail($id); |
||
48 | |||
49 | try{ |
||
50 | $task->update([ |
||
51 | 'name' => $this->argument('name') ? $this->argument('name') : $this->ask('Task name?'), |
||
52 | 'user_id' => $this->argument('user_id') ? $this->argument('user_id') : $this->ask('User id?'), |
||
53 | 'description' => $this->argument('description') ? $this->argument('description') : $this->ask('Task description?'), |
||
54 | ]); |
||
55 | |||
56 | }catch(Exception $e){ |
||
57 | $this->error('error' . $e); |
||
58 | } |
||
59 | $this->info('Task has been edited succesfully'); |
||
60 | } |
||
62 |