Files
nuhodds_fi4/app/Filament/Tables/Columns/ColumnPoint.php
T
2026-01-09 12:55:18 +01:00

71 lines
1.4 KiB
PHP

<?php
namespace App\Filament\Tables\Columns;
use Filament\Tables\Columns\Column;
class ColumnPoint extends Column
{
protected string $view = 'filament.tables.columns.column-point';
protected ?array $bookmakers;
protected $max;
protected $min;
protected $act;
protected ?bool $has_data;
public function bookmakers(?array $bookmakers): static
{
array_unshift($bookmakers, auth()->user()->bookmaker_id);
$this->bookmakers = $bookmakers;
return $this;
}
public function getBookmaker(): ?array
{
return $this->bookmakers;
}
public function loadData($record)
{
$this->has_data = count($record->odds_points) ? true : false;
$this->act = $record->odds_points->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
$this->max['home'] = $record->odds_points->max('home');
$this->max['away'] = $record->odds_points->max('away');
$this->min['home'] = $record->odds_points->min('home');
$this->min['away'] = $record->odds_points->min('away');
}
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;
}
}