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

DeleteAsset::handle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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