db and query optimization compl

This commit is contained in:
salam committed 2026-01-04 06:29:11 +01:00
1 parent 9d2a8ce628
commit 40d97327d4
24 files changed
+145 -126

No files matched your search

+9 -19
View File
@@ -2,7 +2,6 @@
namespace App\Filament\Tables\Columns;
use App\Models\OddsDc;
use Filament\Tables\Columns\Column;
class ColumnDc extends Column
@@ -13,8 +12,6 @@ class ColumnDc extends Column
protected ?array $min;
protected $data;
protected ?array $bookmakers;
protected ?bool $has_data;
@@ -33,26 +30,19 @@ class ColumnDc extends Column
public function loadData($record)
{
$this->data = OddsDc::with('bookmaker')->where('event_id', $record->id)->get();
$this->max['dc1x'] = $record->odds_dc->max('dc1x');
$this->min['dc1x'] = $record->odds_dc->min('dc1x');
$this->max['dc1x'] = $this->data->max('dc1x');
$this->min['dc1x'] = $this->data->min('dc1x');
$this->max['dc12'] = $record->odds_dc->max('dc12');
$this->min['dc12'] = $record->odds_dc->min('dc12');
$this->max['dc12'] = $this->data->max('dc12');
$this->min['dc12'] = $this->data->min('dc12');
$this->max['dcx2'] = $record->odds_dc->max('dcx2');
$this->min['dcx2'] = $record->odds_dc->min('dcx2');
$this->max['dcx2'] = $this->data->max('dcx2');
$this->min['dcx2'] = $this->data->min('dcx2');
$this->max['margin'] = $record->odds_dc->max('margin');
$this->min['margin'] = $record->odds_dc->min('margin');
$this->max['margin'] = $this->data->max('margin');
$this->min['margin'] = $this->data->min('margin');
$this->has_data = count($this->data) ? true : false;
}
public function getData()
{
return $this->data;
$this->has_data = count($record->odds_dc) ? true : false;
}
public function getMax()