74 lines
1.4 KiB
PHP
74 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Tables\Columns;
|
|
|
|
use Filament\Tables\Columns\Column;
|
|
|
|
class ColumnDc extends Column
|
|
{
|
|
protected string $view = 'filament.tables.columns.column-dc';
|
|
|
|
protected $max;
|
|
|
|
protected $min;
|
|
|
|
protected $act;
|
|
|
|
protected ?array $bookmakers;
|
|
|
|
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_dc) ? true : false;
|
|
|
|
$this->act = $record->odds_dc->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
|
|
|
|
$this->max['dc1x'] = $record->odds_dc->max('dc1x');
|
|
|
|
$this->max['dc12'] = $record->odds_dc->max('dc12');
|
|
|
|
$this->max['dcx2'] = $record->odds_dc->max('dcx2');
|
|
|
|
$this->min['dc1x'] = $record->odds_dc->min('dc1x');
|
|
|
|
$this->min['dc12'] = $record->odds_dc->min('dc12');
|
|
|
|
$this->min['dcx2'] = $record->odds_dc->min('dcx2');
|
|
}
|
|
|
|
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;
|
|
}
|
|
}
|