db and query optimization compl
This commit is contained in:
1 parent
9d2a8ce628
commit
40d97327d4
24 files changed
+145
-126
No files matched your search
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Filament\Tables\Columns;
|
||||
|
||||
use App\Models\OddsTotal;
|
||||
use Filament\Tables\Columns\Column;
|
||||
|
||||
class ColumnTotal extends Column
|
||||
@@ -13,8 +12,6 @@ class ColumnTotal extends Column
|
||||
|
||||
protected ?array $min;
|
||||
|
||||
protected $data;
|
||||
|
||||
protected ?array $bookmakers;
|
||||
|
||||
protected ?bool $has_data;
|
||||
@@ -33,23 +30,16 @@ class ColumnTotal extends Column
|
||||
|
||||
public function loadData($record)
|
||||
{
|
||||
$this->data = OddsTotal::with('bookmaker')->where('event_id', $record->id)->get();
|
||||
$this->max['over'] = $record->odds_total->max('over');
|
||||
$this->min['over'] = $record->odds_total->min('over');
|
||||
|
||||
$this->max['over'] = $this->data->max('over');
|
||||
$this->min['over'] = $this->data->min('over');
|
||||
$this->max['under'] = $record->odds_total->max('under');
|
||||
$this->min['under'] = $record->odds_total->min('under');
|
||||
|
||||
$this->max['under'] = $this->data->max('under');
|
||||
$this->min['under'] = $this->data->min('under');
|
||||
$this->max['margin'] = $record->odds_total->max('margin');
|
||||
$this->min['margin'] = $record->odds_total->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_total) ? true : false;
|
||||
}
|
||||
|
||||
public function getMax()
|
||||
|
||||
Reference in new issue
Block a user