66 lines
1.3 KiB
PHP
66 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Models\Scopes\SportScope;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Event extends Model
|
|
{
|
|
protected $fillable = [
|
|
'id',
|
|
'provider_id',
|
|
'betsapi_id',
|
|
'betradar_id',
|
|
'bet365_id',
|
|
'_1xbet_id',
|
|
'bwin_id',
|
|
'magnig_id',
|
|
'magken_id',
|
|
'lognig_id',
|
|
'logcol_id',
|
|
'starttime',
|
|
'sport_id',
|
|
'country_id',
|
|
'group_id',
|
|
'competition_group_id',
|
|
'home_id',
|
|
'away_id',
|
|
];
|
|
|
|
protected static function booted(): void
|
|
{
|
|
static::addGlobalScope(new SportScope);
|
|
}
|
|
|
|
public function sport()
|
|
{
|
|
return $this->belongsTo(Sport::class);
|
|
}
|
|
|
|
public function country()
|
|
{
|
|
return $this->belongsTo(Country::class, 'country_id', 'tx_id')->where('disabled', 0)->where('is_country', 1);
|
|
}
|
|
|
|
public function group()
|
|
{
|
|
return $this->belongsTo(Group::class);
|
|
}
|
|
|
|
public function competition_group()
|
|
{
|
|
return $this->belongsTo(CompetitionGroup::class);
|
|
}
|
|
|
|
public function home()
|
|
{
|
|
return $this->belongsTo(Element::class);
|
|
}
|
|
|
|
public function away()
|
|
{
|
|
return $this->belongsTo(Element::class);
|
|
}
|
|
}
|