71 lines
1.4 KiB
PHP
71 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Tables\Columns;
|
|
|
|
use Filament\Tables\Columns\Column;
|
|
|
|
class ColumnTotalQ1 extends Column
|
|
{
|
|
protected string $view = 'filament.tables.columns.column-total-q1';
|
|
|
|
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_totals_q1) ? true : false;
|
|
|
|
$this->act = $record->odds_totals_q1->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
|
|
|
|
$this->max['over'] = $record->odds_totals_q1->max('over');
|
|
|
|
$this->max['under'] = $record->odds_totals_q1->max('under');
|
|
|
|
$this->min['over'] = $record->odds_totals_q1->min('over');
|
|
|
|
$this->min['under'] = $record->odds_totals_q1->min('under');
|
|
|
|
}
|
|
|
|
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;
|
|
}
|
|
}
|