38 lines
909 B
PHP
38 lines
909 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Models\Sppm\PetugasPermohonan;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class KehadiranTaklimat extends Model
|
|
{
|
|
protected $table = 'kehadiran_taklimat';
|
|
protected $guarded = [];
|
|
|
|
protected $casts = [
|
|
'hadir_at' => 'datetime',
|
|
'borang_diambil' => 'boolean',
|
|
'borang_diambil_at' => 'datetime',
|
|
];
|
|
|
|
public function sesi(): BelongsTo
|
|
{
|
|
return $this->belongsTo(SesiTaklimat::class, 'sesi_taklimat_id');
|
|
}
|
|
|
|
public function permohonan(): BelongsTo
|
|
{
|
|
return $this->belongsTo(PetugasPermohonan::class, 'permohonan_id');
|
|
}
|
|
|
|
/**
|
|
* Nombor siri berpad minimum 3 digit (001, 002, 1001).
|
|
*/
|
|
public function getNomborSiriPaparAttribute(): string
|
|
{
|
|
return str_pad((string) $this->nombor_siri, 3, '0', STR_PAD_LEFT);
|
|
}
|
|
}
|