35 lines
737 B
PHP
35 lines
737 B
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\HasMany;
|
|
|
|
class MatchRound extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'video_id',
|
|
'round_number',
|
|
'name',
|
|
'start_time_seconds',
|
|
];
|
|
|
|
protected $casts = [
|
|
'start_time_seconds' => 'integer',
|
|
];
|
|
|
|
public function video(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Video::class);
|
|
}
|
|
|
|
public function points(): HasMany
|
|
{
|
|
return $this->hasMany(MatchPoint::class, 'match_round_id')->orderBy('timestamp_seconds');
|
|
}
|
|
}
|