|PenggunaanPoin newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|PenggunaanPoin newQuery() * @method static \Illuminate\Database\Eloquent\Builder|PenggunaanPoin query() * @method static \Illuminate\Database\Eloquent\Builder|PenggunaanPoin whereAlasanPenolakan($value) * @method static \Illuminate\Database\Eloquent\Builder|PenggunaanPoin whereCreatedAt($value) * @method static \Illuminate\Database\Eloquent\Builder|PenggunaanPoin whereIdPenggunaan($value) * @method static \Illuminate\Database\Eloquent\Builder|PenggunaanPoin whereIdPengurangan($value) * @method static \Illuminate\Database\Eloquent\Builder|PenggunaanPoin whereIdStatus($value) * @method static \Illuminate\Database\Eloquent\Builder|PenggunaanPoin whereIdUser($value) * @method static \Illuminate\Database\Eloquent\Builder|PenggunaanPoin whereJamMasukCustom($value) * @method static \Illuminate\Database\Eloquent\Builder|PenggunaanPoin whereJamPulangCustom($value) * @method static \Illuminate\Database\Eloquent\Builder|PenggunaanPoin whereJumlahPoin($value) * @method static \Illuminate\Database\Eloquent\Builder|PenggunaanPoin whereTanggalDiajukan($value) * @method static \Illuminate\Database\Eloquent\Builder|PenggunaanPoin whereTanggalPenggunaan($value) * @method static \Illuminate\Database\Eloquent\Builder|PenggunaanPoin whereUpdatedAt($value) * @mixin \Eloquent */ class PenggunaanPoin extends Model { use HasFactory; protected $table = 'penggunaan_poin'; protected $primaryKey = 'id_penggunaan'; public $incrementing = false; protected $keyType = 'string'; protected static function booted() { static::creating(function ($model) { if (empty($model->{$model->getKeyName()})) { $prefix = 'PNP-' . date('ym') . '-'; $model->{$model->getKeyName()} = $prefix . strtoupper(\Illuminate\Support\Str::random(5)); } }); } protected $fillable = [ 'id_user', 'tanggal_penggunaan', 'jumlah_poin', 'id_pengurangan', 'jam_masuk_custom', 'jam_pulang_custom', 'id_status', 'alasan_penolakan', 'tanggal_diajukan' ]; protected $casts = [ 'tanggal_penggunaan' => 'date', 'tanggal_diajukan' => 'datetime', ]; public function user() { return $this->belongsTo(User::class, 'id_user'); } public function jenisPengurangan() { return $this->belongsTo(JenisPengurangan::class, 'id_pengurangan'); } public function status() { return $this->belongsTo(StatusPengajuan::class, 'id_status', 'id_status'); } }