55 lines
1.1 KiB
PHP
55 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Tables\Columns;
|
|
|
|
use App\Models\Odds3way;
|
|
use Filament\Tables\Columns\Column;
|
|
|
|
class Columns3way extends Column
|
|
{
|
|
protected string $view = 'filament.tables.columns.columns_3way';
|
|
|
|
protected ?array $multiline;
|
|
|
|
protected ?array $fumetto;
|
|
|
|
protected ?bool $has_odds;
|
|
|
|
public function loadData($record, $multiline_client)
|
|
{
|
|
|
|
$res = Odds3way::with('bookmaker')->where('event_id', $record->id)->get();
|
|
|
|
$this->fumetto = [];
|
|
|
|
$this->multiline = [];
|
|
|
|
foreach ($res as $item) {
|
|
|
|
$this->fumetto[] = $item;
|
|
foreach ($multiline_client as $slot => $bookmaker) {
|
|
if ($item->bookmaker_id == $bookmaker->bookmaker_id) {
|
|
$this->multiline[$slot] = $item;
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->has_odds = count($this->multiline) ? true : false;
|
|
}
|
|
|
|
public function getMultilines(): ?array
|
|
{
|
|
return $this->multiline;
|
|
}
|
|
|
|
public function getFumetto()
|
|
{
|
|
return $this->fumetto;
|
|
}
|
|
|
|
public function hasodds()
|
|
{
|
|
return $this->has_odds;
|
|
}
|
|
}
|