update the match view
This commit is contained in:
1 parent
062c0e896f
commit
69f5df163a
14 files changed
+7331
-743
No files matched your search
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class CoachReview extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'video_id',
|
||||
'user_id',
|
||||
'start_time_seconds',
|
||||
'end_time_seconds',
|
||||
'note',
|
||||
'coach_name',
|
||||
'emoji',
|
||||
];
|
||||
|
||||
public function video(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Video::class);
|
||||
}
|
||||
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class MatchPoint extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'video_id',
|
||||
'match_round_id',
|
||||
'timestamp_seconds',
|
||||
'action',
|
||||
'points',
|
||||
'competitor',
|
||||
'notes',
|
||||
'score_blue',
|
||||
'score_red',
|
||||
];
|
||||
|
||||
public function video(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Video::class);
|
||||
}
|
||||
|
||||
public function round(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(MatchRound::class, 'match_round_id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?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',
|
||||
];
|
||||
|
||||
public function video(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Video::class);
|
||||
}
|
||||
|
||||
public function points(): HasMany
|
||||
{
|
||||
return $this->hasMany(MatchPoint::class, 'match_round_id')->orderBy('timestamp_seconds');
|
||||
}
|
||||
}
|
||||
@@ -246,6 +246,22 @@ class Video extends Model
|
||||
return $this->comments()->count();
|
||||
}
|
||||
|
||||
// Match events relationships
|
||||
public function matchRounds()
|
||||
{
|
||||
return $this->hasMany(MatchRound::class)->orderBy('round_number');
|
||||
}
|
||||
|
||||
public function matchPoints()
|
||||
{
|
||||
return $this->hasMany(MatchPoint::class);
|
||||
}
|
||||
|
||||
public function coachReviews()
|
||||
{
|
||||
return $this->hasMany(CoachReview::class)->orderBy('start_time_seconds');
|
||||
}
|
||||
|
||||
// Get recent views count (within hours)
|
||||
public function getRecentViews($hours = 48)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user