Issues (75)

app/Model/SoftDeleteTrait.php (1 issue)

Labels
Severity
1
<?php
2
namespace App\Model;
3
4
trait SoftDeleteTrait
5
{
6
    protected $softDeleteField = 'is_deleted';
7
8
    protected $softDeleteValue = 1;
9
10
    public function softDelete()
11
    {
12
        return $this->updateAttributes([
0 ignored issues
show
It seems like updateAttributes() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

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

12
        return $this->/** @scrutinizer ignore-call */ updateAttributes([
Loading history...
13
            $this->softDeleteField => $this->softDeleteValue,
14
        ]);
15
    }
16
17
    /**
18
     * @return bool
19
     */
20 1
    public function isDeleted(): bool
21
    {
22 1
        $field = $this->softDeleteField;
23 1
        return $this->$field == $this->softDeleteValue;
24
    }
25
}
26