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
|
|
|
|
10
|
|
|
use App\Traits\TalentCloudCrudTrait as CrudTrait; |
11
|
|
|
use Spatie\Translatable\HasTranslations; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* Class Manager |
15
|
|
|
* |
16
|
|
|
* @property int $id |
17
|
|
|
* @property int $work_review_frequency_id |
18
|
|
|
* @property int $stay_late_frequency_id |
19
|
|
|
* @property int $engage_team_frequency_id |
20
|
|
|
* @property int $development_opportunity_frequency_id |
21
|
|
|
* @property int $refuse_low_value_work_frequency_id |
22
|
|
|
* @property int $years_experience |
23
|
|
|
* @property string $twitter_username |
24
|
|
|
* @property string $linkedin_url |
25
|
|
|
* @property int $user_id |
26
|
|
|
* @property \Jenssegers\Date\Date $created_at |
27
|
|
|
* @property \Jenssegers\Date\Date $updated_at |
28
|
|
|
* |
29
|
|
|
* @property \App\Models\User $user |
30
|
|
|
* @property \Illuminate\Database\Eloquent\Collection $job_posters |
31
|
|
|
* @property \App\Models\WorkEnvironment $work_environment |
32
|
|
|
* @property \App\Models\TeamCulture $team_culture |
33
|
|
|
* @property \App\Models\Lookup\Frequency $work_review_frequency |
34
|
|
|
* @property \App\Models\Lookup\Frequency $stay_late_frequency |
35
|
|
|
* @property \App\Models\Lookup\Frequency $engage_team_frequency |
36
|
|
|
* @property \App\Models\Lookup\Frequency $development_opportunity_frequency |
37
|
|
|
* @property \App\Models\Lookup\Frequency $refuse_low_value_work_frequency |
38
|
|
|
* |
39
|
|
|
* Localized Properties: |
40
|
|
|
* @property string $about_me |
41
|
|
|
* @property string $greatest_accomplishment |
42
|
|
|
* @property string $division |
43
|
|
|
* @property string $position |
44
|
|
|
* @property string $leadership_style |
45
|
|
|
* @property string $employee_learning |
46
|
|
|
* @property string $expectations |
47
|
|
|
* @property string $education |
48
|
|
|
* @property string $career_journey |
49
|
|
|
* @property string $learning_path |
50
|
|
|
* |
51
|
|
|
* Computed Properties |
52
|
|
|
* @property string $full_name |
53
|
|
|
* @property string $first_name |
54
|
|
|
* @property string $last_name |
55
|
|
|
* @property boolean $is_demo_manager |
56
|
|
|
*/ |
57
|
|
|
class Manager extends BaseModel |
58
|
|
|
{ |
59
|
|
|
use HasTranslations; |
60
|
|
|
use CrudTrait; |
61
|
|
|
|
62
|
|
|
public $translatable = [ |
63
|
|
|
'about_me', |
64
|
|
|
'greatest_accomplishment', |
65
|
|
|
'division', |
66
|
|
|
'position', |
67
|
|
|
'leadership_style', |
68
|
|
|
'employee_learning', |
69
|
|
|
'expectations', |
70
|
|
|
'education', |
71
|
|
|
'career_journey', |
72
|
|
|
'learning_path' |
73
|
|
|
]; |
74
|
|
|
protected $casts = [ |
75
|
|
|
'user_id' => 'int' |
76
|
|
|
]; |
77
|
|
|
protected $fillable = [ |
78
|
|
|
'twitter_username', |
79
|
|
|
'linkedin_url', |
80
|
|
|
'work_review_frequency_id', |
81
|
|
|
'stay_late_frequency_id', |
82
|
|
|
'engage_team_frequency_id', |
83
|
|
|
'development_opportunity_frequency_id', |
84
|
|
|
'refuse_low_value_work_frequency_id', |
85
|
|
|
'years_experience', |
86
|
|
|
'about_me', |
87
|
|
|
'greatest_accomplishment', |
88
|
|
|
'division', |
89
|
|
|
'position', |
90
|
|
|
'leadership_style', |
91
|
|
|
'employee_learning', |
92
|
|
|
'expectations', |
93
|
|
|
'education', |
94
|
|
|
'career_journey', |
95
|
|
|
'learning_path' |
96
|
|
|
]; |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* The accessors to append to the model's array form. |
100
|
|
|
* |
101
|
|
|
* @var array |
102
|
|
|
*/ |
103
|
|
|
protected $appends = ['first_name', 'last_name', 'full_name', 'is_demo_manager']; |
104
|
|
|
|
105
|
|
|
/** |
106
|
|
|
* The attributes that should be visible in arrays. |
107
|
|
|
* |
108
|
|
|
* @var array |
109
|
|
|
*/ |
110
|
|
|
protected $visible = [ |
111
|
|
|
'id', |
112
|
|
|
'user_id', |
113
|
|
|
'first_name', |
114
|
|
|
'last_name', |
115
|
|
|
'full_name', |
116
|
|
|
'twitter_username', |
117
|
|
|
'linkedin_url', |
118
|
|
|
'is_demo_manager', |
119
|
|
|
'about_me', |
120
|
|
|
'greatest_accomplishment', |
121
|
|
|
'division', |
122
|
|
|
'position', |
123
|
|
|
'leadership_style', |
124
|
|
|
'employee_learning', |
125
|
|
|
'expectations', |
126
|
|
|
'education', |
127
|
|
|
'career_journey', |
128
|
|
|
'learning_path' |
129
|
|
|
]; |
130
|
|
|
|
131
|
|
|
public function user() |
132
|
|
|
{ |
133
|
|
|
return $this->belongsTo(\App\Models\User::class); |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
public function job_posters() //phpcs:ignore |
137
|
|
|
{ |
138
|
|
|
return $this->hasMany(\App\Models\JobPoster::class); |
139
|
|
|
} |
140
|
|
|
|
141
|
|
|
public function work_environment() //phpcs:ignore |
142
|
|
|
{ |
143
|
|
|
return $this->hasOne(\App\Models\WorkEnvironment::class)->withDefault(); |
144
|
|
|
} |
145
|
|
|
|
146
|
|
|
public function team_culture() //phpcs:ignore |
147
|
|
|
{ |
148
|
|
|
return $this->hasOne(\App\Models\TeamCulture::class)->withDefault(); |
149
|
|
|
} |
150
|
|
|
|
151
|
|
|
public function work_review_frequency() //phpcs:ignore |
152
|
|
|
{ |
153
|
|
|
return $this->belongsTo(\App\Models\Lookup\Frequency::class); |
154
|
|
|
} |
155
|
|
|
|
156
|
|
|
public function stay_late_frequency() //phpcs:ignore |
157
|
|
|
{ |
158
|
|
|
return $this->belongsTo(\App\Models\Lookup\Frequency::class); |
159
|
|
|
} |
160
|
|
|
|
161
|
|
|
public function engage_team_frequency() //phpcs:ignore |
162
|
|
|
{ |
163
|
|
|
return $this->belongsTo(\App\Models\Lookup\Frequency::class); |
164
|
|
|
} |
165
|
|
|
|
166
|
|
|
public function development_opportunity_frequency() //phpcs:ignore |
167
|
|
|
{ |
168
|
|
|
return $this->belongsTo(\App\Models\Lookup\Frequency::class); |
169
|
|
|
} |
170
|
|
|
|
171
|
|
|
public function refuse_low_value_work_frequency() //phpcs:ignore |
172
|
|
|
{ |
173
|
|
|
return $this->belongsTo(\App\Models\Lookup\Frequency::class); |
174
|
|
|
} |
175
|
|
|
|
176
|
|
|
/** |
177
|
|
|
* Return the full name of the User associated with this Manager. |
178
|
|
|
* |
179
|
|
|
* @return string |
180
|
|
|
*/ |
181
|
|
|
public function getFullNameAttribute(): string |
182
|
|
|
{ |
183
|
|
|
if ($this->user !== null) { |
184
|
|
|
return $this->user->first_name . ' ' . $this->user->last_name; |
185
|
|
|
} |
186
|
|
|
return ''; |
187
|
|
|
} |
188
|
|
|
|
189
|
|
|
/** |
190
|
|
|
* Return the first name of the User associated with this Manager. |
191
|
|
|
* |
192
|
|
|
* @return string |
193
|
|
|
*/ |
194
|
|
|
public function getFirstNameAttribute(): string |
195
|
|
|
{ |
196
|
|
|
if ($this->user !== null) { |
197
|
|
|
return $this->user->first_name; |
198
|
|
|
} |
199
|
|
|
return ''; |
200
|
|
|
} |
201
|
|
|
|
202
|
|
|
/** |
203
|
|
|
* Return the last name of the User associated with this Manager. |
204
|
|
|
* |
205
|
|
|
* @return string |
206
|
|
|
*/ |
207
|
|
|
public function getLastNameAttribute(): string |
208
|
|
|
{ |
209
|
|
|
if ($this->user !== null) { |
210
|
|
|
return $this->user->last_name; |
211
|
|
|
} |
212
|
|
|
return ''; |
213
|
|
|
} |
214
|
|
|
|
215
|
|
|
/** |
216
|
|
|
* Return whether this is a Demo Manager. |
217
|
|
|
* |
218
|
|
|
* @return boolean |
219
|
|
|
*/ |
220
|
|
|
public function getIsDemoManagerAttribute(): bool |
221
|
|
|
{ |
222
|
|
|
if ($this->user !== null) { |
223
|
|
|
return $this->user->isDemoManager(); |
224
|
|
|
} |
225
|
|
|
return true; |
226
|
|
|
} |
227
|
|
|
} |
228
|
|
|
|