98 lines
2.6 KiB
PHP
98 lines
2.6 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
|
use Spatie\Translatable\HasTranslations;
|
|
use App\Models\EvaluationRuleSet;
|
|
|
|
class Round extends Model
|
|
{
|
|
use HasFactory;
|
|
use HasTranslations;
|
|
|
|
public array $translatable = [
|
|
'name',
|
|
'description',
|
|
];
|
|
protected $table = 'rounds';
|
|
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'contest_id',
|
|
'rule_set_id',
|
|
'preliminary_evaluation_run_id',
|
|
'official_evaluation_run_id',
|
|
'test_evaluation_run_id',
|
|
'name',
|
|
'description',
|
|
'is_active',
|
|
'is_test',
|
|
'is_sixhr',
|
|
'start_time',
|
|
'end_time',
|
|
'logs_deadline',
|
|
'first_check',
|
|
'second_check',
|
|
'unique_qso_check',
|
|
'third_check',
|
|
'fourth_check',
|
|
'prelimitary_results',
|
|
];
|
|
|
|
protected $casts = [
|
|
'contest_id' => 'integer',
|
|
'rule_set_id' => 'integer',
|
|
'preliminary_evaluation_run_id' => 'integer',
|
|
'official_evaluation_run_id' => 'integer',
|
|
'test_evaluation_run_id' => 'integer',
|
|
|
|
'name' => 'array',
|
|
'description' => 'array',
|
|
|
|
'is_active' => 'boolean',
|
|
'is_test' => 'boolean',
|
|
'is_sixhr' => 'boolean',
|
|
|
|
'start_time' => 'datetime',
|
|
'end_time' => 'datetime',
|
|
'logs_deadline' => 'datetime',
|
|
|
|
'first_check' => 'datetime',
|
|
'second_check' => 'datetime',
|
|
'unique_qso_check' => 'datetime',
|
|
'third_check' => 'datetime',
|
|
'fourth_check' => 'datetime',
|
|
'prelimitary_results'=> 'datetime',
|
|
];
|
|
|
|
public function contest(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Contest::class);
|
|
}
|
|
|
|
public function ruleSet(): BelongsTo
|
|
{
|
|
return $this->belongsTo(EvaluationRuleSet::class, 'rule_set_id');
|
|
}
|
|
|
|
public function bands(): BelongsToMany
|
|
{
|
|
return $this->belongsToMany(Band::class, 'rounds_bands', 'round_id', 'band_id');
|
|
}
|
|
|
|
public function categories(): BelongsToMany
|
|
{
|
|
return $this->belongsToMany(Category::class, 'rounds_categories', 'round_id', 'category_id');
|
|
}
|
|
|
|
public function powerCategories(): BelongsToMany
|
|
{
|
|
return $this->belongsToMany(PowerCategory::class, 'rounds_power_categories', 'round_id', 'power_category_id');
|
|
}
|
|
}
|