DeleteColumn   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 1
c 0
b 0
f 0
lcom 0
cbo 2
dl 0
loc 11
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 8 1
1
<?php
2
3
namespace Hechoenlaravel\JarvisFoundation\FieldGenerator\Listeners;
4
5
use Hechoenlaravel\JarvisFoundation\EntityGenerator\EntityModel;
6
use Hechoenlaravel\JarvisFoundation\FieldGenerator\Events\FieldWasDeleted;
7
use Illuminate\Support\Facades\Schema;
8
9
class DeleteColumn
10
{
11
    public function handle(FieldWasDeleted $event)
12
    {
13
        $field = $event->field;
14
        $entity = EntityModel::find($field['entity_id']);
15
        Schema::table($entity->getTableName(), function ($table) use ($field) {
16
            $table->dropColumn($field['slug']);
17
        });
18
    }
19
}
20