46 lines
857 B
PHP
46 lines
857 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class StatisticFixtures extends Model
|
|
{
|
|
protected $fillable = [
|
|
'sport_id',
|
|
'league_id',
|
|
'home_id',
|
|
'away_id',
|
|
'starttime',
|
|
'exp_home',
|
|
'exp_away',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'starttime' => 'datetime',
|
|
];
|
|
}
|
|
|
|
public function sport()
|
|
{
|
|
return $this->belongsTo(Sport::class)->where('is_active', 1);
|
|
}
|
|
|
|
public function league()
|
|
{
|
|
return $this->belongsTo(CompetitionGroup::class);
|
|
}
|
|
|
|
public function home()
|
|
{
|
|
return $this->belongsTo(SofaScoreRosa::class, 'home_id', 'ss_team_id');
|
|
}
|
|
|
|
public function away()
|
|
{
|
|
return $this->belongsTo(SofaScoreRosa::class, 'away_id', 'ss_team_id');
|
|
}
|
|
}
|