Translation   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 5
eloc 12
c 2
b 0
f 0
dl 0
loc 53
ccs 0
cts 20
cp 0
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A scopeByElement() 0 4 1
A getIdElementColumn() 0 3 1
A getIdSourceColumn() 0 3 1
A getIsoColumn() 0 3 1
A getModelColumn() 0 3 1
1
<?php namespace Distilleries\Expendable\Models;
2
3
use Illuminate\Database\Eloquent\Model;
4
5
class Translation extends BaseModel {
6
7
    protected $fillable = [
8
        'iso',
9
        'id_element',
10
        'model',
11
        'id_source'
12
    ];
13
14
    /**
15
     * Get the name of the "iso" column.
16
     *
17
     * @return string
18
     */
19
    public function getIsoColumn()
20
    {
21
        return 'iso';
22
    }
23
24
    /**
25
     * Get the name of the "id_element" column.
26
     *
27
     * @return string
28
     */
29
    public function getIdElementColumn()
30
    {
31
        return 'id_element';
32
    }
33
34
    /**
35
     * Get the name of the "id_element" column.
36
     *
37
     * @return string
38
     */
39
    public function getIdSourceColumn()
40
    {
41
        return 'id_source';
42
    }
43
44
    /**
45
     * Get the name of the "model" column.
46
     *
47
     * @return string
48
     */
49
    public function getModelColumn()
50
    {
51
        return 'model';
52
    }
53
54
    public function scopeByElement($query, Model $model)
55
    {
56
        return $query->where($this->getTable() . '.' . $this->getModelColumn(), '=', $model->getTable())
57
                        ->where($this->getTable() . '.' . $this->getIdSourceColumn(), '=', $model->getKey());
58
    }
59
60
}
61