85 lines
1.7 KiB
PHP
85 lines
1.7 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use MongoDB\Laravel\Eloquent\Model;
|
|
|
|
class UbEvent extends Model
|
|
{
|
|
protected $connection = 'mongodb';
|
|
|
|
protected $table = 'up_events';
|
|
|
|
protected $fillable = [
|
|
'league_id',
|
|
'home_id',
|
|
'away_id',
|
|
'player_id',
|
|
'starttime',
|
|
'home_away',
|
|
'home_ft',
|
|
'away_ft',
|
|
'home_ht',
|
|
'away_ht',
|
|
'goals',
|
|
'assists',
|
|
'tackles',
|
|
'total_passes',
|
|
'passes_done',
|
|
'total_duels',
|
|
'duels_won',
|
|
'total_ground_duels',
|
|
'ground_duels_won',
|
|
'total_aerial_duels',
|
|
'aerial_duels_won',
|
|
'minutes_played',
|
|
'shots_on_target',
|
|
'shots_off_target',
|
|
'shots_blocked',
|
|
'total_dribble',
|
|
'dribble_done',
|
|
'position',
|
|
'rating',
|
|
'bcm',
|
|
'hw',
|
|
'pw',
|
|
'pm',
|
|
'possession_lost',
|
|
'fouls',
|
|
'was_fouled',
|
|
'offsides',
|
|
'date_acquisition',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'starttime' => 'datetime',
|
|
'date_acquisition' => 'datetime',
|
|
];
|
|
}
|
|
|
|
public function league(): BelongsTo
|
|
{
|
|
return $this->belongsTo(CompetitionGroup::class, 'league_id', 'id');
|
|
}
|
|
|
|
public function home(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Element::class, 'home_id', 'id');
|
|
}
|
|
|
|
public function away(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Element::class, 'away_id', 'id');
|
|
}
|
|
|
|
public function player(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Player::class, 'player_id', 'id');
|
|
}
|
|
}
|