Person   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 2
dl 0
loc 50
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getNameAttribute() 0 4 1
1
<?php
2
3
namespace Dimsav\Translatable\Test\Model;
4
5
use Dimsav\Translatable\Translatable;
6
use Illuminate\Database\Eloquent\Model as Eloquent;
7
8
class Person extends Eloquent
9
{
10
    protected $table = 'people';
11
12
    use Translatable;
13
14
    /**
15
     * Array with the fields translated in the Translation table.
16
     *
17
     * @var array
18
     */
19
    public $translatedAttributes = ['name'];
20
21
    /**
22
     * Set $translationModel if you want to overwrite the convention
23
     * for the name of the translation Model. Use full namespace if applied.
24
     *
25
     * The convention is to add "Translation" to the name of the class extending Translatable.
26
     * Example: Country => CountryTranslation
27
     */
28
    public $translationModel;
29
30
    /**
31
     * This is the foreign key used to define the translation relationship.
32
     * Set this if you want to overwrite the laravel default for foreign keys.
33
     *
34
     * @var
35
     */
36
    public $translationForeignKey;
37
38
    /**
39
     * The database field being used to define the locale parameter in the translation model.
40
     * Defaults to 'locale'.
41
     *
42
     * @var string
43
     */
44
    public $localeKey;
45
46
    /**
47
     * Mutate name attribute into upper-case.
48
     *
49
     * @param $value
50
     *
51
     * @return string
52
     */
53
    public function getNameAttribute($value)
54
    {
55
        return ucfirst($value);
56
    }
57
}
58