filter comparatore wip
This commit is contained in:
1 parent
7a9eeb8aad
commit
937c5908d2
40 files changed
+362
-306
No files matched your search
@@ -69,7 +69,6 @@ class EventResource extends Resource
|
||||
}
|
||||
if (in_array('odds_3ways', EventsTable::$bettype_settings)) {
|
||||
$query->with('odds_3ways.bookmaker');
|
||||
// $query->with('odds_3ways.comparing_bookmaker');
|
||||
}
|
||||
if (in_array('odds_3ways_ht', EventsTable::$bettype_settings)) {
|
||||
$query->with('odds_3ways_ht.bookmaker');
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Filament\Resources\Events\Tables;
|
||||
|
||||
use App\Filament\Resources\Events\Tables\Tools\LoadBettypeSettings;
|
||||
use App\Filament\Resources\Events\Tables\Tools\LoadMultilineBookmaker;
|
||||
use App\Filament\Tables\Columns\Column3way;
|
||||
use App\Filament\Tables\Columns\Column3wayHt;
|
||||
use App\Filament\Tables\Columns\ColumnDc;
|
||||
@@ -17,15 +19,11 @@ use App\Filament\Tables\Columns\ColumnTotalQ1;
|
||||
use App\Filament\Tables\Columns\ColumnTq;
|
||||
use App\Filament\Tables\Columns\EventColumn;
|
||||
use App\Filament\Tables\Columns\MatchIds;
|
||||
use App\Models\BettypeUser;
|
||||
use App\Models\ComparingBookmaker;
|
||||
use App\Models\CompetitionGroup;
|
||||
use App\Models\Country;
|
||||
use App\Models\Event;
|
||||
use App\Models\EventUserStar;
|
||||
use App\Models\Group;
|
||||
use App\Models\MultilineClient;
|
||||
use App\Models\MultilineSetting;
|
||||
use App\Models\Sport;
|
||||
use App\Models\User;
|
||||
use CodeWithKyrian\FilamentDateRange\Forms\Components\DateRangePicker;
|
||||
@@ -50,68 +48,19 @@ use Illuminate\Support\Carbon;
|
||||
|
||||
class EventsTable
|
||||
{
|
||||
public static $bettype_settings = [];
|
||||
|
||||
public static $multiline_bookmaker = [];
|
||||
|
||||
public static $multiline_gettype = [];
|
||||
|
||||
public static $user;
|
||||
|
||||
public static function load_multiline_bookmaker()
|
||||
{
|
||||
if (self::$user->is_multiline_direct) {
|
||||
public static $bettype_settings;
|
||||
|
||||
if (self::$user->sport_id == 1) {
|
||||
$cb = ComparingBookmaker::where('sport_id', 1)->where('client_bookmaker_id', self::$user->bookmaker_id)->select('sorting', 'bookmaker_id', 'time_lastcheck', 'margin_threshold', 'is_active')->get();
|
||||
} else {
|
||||
$cb = ComparingBookmaker::where('sport_id', '!=', 1)->where('client_bookmaker_id', self::$user->bookmaker_id)->select('sorting', 'bookmaker_id', 'time_lastcheck', 'margin_threshold', 'is_active')->get();
|
||||
}
|
||||
|
||||
$bookmakers = [];
|
||||
foreach ($cb as $value) {
|
||||
$bookmakers[] = $value->bookmaker_id;
|
||||
}
|
||||
|
||||
$res = MultilineSetting::where('sport_id', self::$user->sport_id)->get();
|
||||
|
||||
foreach ($res as $value) {
|
||||
self::$multiline_gettype[$value->table]['filter'] = $cb;
|
||||
self::$multiline_gettype[$value->table]['bookmaker'] = $bookmakers;
|
||||
}
|
||||
|
||||
} else {
|
||||
$res = MultilineClient::with('multiline_setting')
|
||||
->select('bookmaker_id', 'multiline_setting_id')
|
||||
->orderBy('sort')
|
||||
->get();
|
||||
|
||||
foreach ($res as $value) {
|
||||
$table = $value->multiline_setting->table;
|
||||
self::$multiline_gettype[$table]['bookmaker'][] = (int) $value->bookmaker_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function load_bettype_settings()
|
||||
{
|
||||
$res = BettypeUser::with('multiline_setting')
|
||||
->orderBy('multiline_setting_id')
|
||||
->where('is_active', 1)
|
||||
->get();
|
||||
|
||||
foreach ($res as $value) {
|
||||
self::$bettype_settings[] = $value->multiline_setting->table;
|
||||
}
|
||||
}
|
||||
public static $multiline_bookmaker;
|
||||
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
self::$user = User::getUser();
|
||||
|
||||
self::load_bettype_settings();
|
||||
self::$bettype_settings = LoadBettypeSettings::load();
|
||||
|
||||
self::load_multiline_bookmaker();
|
||||
self::$multiline_bookmaker = LoadMultilineBookmaker::load();
|
||||
|
||||
return $table
|
||||
->poll('10s')
|
||||
@@ -143,97 +92,97 @@ class EventsTable
|
||||
|
||||
EventColumn::make('event'),
|
||||
|
||||
ColumnMl::make('odds_2ways')->bookmakers(self::$multiline_gettype['odds_2ways'] ?? [])
|
||||
ColumnMl::make('odds_2ways')->bookmakers(self::$multiline_bookmaker['odds_2ways'] ?? [])
|
||||
->visible(fn () => in_array('odds_2ways', self::$bettype_settings))
|
||||
->verticalAlignment(VerticalAlignment::Start)
|
||||
->width(225)
|
||||
->alignCenter()
|
||||
->label('ML'),
|
||||
|
||||
ColumnMlS1::make('odds_2ways_s1')->bookmakers(self::$multiline_gettype['odds_2ways'] ?? [])
|
||||
->visible(fn () => in_array('odds_2ways_s1', self::$bettype_settings))
|
||||
->verticalAlignment(VerticalAlignment::Start)
|
||||
->alignCenter()
|
||||
->width(225)
|
||||
->label('ML S1'),
|
||||
|
||||
Column3way::make('odds_3ways')->bookmakers(self::$multiline_gettype['odds_3ways'] ?? [])
|
||||
Column3way::make('odds_3ways')->bookmakers(self::$multiline_bookmaker['odds_3ways'] ?? [])
|
||||
->visible(fn () => in_array('odds_3ways', self::$bettype_settings))
|
||||
->verticalAlignment(VerticalAlignment::Start)
|
||||
->width(225)
|
||||
->alignCenter()
|
||||
->label('1X2'),
|
||||
|
||||
Column3wayHt::make('odds_3ways_ht')->bookmakers(self::$multiline_gettype['odds_3ways_ht'] ?? [])
|
||||
->visible(fn () => in_array('odds_3ways_ht', self::$bettype_settings))
|
||||
->verticalAlignment(VerticalAlignment::Start)
|
||||
->alignCenter()
|
||||
->width(225)
|
||||
->label('1X2 HT'),
|
||||
|
||||
ColumnTotal::make('odds_totals')->bookmakers(self::$multiline_gettype['odds_totals'] ?? [])
|
||||
ColumnTotal::make('odds_totals')->bookmakers(self::$multiline_bookmaker['odds_totals'] ?? [])
|
||||
->visible(fn () => in_array('odds_totals', self::$bettype_settings))
|
||||
->verticalAlignment(VerticalAlignment::Start)
|
||||
->alignCenter()
|
||||
->width(225)
|
||||
->label('Totals'),
|
||||
|
||||
ColumnTotalHt::make('odds_totals_ht')->bookmakers(self::$multiline_gettype['odds_totals_ht'] ?? [])
|
||||
Column3wayHt::make('odds_3ways_ht')->bookmakers(self::$multiline_bookmaker['odds_3ways_ht'] ?? [])
|
||||
->visible(fn () => in_array('odds_3ways_ht', self::$bettype_settings))
|
||||
->verticalAlignment(VerticalAlignment::Start)
|
||||
->alignCenter()
|
||||
->width(225)
|
||||
->label('1X2 HT'),
|
||||
|
||||
ColumnTotalHt::make('odds_totals_ht')->bookmakers(self::$multiline_bookmaker['odds_totals_ht'] ?? [])
|
||||
->visible(fn () => in_array('odds_totals_ht', self::$bettype_settings))
|
||||
->verticalAlignment(VerticalAlignment::Start)
|
||||
->alignCenter()
|
||||
->width(225)
|
||||
->label('Totals HT'),
|
||||
|
||||
ColumnTotalQ1::make('odds_totals_q1')->bookmakers(self::$multiline_gettype['odds_totals_q1'] ?? [])
|
||||
->visible(fn () => in_array('odds_totals_q1', self::$bettype_settings))
|
||||
ColumnGgng::make('odds_ggng')->bookmakers(self::$multiline_bookmaker['odds_ggng'] ?? [])
|
||||
->visible(fn () => \in_array('odds_ggng', self::$bettype_settings))
|
||||
->verticalAlignment(VerticalAlignment::Start)
|
||||
->alignCenter()
|
||||
->width(225)
|
||||
->label('Totals Q1'),
|
||||
->width(190)
|
||||
->label('Goal No Goal'),
|
||||
|
||||
ColumnPoint::make('odds_points')->bookmakers(self::$multiline_gettype['odds_points'] ?? [])
|
||||
ColumnPoint::make('odds_points')->bookmakers(self::$multiline_bookmaker['odds_points'] ?? [])
|
||||
->visible(fn () => in_array('odds_points', self::$bettype_settings))
|
||||
->verticalAlignment(VerticalAlignment::Start)
|
||||
->alignCenter()
|
||||
->width(225)
|
||||
->label('Points'),
|
||||
|
||||
ColumnPointQ1::make('odds_points_q1')->bookmakers(self::$multiline_gettype['odds_points_q1'] ?? [])
|
||||
ColumnTotalQ1::make('odds_totals_q1')->bookmakers(self::$multiline_bookmaker['odds_totals_q1'] ?? [])
|
||||
->visible(fn () => in_array('odds_totals_q1', self::$bettype_settings))
|
||||
->verticalAlignment(VerticalAlignment::Start)
|
||||
->alignCenter()
|
||||
->width(225)
|
||||
->label('Totals Q1'),
|
||||
|
||||
ColumnPointQ1::make('odds_points_q1')->bookmakers(self::$multiline_bookmaker['odds_points_q1'] ?? [])
|
||||
->visible(fn () => in_array('odds_points_q1', self::$bettype_settings))
|
||||
->verticalAlignment(VerticalAlignment::Start)
|
||||
->alignCenter()
|
||||
->width(225)
|
||||
->label('Points Q1'),
|
||||
|
||||
ColumnDc::make('odds_dc')->bookmakers(self::$multiline_gettype['odds_dc'] ?? [])
|
||||
->visible(fn () => in_array('odds_dc', self::$bettype_settings))
|
||||
ColumnMlS1::make('odds_2ways_s1')->bookmakers(self::$multiline_bookmaker['odds_2ways'] ?? [])
|
||||
->visible(fn () => in_array('odds_2ways_s1', self::$bettype_settings))
|
||||
->verticalAlignment(VerticalAlignment::Start)
|
||||
->alignCenter()
|
||||
->width(225)
|
||||
->label('ML S1'),
|
||||
|
||||
ColumnDc::make('odds_dc')->bookmakers(self::$multiline_bookmaker['odds_dc'] ?? [])
|
||||
->visible(fn () => \in_array('odds_dc', self::$bettype_settings))
|
||||
->verticalAlignment(VerticalAlignment::Start)
|
||||
->alignCenter()
|
||||
->width(225)
|
||||
->label('Double Chance'),
|
||||
|
||||
ColumnDnb::make('odds_dnb')->bookmakers(self::$multiline_gettype['odds_dnb'] ?? [])
|
||||
->visible(fn () => in_array('odds_dnb', self::$bettype_settings))
|
||||
->verticalAlignment(VerticalAlignment::Start)
|
||||
->alignCenter()
|
||||
->width(190)
|
||||
->label('Draw No Bet'),
|
||||
|
||||
ColumnGgng::make('odds_ggng')->bookmakers(self::$multiline_gettype['odds_ggng'] ?? [])
|
||||
->visible(fn () => in_array('odds_ggng', self::$bettype_settings))
|
||||
->verticalAlignment(VerticalAlignment::Start)
|
||||
->alignCenter()
|
||||
->width(190)
|
||||
->label('Goal No Goal'),
|
||||
|
||||
ColumnTq::make('odds_tq')->bookmakers(self::$bettype_settings['odds_tq'] ?? [])
|
||||
->visible(fn () => in_array('odds_tq', self::$bettype_settings))
|
||||
ColumnTq::make('odds_tq')->bookmakers(self::$multiline_bookmaker['odds_tq'] ?? [])
|
||||
->visible(fn () => \in_array('odds_tq', self::$bettype_settings))
|
||||
->verticalAlignment(VerticalAlignment::Start)
|
||||
->alignCenter()
|
||||
->width(190)
|
||||
->label('To Qualify'),
|
||||
|
||||
ColumnDnb::make('odds_dnb')->bookmakers(self::$multiline_bookmaker['odds_dnb'] ?? [])
|
||||
->visible(fn () => \in_array('odds_dnb', self::$bettype_settings))
|
||||
->verticalAlignment(VerticalAlignment::Start)
|
||||
->alignCenter()
|
||||
->width(190)
|
||||
->label('Draw No Bet'),
|
||||
|
||||
])->searchable(['id', 'home.name', 'away.name', 'betsapi_id', 'betradar_id', 'bet365_id', 'bwin_id', 'magnig_id', 'magken_id', 'lognig_id', 'logcol_id'])
|
||||
->defaultSort('starttime', 'ASC')
|
||||
->extremePaginationLinks()
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Events\Tables\Tools;
|
||||
|
||||
use App\Models\BettypeUser;
|
||||
|
||||
class LoadBettypeSettings
|
||||
{
|
||||
public static function load()
|
||||
{
|
||||
$res = BettypeUser::with('multiline_setting')
|
||||
->orderBy('multiline_setting_id')
|
||||
->where('is_active', 1)
|
||||
->get();
|
||||
|
||||
$arr = [];
|
||||
foreach ($res as $value) {
|
||||
$arr[] = $value->multiline_setting->table;
|
||||
}
|
||||
|
||||
return $arr;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Events\Tables\Tools;
|
||||
|
||||
use App\Models\ComparingBookmaker;
|
||||
use App\Models\MultilineClient;
|
||||
use App\Models\MultilineSetting;
|
||||
use App\Models\User;
|
||||
|
||||
class LoadMultilineBookmaker
|
||||
{
|
||||
public static $user;
|
||||
|
||||
public static function load()
|
||||
{
|
||||
self::$user = User::getUser();
|
||||
|
||||
$arr = [];
|
||||
|
||||
// if (self::$user->sport_id == 1) {
|
||||
// $cb = ComparingBookmaker::where('sport_id', 1)->where('client_bookmaker_id', self::$user->bookmaker_id)->orderBy('sorting')->select('bookmaker_id', 'time_lastcheck', 'margin_threshold', 'is_active')->get()->toArray();
|
||||
// } else {
|
||||
// $cb = ComparingBookmaker::where('sport_id', '!=', 1)->where('client_bookmaker_id', self::$user->bookmaker_id)->orderBy('sorting')->select('bookmaker_id', 'time_lastcheck', 'margin_threshold', 'is_active')->get()->toArray();
|
||||
// }
|
||||
|
||||
$cb = ComparingBookmaker::where('sport_id', self::$user->sport_id)->where('client_bookmaker_id', self::$user->bookmaker_id)->orderBy('sorting')->select('bookmaker_id', 'time_lastcheck', 'margin_threshold', 'is_active')->get()->toArray();
|
||||
|
||||
$bookmakers = [];
|
||||
$filter = [];
|
||||
foreach ($cb as $value) {
|
||||
$bookmakers[] = $value['bookmaker_id'];
|
||||
$filter[$value['bookmaker_id']] = [
|
||||
'time_lastcheck' => $value['time_lastcheck'],
|
||||
'margin' => $value['margin_threshold'],
|
||||
];
|
||||
}
|
||||
|
||||
$res = MultilineSetting::where('sport_id', self::$user->sport_id)->get();
|
||||
|
||||
foreach ($res as $value) {
|
||||
$arr[$value->table]['filter'] = $filter;
|
||||
$arr[$value->table]['bookmaker'] = $bookmakers;
|
||||
if (auth()->user()->is_multiline_direct) {
|
||||
$arr[$value->table]['slots'] = $bookmakers;
|
||||
}
|
||||
}
|
||||
|
||||
if (! auth()->user()->is_multiline_direct) {
|
||||
$res = MultilineClient::with('multiline_setting')
|
||||
->select('bookmaker_id', 'multiline_setting_id')
|
||||
->orderBy('sort')
|
||||
->get();
|
||||
|
||||
foreach ($res as $value) {
|
||||
$table = $value->multiline_setting->table;
|
||||
$arr[$table]['slots'][] = (int) self::$user->bookmaker_id;
|
||||
}
|
||||
foreach ($res as $value) {
|
||||
$table = $value->multiline_setting->table;
|
||||
$arr[$table]['slots'][] = (int) $value->bookmaker_id;
|
||||
}
|
||||
}
|
||||
|
||||
return $arr;
|
||||
}
|
||||
}
|
||||
@@ -30,9 +30,13 @@ class Column3way extends Column
|
||||
return $this->bookmakers['bookmaker'] ?? [];
|
||||
}
|
||||
|
||||
public function getSlots(): ?array
|
||||
{
|
||||
return $this->bookmakers['slots'] ?? [];
|
||||
}
|
||||
|
||||
public function loadData($record)
|
||||
{
|
||||
|
||||
$this->has_data = count($record->odds_3ways) ? true : false;
|
||||
|
||||
$this->act = $record->odds_3ways->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
|
||||
@@ -49,12 +53,7 @@ class Column3way extends Column
|
||||
|
||||
$this->min['a3w'] = $record->odds_3ways->min('a3w');
|
||||
|
||||
// $record->odds_3ways = $record->odds_3ways->filter(function (int $value, int $key) {
|
||||
|
||||
// return in_array($this->bookmakers['bookmaker'], $value['bookmaker_id']);
|
||||
|
||||
// });
|
||||
|
||||
$record->odds_3ways = FilterOdds::filter($record->odds_3ways, $this->bookmakers);
|
||||
}
|
||||
|
||||
public function getAct()
|
||||
|
||||
@@ -30,6 +30,11 @@ class Column3wayHt extends Column
|
||||
return $this->bookmakers['bookmaker'] ?? [];
|
||||
}
|
||||
|
||||
public function getSlots(): ?array
|
||||
{
|
||||
return $this->bookmakers['slots'] ?? [];
|
||||
}
|
||||
|
||||
public function loadData($record)
|
||||
{
|
||||
$this->has_data = count($record->odds_3ways_ht) ? true : false;
|
||||
@@ -47,6 +52,8 @@ class Column3wayHt extends Column
|
||||
$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()
|
||||
|
||||
@@ -30,6 +30,11 @@ class ColumnDc extends Column
|
||||
return $this->bookmakers['bookmaker'] ?? [];
|
||||
}
|
||||
|
||||
public function getSlots(): ?array
|
||||
{
|
||||
return $this->bookmakers['slots'] ?? [];
|
||||
}
|
||||
|
||||
public function loadData($record)
|
||||
{
|
||||
$this->has_data = count($record->odds_dc) ? true : false;
|
||||
@@ -47,6 +52,8 @@ class ColumnDc extends Column
|
||||
$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()
|
||||
|
||||
@@ -30,6 +30,11 @@ class ColumnDnb extends Column
|
||||
return $this->bookmakers['bookmaker'] ?? [];
|
||||
}
|
||||
|
||||
public function getSlots(): ?array
|
||||
{
|
||||
return $this->bookmakers['slots'] ?? [];
|
||||
}
|
||||
|
||||
public function loadData($record)
|
||||
{
|
||||
$this->has_data = count($record->odds_dnb) ? true : false;
|
||||
@@ -44,6 +49,8 @@ class ColumnDnb extends Column
|
||||
|
||||
$this->min['dnb2'] = $record->odds_dnb->min('dnb2');
|
||||
|
||||
$record->odds_dnb = FilterOdds::filter($record->odds_dnb, $this->bookmakers);
|
||||
|
||||
}
|
||||
|
||||
public function getAct()
|
||||
|
||||
@@ -30,6 +30,11 @@ class ColumnGgng extends Column
|
||||
return $this->bookmakers['bookmaker'] ?? [];
|
||||
}
|
||||
|
||||
public function getSlots(): ?array
|
||||
{
|
||||
return $this->bookmakers['slots'] ?? [];
|
||||
}
|
||||
|
||||
public function loadData($record)
|
||||
{
|
||||
$this->has_data = count($record->odds_ggng) ? true : false;
|
||||
@@ -44,6 +49,7 @@ class ColumnGgng extends Column
|
||||
|
||||
$this->min['ng'] = $record->odds_ggng->min('ng');
|
||||
|
||||
$record->odds_ggng = FilterOdds::filter($record->odds_ggng, $this->bookmakers);
|
||||
}
|
||||
|
||||
public function getAct()
|
||||
|
||||
@@ -30,6 +30,11 @@ class ColumnMl extends Column
|
||||
return $this->bookmakers['bookmaker'] ?? [];
|
||||
}
|
||||
|
||||
public function getSlots(): ?array
|
||||
{
|
||||
return $this->bookmakers['slots'] ?? [];
|
||||
}
|
||||
|
||||
public function loadData($record)
|
||||
{
|
||||
$this->has_data = count($record->odds_2ways) ? true : false;
|
||||
@@ -44,6 +49,7 @@ class ColumnMl extends Column
|
||||
|
||||
$this->min['a2w'] = $record->odds_2ways->min('a2w');
|
||||
|
||||
$record->odds_2ways = FilterOdds::filter($record->odds_2ways, $this->bookmakers);
|
||||
}
|
||||
|
||||
public function getAct()
|
||||
|
||||
@@ -30,6 +30,11 @@ class ColumnMlS1 extends Column
|
||||
return $this->bookmakers['bookmaker'] ?? [];
|
||||
}
|
||||
|
||||
public function getSlots(): ?array
|
||||
{
|
||||
return $this->bookmakers['slots'] ?? [];
|
||||
}
|
||||
|
||||
public function loadData($record)
|
||||
{
|
||||
$this->has_data = count($record->odds_2ways_s1) ? true : false;
|
||||
@@ -44,6 +49,8 @@ class ColumnMlS1 extends Column
|
||||
|
||||
$this->min['a2w'] = $record->odds_2ways->min('a2w');
|
||||
|
||||
$record->odds_2ways_s1 = FilterOdds::filter($record->odds_2ways_s1, $this->bookmakers);
|
||||
|
||||
}
|
||||
|
||||
public function getAct()
|
||||
|
||||
@@ -30,6 +30,11 @@ class ColumnPoint extends Column
|
||||
return $this->bookmakers['bookmaker'] ?? [];
|
||||
}
|
||||
|
||||
public function getSlots(): ?array
|
||||
{
|
||||
return $this->bookmakers['slots'] ?? [];
|
||||
}
|
||||
|
||||
public function loadData($record)
|
||||
{
|
||||
$this->has_data = count($record->odds_points) ? true : false;
|
||||
@@ -44,6 +49,8 @@ class ColumnPoint extends Column
|
||||
|
||||
$this->min['away'] = $record->odds_points->min('away');
|
||||
|
||||
$record->odds_points = FilterOdds::filter($record->odds_points, $this->bookmakers);
|
||||
|
||||
}
|
||||
|
||||
public function getAct()
|
||||
|
||||
@@ -30,6 +30,11 @@ class ColumnPointQ1 extends Column
|
||||
return $this->bookmakers['bookmaker'] ?? [];
|
||||
}
|
||||
|
||||
public function getSlots(): ?array
|
||||
{
|
||||
return $this->bookmakers['slots'] ?? [];
|
||||
}
|
||||
|
||||
public function loadData($record)
|
||||
{
|
||||
$this->has_data = count($record->odds_points_q1) ? true : false;
|
||||
@@ -44,6 +49,8 @@ class ColumnPointQ1 extends Column
|
||||
|
||||
$this->min['away'] = $record->odds_points_q1->min('away');
|
||||
|
||||
$record->odds_points_q1 = FilterOdds::filter($record->odds_points_q1, $this->bookmakers);
|
||||
|
||||
}
|
||||
|
||||
public function getAct()
|
||||
|
||||
@@ -30,6 +30,11 @@ class ColumnTotal extends Column
|
||||
return $this->bookmakers['bookmaker'] ?? [];
|
||||
}
|
||||
|
||||
public function getSlots(): ?array
|
||||
{
|
||||
return $this->bookmakers['slots'] ?? [];
|
||||
}
|
||||
|
||||
public function loadData($record)
|
||||
{
|
||||
$this->has_data = count($record->odds_totals) ? true : false;
|
||||
@@ -44,6 +49,8 @@ class ColumnTotal extends Column
|
||||
|
||||
$this->min['under'] = $record->odds_totals->min('under');
|
||||
|
||||
$record->odds_totals = FilterOdds::filter($record->odds_totals, $this->bookmakers);
|
||||
|
||||
}
|
||||
|
||||
public function getAct()
|
||||
|
||||
@@ -30,6 +30,11 @@ class ColumnTotalHt extends Column
|
||||
return $this->bookmakers['bookmaker'] ?? [];
|
||||
}
|
||||
|
||||
public function getSlots(): ?array
|
||||
{
|
||||
return $this->bookmakers['slots'] ?? [];
|
||||
}
|
||||
|
||||
public function loadData($record)
|
||||
{
|
||||
$this->has_data = count($record->odds_totals_ht) ? true : false;
|
||||
@@ -44,6 +49,8 @@ class ColumnTotalHt extends Column
|
||||
|
||||
$this->min['under'] = $record->odds_totals_ht->min('under');
|
||||
|
||||
$record->odds_totals_ht = FilterOdds::filter($record->odds_totals_ht, $this->bookmakers);
|
||||
|
||||
}
|
||||
|
||||
public function getAct()
|
||||
|
||||
@@ -30,6 +30,11 @@ class ColumnTotalQ1 extends Column
|
||||
return $this->bookmakers['bookmaker'] ?? [];
|
||||
}
|
||||
|
||||
public function getSlots(): ?array
|
||||
{
|
||||
return $this->bookmakers['slots'] ?? [];
|
||||
}
|
||||
|
||||
public function loadData($record)
|
||||
{
|
||||
$this->has_data = count($record->odds_totals_q1) ? true : false;
|
||||
@@ -44,6 +49,8 @@ class ColumnTotalQ1 extends Column
|
||||
|
||||
$this->min['under'] = $record->odds_totals_q1->min('under');
|
||||
|
||||
$record->odds_totals_q1 = FilterOdds::filter($record->odds_totals_q1, $this->bookmakers);
|
||||
|
||||
}
|
||||
|
||||
public function getAct()
|
||||
|
||||
@@ -30,6 +30,11 @@ class ColumnTq extends Column
|
||||
return $this->bookmakers['bookmaker'] ?? [];
|
||||
}
|
||||
|
||||
public function getSlots(): ?array
|
||||
{
|
||||
return $this->bookmakers['slots'] ?? [];
|
||||
}
|
||||
|
||||
public function loadData($record)
|
||||
{
|
||||
$this->has_data = count($record->odds_tq) ? true : false;
|
||||
@@ -44,6 +49,8 @@ class ColumnTq extends Column
|
||||
|
||||
$this->min['atq'] = $record->odds_tq->min('atq');
|
||||
|
||||
$record->odds_tq = FilterOdds::filter($record->odds_tq, $this->bookmakers);
|
||||
|
||||
}
|
||||
|
||||
public function getAct()
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Tables\Columns;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
|
||||
class FilterOdds
|
||||
{
|
||||
public static function filter($data, $bookmakers): Collection
|
||||
{
|
||||
if (auth()->user()->is_multiline_direct) {
|
||||
/**
|
||||
* ORDER
|
||||
*/
|
||||
$order = $bookmakers['bookmaker'] ?? [];
|
||||
|
||||
$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'])) {
|
||||
dd($model->bookmaker_id);
|
||||
}
|
||||
|
||||
if ($model->margin <= $filter['margin'] && $checked_at > time() - $filter['time_lastcheck']) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Tables\Columns\Tools;
|
||||
|
||||
class Compare3way
|
||||
{
|
||||
public static function run($odds_3ways, $bookmakers)
|
||||
{
|
||||
return;
|
||||
$maxrows = 4;
|
||||
$count = 1;
|
||||
$tmp = [];
|
||||
dd($bookmakers);
|
||||
foreach ($bookmakers as $bookmaker) {
|
||||
|
||||
$odds_3ways = $odds_3ways->filter(function ($odds_3ways, $bookmaker) {
|
||||
if ($odds_3ways->contains('bookmaker_id', $bookmaker['bookmaker_id'])) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -59,4 +59,11 @@ class BettypeToggle extends Component
|
||||
|
||||
$this->dispatch('refreshBettypeMenu');
|
||||
}
|
||||
|
||||
public function toggleFilter()
|
||||
{
|
||||
User::where('id', auth()->user()->id)->update(['no_filter' => DB::raw('!no_filter')]);
|
||||
|
||||
$this->dispatch('refreshBettypeMenu');
|
||||
}
|
||||
}
|
||||
@@ -36,6 +36,7 @@ class User extends Authenticatable implements FilamentUser, HasAppAuthentication
|
||||
'sport_id',
|
||||
'star',
|
||||
'is_multiline_direct',
|
||||
'no_filter',
|
||||
'bookmaker_id',
|
||||
'provider_id',
|
||||
];
|
||||
|
||||
Reference in new issue
Block a user