This commit is contained in:
Saufi
2026-06-24 18:30:00 +08:00
commit c0c3d7c09c
122 changed files with 16321 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
class DrawSession extends Model
{
protected $attributes = [
'is_active' => true,
'return_cancelled_to_pool' => true,
];
protected $fillable = [
'nama',
'is_active',
'return_cancelled_to_pool',
'started_by',
];
protected function casts(): array
{
return [
'is_active' => 'boolean',
'return_cancelled_to_pool' => 'boolean',
];
}
public function results(): HasMany
{
return $this->hasMany(DrawResult::class);
}
public function startedBy(): BelongsTo
{
return $this->belongsTo(User::class, 'started_by');
}
public static function active(): self
{
return static::firstOrCreate(
['is_active' => true],
['nama' => 'Mesyuarat Agung Tahunan KOIPB']
);
}
}