Files
nuhodds_fi4/app/Filament/Tables/Columns/ColumnMlS1.php
T
2026-01-21 19:49:28 +01:00

76 lines
1.5 KiB
PHP

<?php
namespace App\Filament\Tables\Columns;
use Filament\Tables\Columns\Column;
class ColumnMlS1 extends Column
{
protected string $view = 'filament.tables.columns.column-ml-s1';
protected ?array $bookmakers;
protected $max;
protected $min;
protected $act;
protected ?bool $has_data;
public function bookmakers(?array $bookmakers): static
{
$this->bookmakers = $bookmakers;
return $this;
}
public function getBookmaker(): ?array
{
return $this->bookmakers['bookmaker'] ?? [];
}
public function getSlots(): ?array
{
return $this->bookmakers['slots'] ?? [];
}
public function loadData($record)
{
$this->has_data = count($record->odds_2ways_s1) ? true : false;
$this->act = $record->odds_2ways->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
$this->max['h2w'] = $record->odds_2ways->max('h2w');
$this->max['a2w'] = $record->odds_2ways->max('a2w');
$this->min['h2w'] = $record->odds_2ways->min('h2w');
$this->min['a2w'] = $record->odds_2ways->min('a2w');
$record->odds_2ways_s1 = FilterOdds::filter($record->odds_2ways_s1, $this->bookmakers);
}
public function getAct()
{
return $this->act;
}
public function getMax()
{
return $this->max;
}
public function getMin()
{
return $this->min;
}
public function hasData()
{
return $this->has_data;
}
}