Files
nuhodds_fi4/app/Filament/Tables/Columns/ColumnMl.php
T
2026-01-11 09:09:16 +01:00

95 lines
2.0 KiB
PHP

<?php
namespace App\Filament\Tables\Columns;
use App\Models\BookmakerSport;
use Filament\Tables\Columns\Column;
class ColumnMl extends Column
{
protected string $view = 'filament.tables.columns.column-ml';
protected ?array $bookmakers;
protected $max;
protected $min;
protected $act;
protected $having;
protected ?bool $has_data;
public function bookmakers(?array $bookmakers): static
{
array_unshift($bookmakers, auth()->user()->bookmaker_id);
$this->bookmakers = $bookmakers;
return $this;
}
public function setMC($slot, $bookmaker_id)
{
// MultilineClient::where('sport_id', auth()->user()->sport_id)
// ->where('position', $position)
// ->where('multiline_setting_id', 22)
// ->update(['bookmaker_id' => $bookmaker_id]);
}
public function getBookmaker(): ?array
{
return $this->bookmakers;
}
public function getActivBookmaker()
{
return BookmakerSport::with('bookmaker')
->whereNotIn('bookmaker_id', $this->having)
->where('sport_id', auth()->user()->sport_id)
->get();
}
public function loadData($record)
{
$this->has_data = count($record->odds_2ways) ? true : false;
$this->act = $record->odds_2ways->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
$this->max['h2w'] = $record->odds_2ways->max('h2w');
$this->max['a2w'] = $record->odds_2ways->max('a2w');
$this->min['h2w'] = $record->odds_2ways->min('h2w');
$this->min['a2w'] = $record->odds_2ways->min('a2w');
}
public function setHaving($bkmid)
{
return $this->having[] = $bkmid;
}
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;
}
}