70 lines
1.8 KiB
PHP
70 lines
1.8 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;
|
|
|
|
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->multiline = [];
|
|
|
|
// foreach ($multiline_client as $slot => $bookmaker) {
|
|
|
|
// $open = true;
|
|
|
|
// foreach ($this->fumetto as $item) {
|
|
// if ($item['bookmaker_id'] == $bookmaker->bookmaker_id) {
|
|
// $this->multiline[$slot] = $item;
|
|
// $open = false;
|
|
// }
|
|
// }
|
|
// if ($open) {
|
|
// $item = new stdClass;
|
|
// $item['icon'] = $bookmaker->bookmaker->icon;
|
|
// $item['h3w'] = 0;
|
|
// $item['d3w'] = 0;
|
|
// $item['a3w'] = 0;
|
|
// $item['margin'] = 0;
|
|
// $item['bookmaker_id'] = $bookmaker->bookmaker_id;
|
|
// $this->multiline[$slot] = $item;
|
|
// }
|
|
// }
|
|
}
|
|
|
|
public function getMultilines(): ?array
|
|
{
|
|
return $this->multiline;
|
|
}
|
|
|
|
public function getFumetto()
|
|
{
|
|
return $this->fumetto;
|
|
}
|
|
}
|