2026-01-26 11:09:39 +07:00

61 lines
1.6 KiB
PHP

<?php
namespace App\Models;
// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
class User extends Authenticatable
{
/** @use HasFactory<\Database\Factories\UserFactory> */
use HasFactory, Notifiable;
/**
* The attributes that are mass assignable.
*
* @var list<string>
*/
protected $connection = 'dbDirectory';
protected $table = 'public.loginuser_s';
public $timestamps = false;
protected $primaryKey = "id";
protected $guarded = [
'id',
];
/**
* The attributes that should be hidden for serialization.
*
* @var list<string>
*/
protected $hidden = [
'katasandi'
];
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'katasandi' => 'hashed',
];
}
protected $with = ['dataUser', 'masterPersetujuan', 'akses'];
public function dataUser(){
return $this->belongsTo(DataUser::class, 'objectpegawaifk', 'id')->select('id', 'namalengkap');
}
public function masterPersetujuan(){
return $this->belongsTo(masterPersetujuan::class, 'objectpegawaifk', 'pegawai_id')->where('statusenabled', true)->with('details');
}
public function akses(){
return $this->belongsTo(AksesFile::class, 'objectpegawaifk', 'pegawai_id')->where('statusenabled', true);
}
}