ContactRelationship::getTranslatedNameAttribute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace App\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
use Spatie\Translatable\HasTranslations;
7
8
/**
9
 * @mixin IdeHelperContactRelationship
10
 */
11
class ContactRelationship extends Model
12
{
13
    use HasTranslations;
14
15
    public $timestamps = false;
16
17
    public array $translatable = ['name'];
18
19
    protected $appends = ['translated_name'];
20
21
    public function getTranslatedNameAttribute()
22
    {
23
        return $this->getTranslation('name', app()->getLocale());
0 ignored issues
show
introduced by
The method getLocale() does not exist on Illuminate\Container\Container. Are you sure you never get this type here, but always one of the subclasses? ( Ignorable by Annotation )

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

23
        return $this->getTranslation('name', app()->/** @scrutinizer ignore-call */ getLocale());
Loading history...
24
    }
25
}
26