|PengajuanIzin newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|PengajuanIzin newQuery() * @method static \Illuminate\Database\Eloquent\Builder|PengajuanIzin query() * @method static \Illuminate\Database\Eloquent\Builder|PengajuanIzin whereAlasan($value) * @method static \Illuminate\Database\Eloquent\Builder|PengajuanIzin whereAlasanPenolakan($value) * @method static \Illuminate\Database\Eloquent\Builder|PengajuanIzin whereBuktiFile($value) * @method static \Illuminate\Database\Eloquent\Builder|PengajuanIzin whereCreatedAt($value) * @method static \Illuminate\Database\Eloquent\Builder|PengajuanIzin whereIdIzin($value) * @method static \Illuminate\Database\Eloquent\Builder|PengajuanIzin whereIdJenisIzin($value) * @method static \Illuminate\Database\Eloquent\Builder|PengajuanIzin whereIdStatus($value) * @method static \Illuminate\Database\Eloquent\Builder|PengajuanIzin whereIdUser($value) * @method static \Illuminate\Database\Eloquent\Builder|PengajuanIzin whereTanggalDiajukan($value) * @method static \Illuminate\Database\Eloquent\Builder|PengajuanIzin whereTanggalMulai($value) * @method static \Illuminate\Database\Eloquent\Builder|PengajuanIzin whereTanggalSelesai($value) * @method static \Illuminate\Database\Eloquent\Builder|PengajuanIzin whereUpdatedAt($value) * @mixin \Eloquent */ class PengajuanIzin extends Model { use HasFactory; protected $table = 'pengajuan_izin'; protected $primaryKey = 'id_izin'; public $incrementing = false; protected $keyType = 'string'; protected static function booted() { static::creating(function ($model) { if (empty($model->{$model->getKeyName()})) { $prefix = 'IZN-' . date('ym') . '-'; $model->{$model->getKeyName()} = $prefix . strtoupper(\Illuminate\Support\Str::random(5)); } }); } protected $fillable = [ 'id_user', 'id_jenis_izin', 'id_status', 'tanggal_mulai', 'tanggal_selesai', 'alasan', 'bukti_file', ]; public function user() { return $this->belongsTo(User::class, 'id_user'); } public function jenisIzin() { return $this->belongsTo(JenisIzin::class, 'id_jenis_izin', 'id_jenis_izin'); } public function statusPengajuan() { return $this->belongsTo(StatusPengajuan::class, 'id_status', 'id_status'); } public function suratIzin() { return $this->hasOne(SuratIzin::class, 'id_izin', 'id_izin'); } }