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 static function boot() |
65
|
|
|
{ |
66
|
|
|
parent::boot(); |
67
|
|
|
|
68
|
|
|
// Delete associated ExperienceSkills when this is deleted. |
69
|
|
|
static::deleting(function ($education): void { |
70
|
|
|
foreach ($education->experience_skills as $es) { |
71
|
|
|
$es->delete(); |
72
|
|
|
} |
73
|
|
|
}); |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
public function education_type() //phpcs:ignore |
77
|
|
|
{ |
78
|
|
|
return $this->belongsTo(\App\Models\Lookup\EducationType::class); |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
public function education_status() //phpcs:ignore |
82
|
|
|
{ |
83
|
|
|
return $this->belongsTo(\App\Models\Lookup\EducationStatus::class); |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
public function experienceable() //phpcs:ignore |
87
|
|
|
{ |
88
|
|
|
return $this->morphTo(); |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
public function experience_skills() //phpcs:ignore |
92
|
|
|
{ |
93
|
|
|
return $this->morphMany(\App\Models\ExperienceSkill::class, 'experience'); |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* Returns the name of this experience type. Used to distinguish from other Experience models. |
98
|
|
|
* @return string Returns the string 'experience_education'. |
99
|
|
|
*/ |
100
|
|
|
public function experienceTypeName(): string |
101
|
|
|
{ |
102
|
|
|
return 'experience_education'; |
103
|
|
|
} |
104
|
|
|
} |
105
|
|
|
|