ContactRelationship   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 6
c 0
b 0
f 0
dl 0
loc 13
rs 10
wmc 1

1 Method

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