*/ use HasFactory, Notifiable; /** * Get the attributes that should be cast. * * @return array */ protected function casts(): array { return [ 'email_verified_at' => 'datetime', 'password' => 'hashed', 'subscription_expires_at' => 'datetime', ]; } public function isAdmin(): bool { return $this->role === 'admin'; } public function isEmployer(): bool { return $this->role === 'employer'; } public function hasActiveSubscription(): bool { return $this->subscription_status === 'active' && ($this->subscription_expires_at === null || $this->subscription_expires_at > now()); } public function subscription() { return $this->hasOne(Subscription::class); } public function emiratesIdVerification() { return $this->hasOne(EmployerProfile::class, 'user_id'); } public function employerProfile() { return $this->hasOne(EmployerProfile::class, 'user_id'); } public function sponsor() { return $this->hasOne(Sponsor::class, 'email', 'email'); } public function announcements() { return $this->hasMany(Announcement::class, 'employer_id'); } public function payments() { return $this->hasMany(Payment::class, 'user_id'); } }