76 lines
1.5 KiB
PHP
76 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Tables\Columns;
|
|
|
|
use Filament\Tables\Columns\Column;
|
|
|
|
class ColumnDnb extends Column
|
|
{
|
|
protected string $view = 'filament.tables.columns.column-dnb';
|
|
|
|
protected ?array $bookmakers;
|
|
|
|
protected $max;
|
|
|
|
protected $min;
|
|
|
|
protected $act;
|
|
|
|
protected ?int $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_dnb);
|
|
|
|
$this->act = $record->odds_dnb->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
|
|
|
|
$this->max['dnb1'] = $record->odds_dnb->max('dnb1');
|
|
|
|
$this->max['dnb2'] = $record->odds_dnb->max('dnb2');
|
|
|
|
$this->min['dnb1'] = $record->odds_dnb->min('dnb1');
|
|
|
|
$this->min['dnb2'] = $record->odds_dnb->min('dnb2');
|
|
|
|
$record->odds_dnb = FilterOdds::filter($record->odds_dnb, $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;
|
|
}
|
|
}
|