Completed
Push — 2.0 ( 9e2b8d )
by Nicolas
03:40
created

RemovePolymorphicLink   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 7 2
1
<?php namespace Modules\Media\Events\Handlers;
2
3
use Illuminate\Support\Facades\DB;
4
use Modules\Media\Contracts\DeletingMedia;
5
6
class RemovePolymorphicLink
7
{
8
    public function handle($event = null)
9
    {
10
        if ($event instanceof DeletingMedia) {
11
            DB::table('media__imageables')->where('imageable_id', $event->getEntityId())
12
                ->where('imageable_type', $event->getClassName())->delete();
13
        }
14
    }
15
}
16