|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace App\Models; |
|
4
|
|
|
|
|
5
|
|
|
use App\Models\BaseModel; |
|
6
|
|
|
|
|
7
|
|
|
/** |
|
8
|
|
|
* Class ExperienceWork |
|
9
|
|
|
* |
|
10
|
|
|
* @property int $id |
|
11
|
|
|
* @property string $title |
|
12
|
|
|
* @property string $organization |
|
13
|
|
|
* @property string $group |
|
14
|
|
|
* @property boolean $is_active |
|
15
|
|
|
* @property \Jenssegers\Date\Date $start_date |
|
16
|
|
|
* @property \Jenssegers\Date\Date $end_date |
|
17
|
|
|
* @property int $experienceable_id |
|
18
|
|
|
* @property string $experienceable_type |
|
19
|
|
|
* @property boolean $is_education_requirement |
|
20
|
|
|
* @property \Jenssegers\Date\Date $created_at |
|
21
|
|
|
* @property \Jenssegers\Date\Date $updated_at |
|
22
|
|
|
* |
|
23
|
|
|
* @property \App\Models\Applicant|\App\Models\JobApplication $experienceable |
|
24
|
|
|
* @property \Illuminate\Database\Eloquent\Collection $skills |
|
25
|
|
|
* @property \Illuminate\Database\Eloquent\Collection $experience_skills |
|
26
|
|
|
* |
|
27
|
|
|
* @method string experienceTypeName |
|
28
|
|
|
*/ |
|
29
|
|
|
class ExperienceWork extends BaseModel |
|
30
|
|
|
{ |
|
31
|
|
|
protected $casts = [ |
|
32
|
|
|
'title' => 'string', |
|
33
|
|
|
'organization' => 'string', |
|
34
|
|
|
'group' => 'string', |
|
35
|
|
|
'is_active' => 'boolean', |
|
36
|
|
|
'start_date' => 'date', |
|
37
|
|
|
'end_date' => 'date', |
|
38
|
|
|
'is_education_requirement' => 'boolean' |
|
39
|
|
|
]; |
|
40
|
|
|
|
|
41
|
|
|
protected $fillable = [ |
|
42
|
|
|
'title', |
|
43
|
|
|
'organization', |
|
44
|
|
|
'group', |
|
45
|
|
|
'is_active', |
|
46
|
|
|
'start_date', |
|
47
|
|
|
'end_date', |
|
48
|
|
|
'is_education_requirement' |
|
49
|
|
|
]; |
|
50
|
|
|
|
|
51
|
|
|
protected $table = 'experiences_work'; |
|
52
|
|
|
|
|
53
|
|
|
public static function boot() |
|
54
|
|
|
{ |
|
55
|
|
|
parent::boot(); |
|
56
|
|
|
|
|
57
|
|
|
// Delete associated ExperienceSkills when this is deleted. |
|
58
|
|
|
static::deleting(function ($work): void { |
|
59
|
|
|
foreach ($work->experience_skills as $es) { |
|
60
|
|
|
$es->delete(); |
|
61
|
|
|
} |
|
62
|
|
|
}); |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
public function experienceable() //phpcs:ignore |
|
66
|
|
|
{ |
|
67
|
|
|
return $this->morphTo(); |
|
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 'experience_work'. |
|
78
|
|
|
*/ |
|
79
|
|
|
public function experienceTypeName(): string |
|
80
|
|
|
{ |
|
81
|
|
|
return 'experience_work'; |
|
82
|
|
|
} |
|
83
|
|
|
} |
|
84
|
|
|
|