first commit
This commit is contained in:
37
app/Models/SesiTaklimat.php
Normal file
37
app/Models/SesiTaklimat.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\Sppm\Dun;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class SesiTaklimat extends Model
|
||||
{
|
||||
protected $table = 'sesi_taklimat';
|
||||
protected $guarded = [];
|
||||
|
||||
protected $casts = [
|
||||
'tarikh' => 'date',
|
||||
'is_active' => 'boolean',
|
||||
];
|
||||
|
||||
protected static function booted(): void
|
||||
{
|
||||
static::creating(function (SesiTaklimat $sesi) {
|
||||
$sesi->qr_token ??= Str::random(32);
|
||||
});
|
||||
}
|
||||
|
||||
public function dun(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Dun::class, 'dun_id');
|
||||
}
|
||||
|
||||
public function kehadiran(): HasMany
|
||||
{
|
||||
return $this->hasMany(KehadiranTaklimat::class, 'sesi_taklimat_id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user