Initial commit - lms-v2 + CLAUDE.md
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Spatie\Permission\Traits\HasRoles;
|
||||
|
||||
class User extends Authenticatable
|
||||
{
|
||||
use HasFactory, Notifiable, HasRoles;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
* Kolom-kolom ini wajib didaftarkan agar form Create & Edit tidak diblokir Laravel.
|
||||
*/
|
||||
protected $fillable = [
|
||||
'nik',
|
||||
'identity_number',
|
||||
'initial',
|
||||
'first_name',
|
||||
'last_name',
|
||||
'phone',
|
||||
'email',
|
||||
'password',
|
||||
'role',
|
||||
'gender',
|
||||
'date_of_birth',
|
||||
'join_date',
|
||||
'photo',
|
||||
'department_id',
|
||||
'position_id',
|
||||
'training_matrix_id',
|
||||
'old_id',
|
||||
'old_password_hash',
|
||||
'is_active',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be hidden for serialization.
|
||||
*/
|
||||
protected $hidden = [
|
||||
'password',
|
||||
'remember_token',
|
||||
'old_password_hash',
|
||||
];
|
||||
|
||||
/**
|
||||
* Mengubah format string dari database menjadi format Date/Time Carbon otomatis.
|
||||
*/
|
||||
protected $casts = [
|
||||
'email_verified_at' => 'datetime',
|
||||
'password' => 'hashed',
|
||||
'date_of_birth' => 'date',
|
||||
'join_date' => 'date',
|
||||
'is_active' => 'boolean',
|
||||
];
|
||||
|
||||
// =========================================================================
|
||||
// RELASI ANTAR TABEL (MASTER DATA)
|
||||
// =========================================================================
|
||||
|
||||
// Relasi ke tabel departments
|
||||
public function department()
|
||||
{
|
||||
return $this->belongsTo(Department::class, 'department_id');
|
||||
}
|
||||
|
||||
// Relasi ke tabel positions
|
||||
public function position()
|
||||
{
|
||||
return $this->belongsTo(Position::class, 'position_id');
|
||||
}
|
||||
|
||||
// Jika model TrainingMatrix sudah Anda buat, buka komentar di bawah ini:
|
||||
/*
|
||||
public function trainingMatrix()
|
||||
{
|
||||
return $this->belongsTo(TrainingMatrix::class);
|
||||
}
|
||||
*/
|
||||
}
|
||||
Reference in New Issue
Block a user