73 lines
1.5 KiB
PHP
73 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Tables\Columns;
|
|
|
|
use App\Models\Odds3way;
|
|
use Filament\Tables\Columns\Column;
|
|
|
|
class Column3way extends Column
|
|
{
|
|
protected string $view = 'filament.tables.columns.column_3way';
|
|
|
|
protected $data;
|
|
|
|
protected ?array $max;
|
|
|
|
protected ?array $min;
|
|
|
|
protected ?array $bookmakers;
|
|
|
|
protected ?bool $has_data;
|
|
|
|
public function bookmakers(?array $bookmakers): static
|
|
{
|
|
$this->bookmakers = $bookmakers;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getBookmaker(): ?array
|
|
{
|
|
return $this->bookmakers;
|
|
}
|
|
|
|
public function loadData($record)
|
|
{
|
|
$this->data = Odds3way::with('bookmaker')->where('event_id', $record->id)->get();
|
|
|
|
$this->max['h3w'] = $this->data->max('h3w');
|
|
$this->min['h3w'] = $this->data->min('h3w');
|
|
|
|
$this->max['d3w'] = $this->data->max('d3w');
|
|
$this->min['d3w'] = $this->data->min('d3w');
|
|
|
|
$this->max['a3w'] = $this->data->max('a3w');
|
|
$this->min['a3w'] = $this->data->min('a3w');
|
|
|
|
$this->max['margin'] = $this->data->max('margin');
|
|
$this->min['margin'] = $this->data->min('margin');
|
|
|
|
$this->has_data = count($this->data) ? true : false;
|
|
}
|
|
|
|
public function getData()
|
|
{
|
|
return $this->data;
|
|
}
|
|
|
|
public function getMax()
|
|
{
|
|
return $this->max;
|
|
}
|
|
|
|
public function getMin()
|
|
{
|
|
return $this->min;
|
|
}
|
|
|
|
public function hasData()
|
|
{
|
|
return $this->has_data;
|
|
}
|
|
}
|