Completed
Push — master ( cffbd7...3e7360 )
by Dimitrios
21s
created

Person   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

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
     * Add your translated attributes here if you want
40
     * fill them with mass assignment.
41
     *
42
     * @var array
43
     */
44
    public $fillable = ['name'];
45
46
    /**
47
     * The database field being used to define the locale parameter in the translation model.
48
     * Defaults to 'locale'.
49
     *
50
     * @var string
51
     */
52
    public $localeKey;
53
54
    /**
55
     * Mutate name attribute into upper-case.
56
     *
57
     * @param $value
58
     *
59
     * @return string
60
     */
61
    public function getNameAttribute($value)
62
    {
63
        return ucfirst($value);
64
    }
65
}
66