Test Setup Failed
Push — 0.9 ( dd36a2...a3ca13 )
by Ben
04:40
created

DeleteAsset::remove()   A

Complexity

Conditions 6
Paths 5

Size

Total Lines 23
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 6
eloc 10
c 1
b 0
f 1
nc 5
nop 1
dl 0
loc 23
rs 9.2222
1
<?php
2
3
namespace Thinktomorrow\AssetLibrary\Application;
4
5
use Illuminate\Support\Facades\DB;
6
use Thinktomorrow\AssetLibrary\Asset;
7
8
class DeleteAsset
9
{
10
    public function handle(Asset $asset): void
11
    {
12
        DB::table('assets_pivot')->where('asset_id', $asset->id)->delete();
13
14
        // Associated media and the files on disk will be deleted as well.
15
        $asset->delete();
16
    }
17
}
18