Passed
Push — task/experience-skills ( d76f21 )
by Grant
05:20
created

ExperienceAward::experienceable()   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 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 \Jenssegers\Date\Date $created_at
19
 * @property \Jenssegers\Date\Date $updated_at
20
 *
21
 * @property \App\Models\Applicant|\App\Models\JobApplication $experienceable
22
 * @property \Illuminate\Database\Eloquent\Collection $skills
23
 */
24
class ExperienceAward extends BaseModel
25
{
26
    protected $casts = [
27
        'title' => 'string',
28
        'award_recipient_type_id' => 'int',
29
        'issued_by' => 'string',
30
        'award_recognition_type_id' => 'int',
31
        'awarded_date' => 'date'
32
    ];
33
34
    protected $fillable = [
35
        'title',
36
        'award_recipient_type_id',
37
        'issued_by',
38
        'award_recognition_type_id',
39
        'awarded_date'
40
    ];
41
42
    protected $table = ['experiences_award'];
43
44
    public function award_recipient_type() //phpcs:ignore
45
    {
46
        return $this->belongsTo(\App\Models\Lookup\AwardRecipientType::class);
47
    }
48
49
    public function award_recognition_type() //phpcs:ignore
50
    {
51
        return $this->belongsTo(\App\Models\Lookup\AwardRecognitionType::class);
52
    }
53
54
    public function experienceable() //phpcs:ignore
55
    {
56
        return $this->morphTo();
57
    }
58
59
    public function skills()
60
    {
61
        return $this->morphToMany(\App\Models\Skill::class, 'experience', 'experience_skills');
62
    }
63
}
64