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

RemovePolymorphicLink::handle()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 7
rs 9.4285
cc 2
eloc 4
nc 2
nop 1
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