62 lines
1.2 KiB
PHP
62 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Tables\Columns;
|
|
|
|
use App\Models\OddsDc;
|
|
use Filament\Tables\Columns\Column;
|
|
|
|
class ColumnDc extends Column
|
|
{
|
|
protected string $view = 'filament.tables.columns.column-dc';
|
|
|
|
protected ?array $max;
|
|
|
|
protected $data;
|
|
|
|
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 = OddsDc::with('bookmaker')->where('event_id', $record->id)->get();
|
|
|
|
$this->max['dc1x'] = $this->data->max('dc1x');
|
|
|
|
$this->max['dc12'] = $this->data->max('dc12');
|
|
|
|
$this->max['dcx2'] = $this->data->max('dcx2');
|
|
|
|
$this->max['margin'] = $this->data->max('margin');
|
|
|
|
$this->has_data = count($this->data) ? true : false;
|
|
}
|
|
|
|
public function getData()
|
|
{
|
|
return $this->data;
|
|
}
|
|
|
|
public function getMax()
|
|
{
|
|
return $this->max;
|
|
}
|
|
|
|
public function hasData()
|
|
{
|
|
return $this->has_data;
|
|
}
|
|
}
|