DeleteFieldCommandHandler::handle()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 7
rs 9.4285
cc 1
eloc 5
nc 1
nop 1
1
<?php
2
3
4
namespace Hechoenlaravel\JarvisFoundation\FieldGenerator\Handler;
5
6
use Hechoenlaravel\JarvisFoundation\FieldGenerator\FieldModel;
7
use Hechoenlaravel\JarvisFoundation\FieldGenerator\Events\FieldWasDeleted;
8
9
class DeleteFieldCommandHandler
10
{
11
    public function handle($command)
12
    {
13
        $model = FieldModel::find($command->id);
14
        $modelArray = $model->toArray();
15
        $model->delete();
16
        event(new FieldWasDeleted($modelArray));
17
    }
18
}
19