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

DeleteAsset   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 8
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 3
dl 0
loc 8
rs 10
c 1
b 0
f 1
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 6 1
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