Passed
Push — develop ( 6302a9...3db2fb )
by Septianata
04:45
created

Event::bootEvent()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 1
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace App\Models\Concerns\Denomination;
4
5
use App\Models\Denomination;
6
use App\Support\Model\Event as ModelEvent;
7
use Illuminate\Support\Facades\Storage;
8
9
/**
10
 * @see \App\Models\Denomination
11
 */
12
trait Event
13
{
14
    use ModelEvent;
15
16
    /**
17
     * Boot the trait on the model.
18
     *
19
     * @return void
20
     */
21 9
    protected static function bootEvent()
22
    {
23 9
        static::deleting(function (Denomination $model) {
24 2
            Storage::delete(Denomination::IMAGE_PATH . '/' . $model->getRawOriginal('image'));
0 ignored issues
show
Bug introduced by
Are you sure $model->getRawOriginal('image') of type array|mixed can be used in concatenation? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

24
            Storage::delete(Denomination::IMAGE_PATH . '/' . /** @scrutinizer ignore-type */ $model->getRawOriginal('image'));
Loading history...
25 9
        });
26 9
    }
27
}
28