File manager - Edit - /var/www/html/homologBancodetalentos/app/Models/TalentBank/Candidate.php
Back
<?php namespace App\Models\TalentBank; use App\Models\TalentBank\Candidate\Course; use App\Models\TalentBank\Candidate\Education; use App\Models\TalentBank\Candidate\Experience; use App\Models\TalentBank\Candidate\Skill; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\BelongsToMany; use Illuminate\Database\Eloquent\Relations\HasMany; class Candidate extends Model { use HasFactory; protected $fillable = [ 'cpf', 'name', 'email', 'address', 'zip_code', 'birth_date', 'special_needs', 'telephone', 'cellphone', 'min_payment', 'desired_payment', 'cv_summary', 'photo_path', 'has_experience', 'active', 'neighbourhood_id', 'gender_id', 'marital_status_id', 'occupation_id', 'ethnicity_id', 'email_notifications_enabled', 'profile_completed_at', ]; protected $casts = [ 'birth_date' => 'date', 'special_needs' => 'boolean', 'has_experience' => 'boolean', 'active' => 'boolean', 'email_notifications_enabled' => 'boolean', 'min_payment' => 'decimal:2', 'desired_payment' => 'decimal:2', 'profile_completed_at' => 'datetime', ]; /** * Candidatos criados via SSO (migrados do BT antigo) têm profile_completed_at = null * até concluírem o fluxo de complemento. Candidatos novos recebem o campo preenchido * no momento do cadastro — eles nunca passam pela tela de conclusão. */ public function isProfileComplete(): bool { return $this->profile_completed_at !== null; } public function markProfileComplete(): void { if ($this->profile_completed_at === null) { $this->profile_completed_at = now(); $this->save(); } } public function neighbourhood(): BelongsTo { return $this->belongsTo(Neighbourhood::class); } public function gender(): BelongsTo { return $this->belongsTo(Gender::class); } public function maritalStatus(): BelongsTo { return $this->belongsTo(MaritalStatus::class); } public function occupation(): BelongsTo { return $this->belongsTo(Occupation::class); } public function ethnicity(): BelongsTo { return $this->belongsTo(Ethnicity::class); } public function educations(): HasMany { return $this->hasMany(Education::class); } public function courses(): HasMany { return $this->hasMany(Course::class); } public function experiences(): HasMany { return $this->hasMany(Experience::class); } public function skills(): HasMany { return $this->hasMany(Skill::class); } public function languages(): BelongsToMany { return $this->belongsToMany(Language::class, 'candidate_languages') ->withPivot('language_proficiency_id') ->withTimestamps(); } public function wantedOccupations(): BelongsToMany { return $this->belongsToMany(Occupation::class, 'candidate_wanted_occupations') ->withTimestamps(); } public function jobListings(): BelongsToMany { return $this->belongsToMany(JobListing::class, 'job_listing_candidate') ->withPivot('status') ->withTimestamps(); } /** @deprecated Use jobListings(); kept for parity with legacy API resources */ public function applications(): BelongsToMany { return $this->jobListings(); } public function notifications(): HasMany { return $this->hasMany(CandidateNotification::class); } public function unreadNotifications(): HasMany { return $this->hasMany(CandidateNotification::class)->where('read', false); } }
| ver. 1.4 |
Github
|
.
| PHP 8.3.28 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings