|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* Created by Reliese Model. |
|
5
|
|
|
* Date: Thu, 12 Jul 2018 22:39:27 +0000. |
|
6
|
|
|
*/ |
|
|
|
|
|
|
7
|
|
|
|
|
8
|
|
|
namespace App\Models; |
|
9
|
|
|
use App\Models\Lookup\CriteriaTypeTranslation; |
|
10
|
|
|
|
|
11
|
|
|
/** |
|
12
|
|
|
* Class Criteria |
|
13
|
|
|
* |
|
14
|
|
|
* @property int $id |
|
15
|
|
|
* @property int $criteria_type_id |
|
16
|
|
|
* @property int $job_poster_id |
|
17
|
|
|
* @property int $skill_id |
|
18
|
|
|
* @property int $skill_level_id |
|
19
|
|
|
* @property \Jenssegers\Date\Date $created_at |
|
20
|
|
|
* @property \Jenssegers\Date\Date $updated_at |
|
21
|
|
|
* |
|
22
|
|
|
* @property \App\Models\Lookup\CriteriaType $criteria_type |
|
23
|
|
|
* @property \App\Models\JobPoster $job_poster |
|
24
|
|
|
* @property \App\Models\Skill $skill |
|
25
|
|
|
* @property \App\Models\Lookup\SkillLevel $skill_level |
|
26
|
|
|
* @property \Illuminate\Database\Eloquent\Collection $criteria_translations |
|
27
|
|
|
* @property \Illuminate\Database\Eloquent\Collection[Assessment] $assessments |
|
28
|
|
|
* |
|
29
|
|
|
* Accessors |
|
30
|
|
|
* @property string $type |
|
31
|
|
|
* |
|
32
|
|
|
* Localized Properties: |
|
33
|
|
|
* @property string $description |
|
|
|
|
|
|
34
|
|
|
*/ |
|
|
|
|
|
|
35
|
|
|
class Criteria extends BaseModel { |
|
|
|
|
|
|
36
|
|
|
|
|
37
|
|
|
use \Dimsav\Translatable\Translatable; |
|
|
|
|
|
|
38
|
|
|
public $translatedAttributes = ['description']; |
|
39
|
|
|
|
|
40
|
|
|
protected $table = 'criteria'; |
|
41
|
|
|
protected $casts = [ |
|
42
|
|
|
'criteria_type_id' => 'int', |
|
43
|
|
|
'job_poster_id' => 'int', |
|
44
|
|
|
'skill_id' => 'int', |
|
45
|
|
|
'skill_level_id' => 'int', |
|
46
|
|
|
]; |
|
47
|
|
|
protected $fillable = [ |
|
48
|
|
|
'criteria_type_id', |
|
49
|
|
|
'skill_id', |
|
50
|
|
|
'skill_level_id', |
|
51
|
|
|
]; |
|
52
|
|
|
protected $with = [ |
|
53
|
|
|
'criteria_type', |
|
54
|
|
|
'skill', |
|
55
|
|
|
'skill_level' |
|
56
|
|
|
]; |
|
57
|
|
|
|
|
58
|
|
|
public function criteria_type() { |
|
|
|
|
|
|
59
|
|
|
return $this->belongsTo(\App\Models\Lookup\CriteriaType::class); |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
public function job_poster() { |
|
|
|
|
|
|
63
|
|
|
return $this->belongsTo(\App\Models\JobPoster::class); |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
public function skill() { |
|
|
|
|
|
|
67
|
|
|
return $this->belongsTo(\App\Models\Skill::class); |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
public function skill_level() { |
|
|
|
|
|
|
71
|
|
|
return $this->belongsTo(\App\Models\Lookup\SkillLevel::class); |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
public function criteria_translations() { |
|
|
|
|
|
|
75
|
|
|
return $this->hasMany(\App\Models\Lookup\CriteriaTypeTranslation::class); |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
/** |
|
79
|
|
|
* Get all assessments for this Criteria, for all Screening Plans. |
|
80
|
|
|
* |
|
81
|
|
|
* @return \Illuminate\Database\Eloquent\Collection |
|
82
|
|
|
*/ |
|
83
|
|
|
public function assessments() // phpcs:ignore |
|
84
|
|
|
{ |
|
85
|
|
|
return $this->hasMany(\App\Models\ScreeningPlan::class); |
|
|
|
|
|
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
/** |
|
89
|
|
|
* Returns the associated criteria-type name |
|
90
|
|
|
* @return string |
|
|
|
|
|
|
91
|
|
|
*/ |
|
92
|
|
|
public function getTypeAttribute(): string |
|
93
|
|
|
{ |
|
94
|
|
|
return $this->criteria_type->name; |
|
95
|
|
|
} |
|
96
|
|
|
} |
|
97
|
|
|
|