hasOne(PesertaProfile::class, 'user_id', 'id'); } protected $hidden = [ 'password', 'remember_token', ]; protected $casts = [ 'email_verified_at' => 'datetime', ]; public static function isAdmin() { return Auth::user()->role === 'admin'; // Sesuaikan dengan kolom di database } public static function isUser(): bool { return Auth::user()->role === 'users'; // Sesuaikan dengan kolom di database } public function mahasiswa() { return $this->hasOne(Mahasiswa::class); } public function isJuri() { return $this->role === 'juri'; } public function schedulePiBis() { return $this->belongsToMany(SchedulePiBi::class, 'schedule_pibi_user', 'user_id', 'schedule_pibi_id'); } public function adminProfile() { return $this->hasOne(AdminProfile::class, 'user_id'); } public function juriProfile() { return $this->hasOne(JuriProfile::class, 'user_id'); } public function profile() { if ($this->role === 'admin') { return $this->adminProfile; } if ($this->role === 'juri') { return $this->juriProfile; } if ($this->role === 'peserta') { return $this->pesertaProfile; } return null; } public function penilaianAkhir() { return $this->hasOne(PenilaianAkhir::class, 'peserta_id', 'id'); } }