69 lines
1.3 KiB
PHP
69 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Tables\Columns;
|
|
|
|
use Filament\Tables\Columns\Column;
|
|
|
|
class ColumnTq extends Column
|
|
{
|
|
protected string $view = 'filament.tables.columns.column-tq';
|
|
|
|
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 loadData($record)
|
|
{
|
|
$this->has_data = count($record->odds_tq) ? true : false;
|
|
|
|
$this->act = $record->odds_tq->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
|
|
|
|
$this->max['htq'] = $record->odds_tq->max('htq');
|
|
|
|
$this->max['atq'] = $record->odds_tq->max('atq');
|
|
|
|
$this->min['htq'] = $record->odds_tq->min('htq');
|
|
|
|
$this->min['atq'] = $record->odds_tq->min('atq');
|
|
|
|
}
|
|
|
|
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;
|
|
}
|
|
}
|