Conditions | 2 |
Paths | 2 |
Total Lines | 15 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
15 | public function handle($command) |
||
16 | { |
||
17 | $fields = (array) $command; |
||
18 | $model = FieldModel::find($command->id); |
||
19 | $rename = false; |
||
20 | $oldSlug = $model->slug; |
||
21 | if ($model->slug !== $command->slug) { |
||
22 | $rename = true; |
||
23 | } |
||
24 | unset($fields['id']); |
||
25 | $model->fill($fields); |
||
26 | $model->save(); |
||
27 | event(new FieldWasEdited($model, $rename, $oldSlug)); |
||
28 | return $model; |
||
29 | } |
||
30 | } |
||
31 |