reconstruction of the project

This commit is contained in:
root
2026-03-08 16:33:24 -04:00
parent 23b7db1107
commit c8de5f7edc
9157 changed files with 77877 additions and 1073823 deletions
+48 -4
View File
@@ -2,13 +2,19 @@
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use App\Models\BaseModel;
use Illuminate\Database\Eloquent\SoftDeletes;
class Competition extends Model
class Competition extends BaseModel
{
use SoftDeletes;
protected $table = 'competitions';
// ✅ CI: useSoftDeletes = true
use SoftDeletes;
// ✅ CI: useTimestamps = true (created_at/updated_at) + deleted_at for soft deletes
public $timestamps = true;
protected $fillable = [
'title',
'semester',
@@ -28,5 +34,43 @@ class Competition extends Model
'locked_at',
'locked_by',
];
public $timestamps = true;
protected $casts = [
'class_section_id' => 'integer',
'winners_count' => 'integer',
'prize_per_point' => 'decimal:2', // adjust precision if needed
'is_published' => 'boolean',
'is_locked' => 'boolean',
// change to 'date' if your columns are DATE (not DATETIME)
'start_date' => 'date',
'end_date' => 'date',
'published_at' => 'datetime',
'locked_at' => 'datetime',
'locked_by' => 'integer',
'created_by' => 'integer',
];
/* Optional relationships */
public function classSection()
{
return $this->belongsTo(ClassSection::class, 'class_section_id');
}
public function lockedByUser()
{
return $this->belongsTo(User::class, 'locked_by');
}
public function createdByUser()
{
return $this->belongsTo(User::class, 'created_by');
}
public function classWinners()
{
return $this->hasMany(CompetitionClassWinner::class, 'competition_id');
}
}