60 lines
1.1 KiB
PHP
60 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Tables\Columns;
|
|
|
|
use App\Models\OddsGgng;
|
|
use Filament\Tables\Columns\Column;
|
|
|
|
class ColumnGgng extends Column
|
|
{
|
|
protected string $view = 'filament.tables.columns.column-ggng';
|
|
|
|
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 = OddsGgng::with('bookmaker')->where('event_id', $record->id)->get();
|
|
|
|
$this->max['gg'] = $this->data->max('gg');
|
|
|
|
$this->max['ng'] = $this->data->max('ng');
|
|
|
|
$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;
|
|
}
|
|
}
|