58 lines
1.1 KiB
PHP
58 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Event extends Model
|
|
{
|
|
protected $fillable = [
|
|
'starttime',
|
|
'sport_id',
|
|
'country_id',
|
|
'group_id',
|
|
'competition_group_id',
|
|
'home_id',
|
|
'away_id',
|
|
'txodds_id',
|
|
'provider_id',
|
|
'betaid_id',
|
|
'betradar_id',
|
|
];
|
|
|
|
public function sport()
|
|
{
|
|
return $this->belongsTo(Sport::class);
|
|
}
|
|
|
|
public function country()
|
|
{
|
|
return $this->belongsTo(Country::class, 'country_id', 'txodds_id');
|
|
}
|
|
|
|
public function group()
|
|
{
|
|
return $this->hasOne(Group::class, 'txodds_id', 'group_id');
|
|
}
|
|
|
|
public function competition_group()
|
|
{
|
|
return $this->hasOne(CompetitionGroup::class, 'txodds_id', 'competition_group_id');
|
|
}
|
|
|
|
public function home()
|
|
{
|
|
return $this->hasOne(Element::class, 'txodds_id', 'home_id');
|
|
}
|
|
|
|
public function away()
|
|
{
|
|
return $this->hasOne(Element::class, 'txodds_id', 'away_id');
|
|
}
|
|
|
|
public function odds_3way()
|
|
{
|
|
return $this->hasMany(Odds3way::class);
|
|
}
|
|
}
|