Passed
Push — feature/experience-api ( 68d96e )
by Tristan
05:53
created

ExperienceEducation::skills()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace App\Models;
4
5
use App\Models\BaseModel;
6
7
/**
8
 * Class ExperienceEducation
9
 *
10
 * @property int $id
11
 * @property int $education_type_id
12
 * @property string $area_of_study
13
 * @property string $institution
14
 * @property int $education_status_id
15
 * @property boolean $is_active
16
 * @property \Jenssegers\Date\Date $start_date
17
 * @property \Jenssegers\Date\Date $end_date
18
 * @property string $thesis_title
19
 * @property boolean $has_blockcert
20
 * @property int $experienceable_id
21
 * @property string $experienceable_type
22
 * @property boolean $is_education_requirement
23
 * @property \Jenssegers\Date\Date $created_at
24
 * @property \Jenssegers\Date\Date $updated_at
25
 *
26
 * @property \App\Models\Lookup\EducationType $education_type
27
 * @property \App\Models\Lookup\EducationStatus $education_status
28
 * @property \App\Models\Applicant|\App\Models\JobApplication $experienceable
29
 * @property \Illuminate\Database\Eloquent\Collection $skills
30
 * @property \Illuminate\Database\Eloquent\Collection $experience_skills
31
 *
32
 * @method string experienceTypeName
33
 */
34
class ExperienceEducation extends BaseModel
35
{
36
    protected $casts = [
37
        'education_type_id' => 'int',
38
        'area_of_study' => 'string',
39
        'institution' => 'string',
40
        'education_status_id' => 'int',
41
        'is_active' => 'boolean',
42
        'start_date' => 'date',
43
        'end_date' => 'date',
44
        'thesis_title' => 'string',
45
        'has_blockcert' => 'boolean',
46
        'is_education_requirement' => 'boolean'
47
    ];
48
49
    protected $fillable = [
50
        'education_type_id',
51
        'area_of_study',
52
        'institution',
53
        'education_status_id',
54
        'is_active',
55
        'start_date',
56
        'end_date',
57
        'thesis_title',
58
        'has_blockcert',
59
        'is_education_requirement'
60
    ];
61
62
    protected $table = 'experiences_education';
63
64
    public function education_type() //phpcs:ignore
65
    {
66
        return $this->belongsTo(\App\Models\Lookup\EducationType::class);
67
    }
68
69
    public function education_status() //phpcs:ignore
70
    {
71
        return $this->belongsTo(\App\Models\Lookup\EducationStatus::class);
72
    }
73
74
    public function experienceable() //phpcs:ignore
75
    {
76
        return $this->morphTo();
77
    }
78
79
    public function skills()
80
    {
81
        return $this->morphToMany(\App\Models\Skill::class, 'experience', 'experience_skills');
82
    }
83
84
    public function experience_skills() //phpcs:ignore
85
    {
86
        return $this->morphMany(\App\Models\ExperienceSkill::class, 'experience');
87
    }
88
89
    /**
90
     * Returns the name of this experience type. Used to distinguish from other Experience models.
91
     * @return string Returns the string 'education'.
92
     */
93
    public function experienceTypeName(): string
94
    {
95
        return 'education';
96
    }
97
}
98