93 lines
2.2 KiB
PHP
93 lines
2.2 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\HasOne;
|
|
|
|
class QsoResult extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $table = 'qso_results';
|
|
|
|
protected $fillable = [
|
|
'evaluation_run_id',
|
|
'log_qso_id',
|
|
|
|
'is_valid',
|
|
'is_duplicate',
|
|
'is_nil',
|
|
'is_busted_call',
|
|
'is_busted_rst',
|
|
'is_busted_exchange',
|
|
'is_time_out_of_window',
|
|
'is_operating_window_excluded',
|
|
|
|
'points',
|
|
'penalty_points',
|
|
'distance_km',
|
|
'time_diff_sec',
|
|
|
|
'wwl',
|
|
'dxcc',
|
|
'country',
|
|
'section',
|
|
|
|
'matched_qso_id',
|
|
'matched_log_qso_id',
|
|
|
|
'match_type',
|
|
'match_confidence',
|
|
'error_flags',
|
|
'error_code',
|
|
'error_side',
|
|
'error_detail',
|
|
];
|
|
|
|
protected $casts = [
|
|
'evaluation_run_id' => 'integer',
|
|
'log_qso_id' => 'integer',
|
|
|
|
'is_valid' => 'boolean',
|
|
'is_duplicate' => 'boolean',
|
|
'is_nil' => 'boolean',
|
|
'is_busted_call' => 'boolean',
|
|
'is_busted_rst' => 'boolean',
|
|
'is_busted_exchange' => 'boolean',
|
|
'is_time_out_of_window' => 'boolean',
|
|
'is_operating_window_excluded' => 'boolean',
|
|
|
|
'points' => 'integer',
|
|
'penalty_points' => 'integer',
|
|
'distance_km' => 'float',
|
|
'time_diff_sec' => 'integer',
|
|
|
|
'matched_qso_id' => 'integer',
|
|
'matched_log_qso_id' => 'integer',
|
|
'error_flags' => 'array',
|
|
];
|
|
|
|
public function evaluationRun(): BelongsTo
|
|
{
|
|
return $this->belongsTo(EvaluationRun::class);
|
|
}
|
|
|
|
public function logQso(): BelongsTo
|
|
{
|
|
return $this->belongsTo(LogQso::class);
|
|
}
|
|
|
|
public function matchedQso(): BelongsTo
|
|
{
|
|
return $this->belongsTo(LogQso::class, 'matched_qso_id');
|
|
}
|
|
|
|
public function workingQso(): HasOne
|
|
{
|
|
return $this->hasOne(WorkingQso::class, 'log_qso_id', 'log_qso_id');
|
|
}
|
|
}
|