This commit is contained in:
salam committed 2026-01-25 08:45:42 +01:00
1 parent da7d4092ac
commit 0cf815c00f
39 files changed
+582 -1760

No files matched your search

@@ -1,78 +0,0 @@
<?php
namespace App\Filament\Tables\Columns;
use Filament\Tables\Columns\Column;
class Column3way extends Column
{
protected string $view = 'filament.tables.columns.column_3way';
protected ?array $bookmakers;
protected $max;
protected $min;
protected $act;
protected ?int $has_data;
public function bookmakers(?array $bookmakers): static
{
$this->bookmakers = $bookmakers;
return $this;
}
public function getBookmaker(): ?array
{
return $this->bookmakers['bookmaker'] ?? [];
}
public function getSlots(): ?array
{
return $this->bookmakers['slots'] ?? [];
}
public function loadData($record)
{
$this->has_data = count($record->odds_3ways);
$this->act = $record->odds_3ways->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
$this->max['h3w'] = $record->odds_3ways->max('h3w');
$this->max['d3w'] = $record->odds_3ways->max('d3w');
$this->max['a3w'] = $record->odds_3ways->max('a3w');
$this->min['h3w'] = $record->odds_3ways->min('h3w');
$this->min['d3w'] = $record->odds_3ways->min('d3w');
$this->min['a3w'] = $record->odds_3ways->min('a3w');
$record->odds_3ways = FilterOdds::filter($record->odds_3ways, $this->bookmakers);
}
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;
}
}
@@ -1,78 +0,0 @@
<?php
namespace App\Filament\Tables\Columns;
use Filament\Tables\Columns\Column;
class Column3wayHt extends Column
{
protected string $view = 'filament.tables.columns.column_3way_ht';
protected ?array $bookmakers;
protected $max;
protected $min;
protected $act;
protected ?int $has_data;
public function bookmakers(?array $bookmakers): static
{
$this->bookmakers = $bookmakers;
return $this;
}
public function getBookmaker(): ?array
{
return $this->bookmakers['bookmaker'] ?? [];
}
public function getSlots(): ?array
{
return $this->bookmakers['slots'] ?? [];
}
public function loadData($record)
{
$this->has_data = count($record->odds_3ways_ht);
$this->act = $record->odds_3ways_ht->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
$this->max['h3w'] = $record->odds_3ways_ht->max('h3w');
$this->max['d3w'] = $record->odds_3ways_ht->max('d3w');
$this->max['a3w'] = $record->odds_3ways_ht->max('a3w');
$this->min['h3w'] = $record->odds_3ways_ht->min('h3w');
$this->min['d3w'] = $record->odds_3ways_ht->min('d3w');
$this->min['a3w'] = $record->odds_3ways_ht->min('a3w');
$record->odds_3ways_ht = FilterOdds::filter($record->odds_3ways_ht, $this->bookmakers);
}
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;
}
}
-78
View File
@@ -1,78 +0,0 @@
<?php
namespace App\Filament\Tables\Columns;
use Filament\Tables\Columns\Column;
class ColumnDc extends Column
{
protected string $view = 'filament.tables.columns.column-dc';
protected $max;
protected $min;
protected $act;
protected ?array $bookmakers;
protected ?int $has_data;
public function bookmakers(?array $bookmakers): static
{
$this->bookmakers = $bookmakers;
return $this;
}
public function getBookmaker(): ?array
{
return $this->bookmakers['bookmaker'] ?? [];
}
public function getSlots(): ?array
{
return $this->bookmakers['slots'] ?? [];
}
public function loadData($record)
{
$this->has_data = count($record->odds_dc);
$this->act = $record->odds_dc->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
$this->max['dc1x'] = $record->odds_dc->max('dc1x');
$this->max['dc12'] = $record->odds_dc->max('dc12');
$this->max['dcx2'] = $record->odds_dc->max('dcx2');
$this->min['dc1x'] = $record->odds_dc->min('dc1x');
$this->min['dc12'] = $record->odds_dc->min('dc12');
$this->min['dcx2'] = $record->odds_dc->min('dcx2');
$record->odds_dc = FilterOdds::filter($record->odds_dc, $this->bookmakers);
}
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;
}
}
-75
View File
@@ -1,75 +0,0 @@
<?php
namespace App\Filament\Tables\Columns;
use Filament\Tables\Columns\Column;
class ColumnDnb extends Column
{
protected string $view = 'filament.tables.columns.column-dnb';
protected ?array $bookmakers;
protected $max;
protected $min;
protected $act;
protected ?int $has_data;
public function bookmakers(?array $bookmakers): static
{
$this->bookmakers = $bookmakers;
return $this;
}
public function getBookmaker(): ?array
{
return $this->bookmakers['bookmaker'] ?? [];
}
public function getSlots(): ?array
{
return $this->bookmakers['slots'] ?? [];
}
public function loadData($record)
{
$this->has_data = count($record->odds_dnb);
$this->act = $record->odds_dnb->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
$this->max['dnb1'] = $record->odds_dnb->max('dnb1');
$this->max['dnb2'] = $record->odds_dnb->max('dnb2');
$this->min['dnb1'] = $record->odds_dnb->min('dnb1');
$this->min['dnb2'] = $record->odds_dnb->min('dnb2');
$record->odds_dnb = FilterOdds::filter($record->odds_dnb, $this->bookmakers);
}
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;
}
}
@@ -1,74 +0,0 @@
<?php
namespace App\Filament\Tables\Columns;
use Filament\Tables\Columns\Column;
class ColumnGgng extends Column
{
protected string $view = 'filament.tables.columns.column-ggng';
protected ?array $bookmakers;
protected $max;
protected $min;
protected $act;
protected ?int $has_data;
public function bookmakers(?array $bookmakers): static
{
$this->bookmakers = $bookmakers;
return $this;
}
public function getBookmaker(): ?array
{
return $this->bookmakers['bookmaker'] ?? [];
}
public function getSlots(): ?array
{
return $this->bookmakers['slots'] ?? [];
}
public function loadData($record)
{
$this->has_data = count($record->odds_ggng);
$this->act = $record->odds_ggng->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
$this->max['gg'] = $record->odds_ggng->max('gg');
$this->max['ng'] = $record->odds_ggng->max('ng');
$this->min['gg'] = $record->odds_ggng->min('gg');
$this->min['ng'] = $record->odds_ggng->min('ng');
$record->odds_ggng = FilterOdds::filter($record->odds_ggng, $this->bookmakers);
}
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;
}
}
-74
View File
@@ -1,74 +0,0 @@
<?php
namespace App\Filament\Tables\Columns;
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 ?int $has_data;
public function bookmakers(?array $bookmakers): static
{
$this->bookmakers = $bookmakers;
return $this;
}
public function getBookmaker(): ?array
{
return $this->bookmakers['bookmaker'] ?? [];
}
public function getSlots(): ?array
{
return $this->bookmakers['slots'] ?? [];
}
public function loadData($record)
{
$this->has_data = count($record->odds_2ways);
$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');
$record->odds_2ways = FilterOdds::filter($record->odds_2ways, $this->bookmakers);
}
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;
}
}
@@ -1,75 +0,0 @@
<?php
namespace App\Filament\Tables\Columns;
use Filament\Tables\Columns\Column;
class ColumnMlS1 extends Column
{
protected string $view = 'filament.tables.columns.column-ml-s1';
protected ?array $bookmakers;
protected $max;
protected $min;
protected $act;
protected ?int $has_data;
public function bookmakers(?array $bookmakers): static
{
$this->bookmakers = $bookmakers;
return $this;
}
public function getBookmaker(): ?array
{
return $this->bookmakers['bookmaker'] ?? [];
}
public function getSlots(): ?array
{
return $this->bookmakers['slots'] ?? [];
}
public function loadData($record)
{
$this->has_data = count($record->odds_2ways_s1);
$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');
$record->odds_2ways_s1 = FilterOdds::filter($record->odds_2ways_s1, $this->bookmakers);
}
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;
}
}
+290
View File
@@ -0,0 +1,290 @@
<?php
namespace App\Filament\Tables\Columns;
use App\Filament\Resources\Events\Tables\EventsTable;
use Filament\Tables\Columns\Column;
class ColumnOdds extends Column
{
protected string $view = 'filament.tables.columns.column-odds';
public $data;
protected ?array $filter;
protected ?array $slots;
protected $bettype;
protected $columns;
protected $client;
protected ?array $odds_labels;
protected ?int $has_data;
public function loadData($record)
{
// $this->setMinMax($record);
$this->setSlots();
$this->getData($record);
if (! $this->data) {
$this->has_data = 0;
return;
}
$this->has_data = count($this->data);
$order = EventsTable::$slots ?? [];
$this->data->sortBy(function ($model) use ($order) {
return array_search($model->bookmaker_id, $order);
});
return $this->data;
}
public function bettype(string $bettype): static
{
$this->bettype = $bettype;
return $this;
}
public function getBettype()
{
return $this->bettype;
}
public function getColumns()
{
return $this->columns;
}
public function setSlots(): void
{
$this->slots = EventsTable::$slots[$this->bettype];
}
public function getSlots(): ?array
{
return $this->slots;
}
public function hasData()
{
return $this->has_data;
}
public function getClient()
{
return $this->client;
}
public function getMax()
{
return $this->max;
}
public function getMin()
{
return $this->min;
}
public function getData($record)
{
switch ($this->bettype) {
case 'odds_2ways':
$this->data = $record->odds_2ways;
$this->client = $record->odds_2ways->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
break;
case 'odds_2ways_s1':
$this->data = $record->odds_2ways_s1;
$this->client = $record->odds_2ways_s1->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
break;
case 'odds_3ways':
$this->data = $record->odds_3ways;
$this->client = $record->odds_3ways->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
break;
case 'odds_3ways_ht':
$this->data = $record->odds_3ways_ht;
$this->client = $record->odds_3ways_ht->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
break;
case 'odds_dc':
$this->data = $record->odds_dc;
$this->client = $record->odds_dc->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
break;
case 'odds_dnb':
$this->data = $record->odds_dnb;
$this->client = $record->odds_dnb->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
break;
case 'odds_ggng':
$this->data = $record->odds_ggng;
$this->client = $record->odds_ggng->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
break;
case 'odds_points':
$this->data = $record->odds_points;
$this->client = $record->odds_points->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
break;
case 'odds_points_ht':
$this->data = $record->odds_points_ht;
$this->client = $record->odds_points_ht->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
break;
case 'odds_points_q1':
$this->data = $record->odds_points_q1;
$this->client = $record->odds_points_q1->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
break;
case 'odds_totals':
$this->data = $record->odds_totals;
$this->client = $record->odds_totals->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
break;
case 'odds_totals_ht':
$this->data = $record->odds_totals_ht;
$this->client = $record->odds_totals_ht->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
break;
case 'odds_totals_q1':
$this->data = $record->odds_totals_q1;
$this->client = $record->odds_totals_q1->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
break;
case 'odds_tq':
$this->data = $record->odds_tq;
$this->client = $record->odds_tq->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
break;
}
}
public function getOddsLabels()
{
switch ($this->bettype) {
case 'odds_tq':
case 'odds_2ways':
case 'odds_2ways_s1':
case 'odds_dnb':
$this->columns = 2;
$this->odds_labels = ['1', '2'];
break;
case 'odds_3ways':
case 'odds_3ways_ht':
$this->columns = 3;
$this->odds_labels = ['1', 'X', '2'];
break;
case 'odds_dc':
$this->columns = 3;
$this->odds_labels = ['1X', '12', 'X2'];
break;
case 'odds_ggng':
$this->columns = 2;
$this->odds_labels = ['GG', 'NG'];
break;
case 'odds_points':
case 'odds_points_ht':
case 'odds_points_q1':
$this->columns = 3;
$this->odds_labels = ['H', 'A', 'HC'];
break;
case 'odds_totals':
case 'odds_totals_ht':
case 'odds_totals_q1':
$this->columns = 3;
$this->odds_labels = ['O', 'U', 'T'];
break;
}
return $this->odds_labels;
}
public function setMinMax($record)
{
switch ($this->bettype) {
case 'odds_2ways':
case 'odds_2ways_s1':
$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['h2w'] = $record->odds_2ways->min('h2w');
break;
case 'odds_3ways':
case 'odds_3ways_ht':
$this->max['h3w'] = $record->odds_3ways_ht->max('h3w');
$this->max['d3w'] = $record->odds_3ways_ht->max('d3w');
$this->max['a3w'] = $record->odds_3ways_ht->max('a3w');
$this->min['h3w'] = $record->odds_3ways_ht->min('h3w');
$this->min['d3w'] = $record->odds_3ways_ht->min('d3w');
$this->min['a3w'] = $record->odds_3ways_ht->min('a3w');
break;
case 'odds_dc':
$this->max['dc1x'] = $record->odds_dc->max('dc1x');
$this->max['dc12'] = $record->odds_dc->max('dc12');
$this->max['dcx2'] = $record->odds_dc->max('dcx2');
$this->min['dc1x'] = $record->odds_dc->min('dc1x');
$this->min['dc12'] = $record->odds_dc->min('dc12');
$this->min['dcx2'] = $record->odds_dc->min('dcx2');
break;
case 'odds_dnb':
$this->max['dnb1'] = $record->odds_dnb->max('dnb1');
$this->max['dnb2'] = $record->odds_dnb->max('dnb2');
$this->min['dnb1'] = $record->odds_dnb->min('dnb1');
$this->min['dnb2'] = $record->odds_dnb->min('dnb2');
break;
case 'odds_ggng':
$this->max['gg'] = $record->odds_ggng->max('gg');
$this->max['ng'] = $record->odds_ggng->max('ng');
$this->min['gg'] = $record->odds_ggng->min('gg');
$this->min['ng'] = $record->odds_ggng->min('ng');
break;
case 'odds_points':
case 'odds_points_ht':
case 'odds_points_q1':
$this->max['home'] = $record->odds_points->max('home');
$this->max['away'] = $record->odds_points->max('away');
$this->min['home'] = $record->odds_points->min('home');
$this->min['away'] = $record->odds_points->min('away');
break;
case 'odds_totals':
case 'odds_totals_ht':
case 'odds_totals_q1':
$this->max['over'] = $record->odds_totals->max('over');
$this->max['under'] = $record->odds_totals->max('under');
$this->min['over'] = $record->odds_totals->min('over');
$this->min['under'] = $record->odds_totals->min('under');
break;
case 'odds_tq':
$this->max['htq'] = $record->odds_tq->max('htq');
$this->max['atq'] = $record->odds_tq->max('atq');
$this->min['htq'] = $record->odds_tq->min('htq');
$this->min['atq'] = $record->odds_tq->min('atq');
break;
}
}
}
@@ -1,75 +0,0 @@
<?php
namespace App\Filament\Tables\Columns;
use Filament\Tables\Columns\Column;
class ColumnPoint extends Column
{
protected string $view = 'filament.tables.columns.column-point';
protected ?array $bookmakers;
protected $max;
protected $min;
protected $act;
protected ?int $has_data;
public function bookmakers(?array $bookmakers): static
{
$this->bookmakers = $bookmakers;
return $this;
}
public function getBookmaker(): ?array
{
return $this->bookmakers['bookmaker'] ?? [];
}
public function getSlots(): ?array
{
return $this->bookmakers['slots'] ?? [];
}
public function loadData($record)
{
$this->has_data = count($record->odds_points);
$this->act = $record->odds_points->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
$this->max['home'] = $record->odds_points->max('home');
$this->max['away'] = $record->odds_points->max('away');
$this->min['home'] = $record->odds_points->min('home');
$this->min['away'] = $record->odds_points->min('away');
$record->odds_points = FilterOdds::filter($record->odds_points, $this->bookmakers);
}
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;
}
}
@@ -1,75 +0,0 @@
<?php
namespace App\Filament\Tables\Columns;
use Filament\Tables\Columns\Column;
class ColumnPointQ1 extends Column
{
protected string $view = 'filament.tables.columns.column-point-q1';
protected ?array $bookmakers;
protected $max;
protected $min;
protected $act;
protected ?int $has_data;
public function bookmakers(?array $bookmakers): static
{
$this->bookmakers = $bookmakers;
return $this;
}
public function getBookmaker(): ?array
{
return $this->bookmakers['bookmaker'] ?? [];
}
public function getSlots(): ?array
{
return $this->bookmakers['slots'] ?? [];
}
public function loadData($record)
{
$this->has_data = count($record->odds_points_q1);
$this->act = $record->odds_points_q1->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
$this->max['home'] = $record->odds_points_q1->max('home');
$this->max['away'] = $record->odds_points_q1->max('away');
$this->min['home'] = $record->odds_points_q1->min('home');
$this->min['away'] = $record->odds_points_q1->min('away');
$record->odds_points_q1 = FilterOdds::filter($record->odds_points_q1, $this->bookmakers);
}
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;
}
}
@@ -1,75 +0,0 @@
<?php
namespace App\Filament\Tables\Columns;
use Filament\Tables\Columns\Column;
class ColumnTotal extends Column
{
protected string $view = 'filament.tables.columns.column-total';
protected ?array $bookmakers;
protected $max;
protected $min;
protected $act;
protected ?int $has_data;
public function bookmakers(?array $bookmakers): static
{
$this->bookmakers = $bookmakers;
return $this;
}
public function getBookmaker(): ?array
{
return $this->bookmakers['bookmaker'] ?? [];
}
public function getSlots(): ?array
{
return $this->bookmakers['slots'] ?? [];
}
public function loadData($record)
{
$this->has_data = count($record->odds_totals);
$this->act = $record->odds_totals->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
$this->max['over'] = $record->odds_totals->max('over');
$this->max['under'] = $record->odds_totals->max('under');
$this->min['over'] = $record->odds_totals->min('over');
$this->min['under'] = $record->odds_totals->min('under');
$record->odds_totals = FilterOdds::filter($record->odds_totals, $this->bookmakers);
}
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;
}
}
@@ -1,75 +0,0 @@
<?php
namespace App\Filament\Tables\Columns;
use Filament\Tables\Columns\Column;
class ColumnTotalHt extends Column
{
protected string $view = 'filament.tables.columns.column-total-ht';
protected ?array $bookmakers;
protected $max;
protected $min;
protected $act;
protected ?int $has_data;
public function bookmakers(?array $bookmakers): static
{
$this->bookmakers = $bookmakers;
return $this;
}
public function getBookmaker(): ?array
{
return $this->bookmakers['bookmaker'] ?? [];
}
public function getSlots(): ?array
{
return $this->bookmakers['slots'] ?? [];
}
public function loadData($record)
{
$this->has_data = count($record->odds_totals_ht);
$this->act = $record->odds_totals_ht->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
$this->max['over'] = $record->odds_totals_ht->max('over');
$this->max['under'] = $record->odds_totals_ht->max('under');
$this->min['over'] = $record->odds_totals_ht->min('over');
$this->min['under'] = $record->odds_totals_ht->min('under');
$record->odds_totals_ht = FilterOdds::filter($record->odds_totals_ht, $this->bookmakers);
}
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;
}
}
@@ -1,75 +0,0 @@
<?php
namespace App\Filament\Tables\Columns;
use Filament\Tables\Columns\Column;
class ColumnTotalQ1 extends Column
{
protected string $view = 'filament.tables.columns.column-total-q1';
protected ?array $bookmakers;
protected $max;
protected $min;
protected $act;
protected ?int $has_data;
public function bookmakers(?array $bookmakers): static
{
$this->bookmakers = $bookmakers;
return $this;
}
public function getBookmaker(): ?array
{
return $this->bookmakers['bookmaker'] ?? [];
}
public function getSlots(): ?array
{
return $this->bookmakers['slots'] ?? [];
}
public function loadData($record)
{
$this->has_data = count($record->odds_totals_q1);
$this->act = $record->odds_totals_q1->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
$this->max['over'] = $record->odds_totals_q1->max('over');
$this->max['under'] = $record->odds_totals_q1->max('under');
$this->min['over'] = $record->odds_totals_q1->min('over');
$this->min['under'] = $record->odds_totals_q1->min('under');
$record->odds_totals_q1 = FilterOdds::filter($record->odds_totals_q1, $this->bookmakers);
}
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;
}
}
-75
View File
@@ -1,75 +0,0 @@
<?php
namespace App\Filament\Tables\Columns;
use Filament\Tables\Columns\Column;
class ColumnTq extends Column
{
protected string $view = 'filament.tables.columns.column-tq';
protected ?array $bookmakers;
protected $max;
protected $min;
protected $act;
protected ?int $has_data;
public function bookmakers(?array $bookmakers): static
{
$this->bookmakers = $bookmakers;
return $this;
}
public function getBookmaker(): ?array
{
return $this->bookmakers['bookmaker'] ?? [];
}
public function getSlots(): ?array
{
return $this->bookmakers['slots'] ?? [];
}
public function loadData($record)
{
$this->has_data = count($record->odds_tq);
$this->act = $record->odds_tq->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
$this->max['htq'] = $record->odds_tq->max('htq');
$this->max['atq'] = $record->odds_tq->max('atq');
$this->min['htq'] = $record->odds_tq->min('htq');
$this->min['atq'] = $record->odds_tq->min('atq');
$record->odds_tq = FilterOdds::filter($record->odds_tq, $this->bookmakers);
}
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;
}
}
+30 -35
View File
@@ -2,12 +2,13 @@
namespace App\Filament\Tables\Columns;
namespace App\Filament\Tables\Columns;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Collection;
class FilterOdds
{
public static function filter($data, $bookmakers): Collection
public static function filter(&$bookmakers)
{
if (auth()->user()->is_multiline_direct) {
/**
@@ -15,43 +16,37 @@ class FilterOdds
*/
$order = $bookmakers['bookmaker'] ?? [];
$data->sortBy(function ($model) use ($order) {
ColumnOdds::$data->sortBy(function ($model) use ($order) {
return array_search($model->bookmaker_id, $order);
});
/**
* FILTER
*/
// if (! auth()->user()->no_filter) {
// $filter = $bookmakers['filter'] ?? [];
// if ($filter) {
// $data = $data->filter(function ($model) use ($filter) {
// if ($model->bookmaker_id == auth()->user()->bookmaker_id) {
// return true;
// }
// $filter = $filter[$model->bookmaker_id] ?? 0;
// $checked_at = Carbon::createFromDate($model->checked_at)->timestamp;
// if (! isset($filter['margin'])) {
// Bookmakers::updateOrCreate(['id' => (int) $model->bookmaker_id], ['need_check' => 1]);
// }
// if ($model->margin <= $filter['margin'] && $checked_at > time() - $filter['time_lastcheck']) {
// return true;
// }
// return false;
// });
// }
// }
}
return $data;
/**
* SET SLOT
*/
// $filter = $bookmakers['filter'] ?? [];
// if ($filter) {
// $data = $data->filter(function ($model) use ($filter) {
// if ($model->bookmaker_id == auth()->user()->bookmaker_id) {
// return true;
// }
// $filter = $filter[$model->bookmaker_id] ?? 0;
// $checked_at = Carbon::createFromDate($model->checked_at)->timestamp;
// if (! isset($filter['margin'])) {
// Bookmakers::updateOrCreate(['id' => (int) $model->bookmaker_id], ['need_check' => 1]);
// }
// if ($model->margin <= $filter['margin'] && $checked_at > time() - $filter['time_lastcheck']) {
// return true;
// }
// return false;
// });
// }
}
}
+3 -1
View File
@@ -164,7 +164,9 @@ class TooltipOdds extends Column
public function getOdd($odd, $name)
{
if ($odd == $this->max[$name]) {
if (in_array($name, ['handicap', 'total'])) {
$str = '<div class="mb-0.5 ml-0.5">';
} elseif ($odd == $this->max[$name]) {
$str = '<div class="mb-0.5 ml-0.5 bg-green-600/25 rounded shadow">';
} elseif ($odd == $this->min[$name]) {
$str = '<div class="mb-0.5 ml-0.5 bg-blue-600/25 rounded shadow">';