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

ExperienceAward::experienceTypeName()   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
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace App\Models;
4
5
use App\Models\BaseModel;
6
7
/**
8
 * Class ExperienceAward
9
 *
10
 * @property int $id
11
 * @property string $title
12
 * @property int $award_recipient_type_id
13
 * @property string $issued_by
14
 * @property int $award_recognition_type_id
15
 * @property \Jenssegers\Date\Date $awarded_date
16
 * @property int $experienceable_id
17
 * @property string $experienceable_type
18
 * @property boolean $is_education_requirement
19
 * @property \Jenssegers\Date\Date $created_at
20
 * @property \Jenssegers\Date\Date $updated_at
21
 *
22
 * @property \App\Models\Applicant|\App\Models\JobApplication $experienceable
23
 * @property \Illuminate\Database\Eloquent\Collection $skills
24
 * @property \Illuminate\Database\Eloquent\Collection $experience_skills
25
 *
26
 * @method string experienceTypeName
27
 */
28
class ExperienceAward extends BaseModel
29
{
30
    protected $casts = [
31
        'title' => 'string',
32
        'award_recipient_type_id' => 'int',
33
        'issued_by' => 'string',
34
        'award_recognition_type_id' => 'int',
35
        'awarded_date' => 'date',
36
        'is_education_requirement' => 'boolean'
37
    ];
38
39
    protected $fillable = [
40
        'title',
41
        'award_recipient_type_id',
42
        'issued_by',
43
        'award_recognition_type_id',
44
        'awarded_date',
45
        'is_education_requirement'
46
    ];
47
48
    protected $table = 'experiences_award';
49
50
    public function award_recipient_type() //phpcs:ignore
51
    {
52
        return $this->belongsTo(\App\Models\Lookup\AwardRecipientType::class);
53
    }
54
55
    public function award_recognition_type() //phpcs:ignore
56
    {
57
        return $this->belongsTo(\App\Models\Lookup\AwardRecognitionType::class);
58
    }
59
60
    public function experienceable() //phpcs:ignore
61
    {
62
        return $this->morphTo();
63
    }
64
65
    public function skills()
66
    {
67
        return $this->morphToMany(\App\Models\Skill::class, 'experience', 'experience_skills');
68
    }
69
70
    public function experience_skills() //phpcs:ignore
71
    {
72
        return $this->morphMany(\App\Models\ExperienceSkill::class, 'experience');
73
    }
74
75
    /**
76
     * Returns the name of this experience type. Used to distinguish from other Experience models.
77
     * @return string Returns the string 'award'.
78
     */
79
    public function experienceTypeName(): string
80
    {
81
        return 'award';
82
    }
83
}
84