Completed
Push — feature/ajax_skill_dec ( 475068...bfc311 )
by Tristan
07:34
created

Skill   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
eloc 12
dl 0
loc 31
ccs 0
cts 8
cp 0
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A skill_declarations() 0 2 1
A skill_type() 0 2 1
A getSkillAttribute() 0 2 1
A getDescriptionAttribute() 0 2 1
1
<?php
2
3
/**
4
 * Created by Reliese Model.
5
 * Date: Thu, 12 Jul 2018 22:39:27 +0000.
6
 */
0 ignored issues
show
Coding Style introduced by
PHP version not specified
Loading history...
Coding Style introduced by
Missing @category tag in file comment
Loading history...
Coding Style introduced by
Missing @package tag in file comment
Loading history...
Coding Style introduced by
Missing @author tag in file comment
Loading history...
Coding Style introduced by
Missing @license tag in file comment
Loading history...
Coding Style introduced by
Missing @link tag in file comment
Loading history...
7
8
namespace App\Models;
9
use Illuminate\Support\Facades\Lang;
10
11
/**
12
 * Class Skill
13
 *
14
 * @property int $id
15
 * @property string $name
16
 * @property int $skill_type_id
17
 *
18
 * Accessors:
19
 * @property string $skill
20
 * @property string $description
21
 *
22
 * @property \App\Models\Lookup\SkillType $skill_type
23
 * @property \Illuminate\Database\Eloquent\Collection $skill_declarations
24
 */
0 ignored issues
show
Coding Style introduced by
Missing @category tag in class comment
Loading history...
Coding Style introduced by
Missing @package tag in class comment
Loading history...
Coding Style introduced by
Missing @author tag in class comment
Loading history...
Coding Style introduced by
Missing @license tag in class comment
Loading history...
Coding Style introduced by
Missing @link tag in class comment
Loading history...
25
class Skill extends BaseModel {
0 ignored issues
show
Coding Style introduced by
Opening brace of a class must be on the line after the definition
Loading history...
26
27
    protected $casts = [
28
        'name' => 'string',
29
        'skill_type_id' => 'int'
30
    ];
31
    protected $fillable = [
32
        'name',
33
        'skill_type_id'
34
    ];
35
36
    /**
37
     * The accessors to append to the model's array form.
38
     */
39
    protected $appends = ['skill', 'description'];
40
41
    public function skill_type() {
0 ignored issues
show
Coding Style introduced by
Public method name "Skill::skill_type" is not in camel caps format
Loading history...
Coding Style introduced by
Missing doc comment for function skill_type()
Loading history...
42
        return $this->belongsTo(\App\Models\Lookup\SkillType::class);
43
    }
44
45
    public function skill_declarations() {
0 ignored issues
show
Coding Style introduced by
Public method name "Skill::skill_declarations" is not in camel caps format
Loading history...
Coding Style introduced by
Missing doc comment for function skill_declarations()
Loading history...
46
        return $this->hasMany(\App\Models\SkillDeclaration::class);
47
    }
48
49
    // Accessors
50
    public function getSkillAttribute() {
0 ignored issues
show
Coding Style introduced by
You must use "/**" style comments for a function comment
Loading history...
51
        return Lang::get('common/skills.skills')[$this->name]['name'];
52
    }
53
54
    public function getDescriptionAttribute() {
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function getDescriptionAttribute()
Loading history...
55
        return Lang::get('common/skills.skills')[$this->name]['description'];
56
    }
57
}
58