Country::locales()   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
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Translation\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
7
class Country extends Model
8
{
9
    public $incrementing = false;
10
    protected $casts = [
11
        'code' => 'string',
12
    ];
13
    protected $primaryKey = 'code';
14
    protected $keyType = 'string';
15
16
    /**
17
     * The attributes that are mass assignable.
18
     *
19
     * @var array
20
     */
21
    protected $fillable = [
22
        'name',
23
        'code'
24
    ];
25
26
    protected $mappingProperties = array(
27
        'name' => [
28
            'type' => 'string',
29
            "analyzer" => "standard",
30
        ],
31
        'code' => [
32
            'type' => 'string',
33
            "analyzer" => "standard",
34
        ],
35
    );
36
37
    /**
38
     *  Each language may have several translations.
39
     */
40
    public function locales()
41
    {
42
        return $this->hasMany(Locale::class, 'country_code', 'code');
43
    }
44
}
45