ComparingBookmakerMenu ok

This commit is contained in:
salam committed 2026-01-21 09:54:12 +01:00
1 parent be80128226
commit f59ac10c2a
17 files changed
+272 -317

No files matched your search

@@ -9,8 +9,6 @@ use App\Models\Client;
use App\Models\ComparingBookmaker;
use App\Models\MultilineClient;
use App\Models\MultilineSetting;
use App\Models\Odds2way;
use App\Models\Odds3way;
use App\Models\Sport;
use App\Models\User;
use App\Utilities\Notice;
@@ -79,56 +77,59 @@ class GenerateDefaultSetting
Notice::note('3) comparing bookmaker', 'p');
}
$bookmakers = Bookmaker::get();
$res = Client::get();
$bookmakers_soccer = Bookmaker::where('in_soccer', 1)->orderBy('name')->pluck('id')->toArray();
ComparingBookmaker::where('method_id', 1)->where('sport_id', 1)->whereNotIn('bookmaker_id', $bookmakers_soccer)->delete();
foreach ($res as $client) {
$client_bookmakers = $client->bookmaker;
$sports = $client->sport;
foreach ($sports as $sport_id) {
switch ($sport_id) {
case 1:
$in_table_bookmaker = Odds3way::where('sport_id', $sport_id)->groupBy('bookmaker_id')->pluck('bookmaker_id')->toArray();
break;
case 2:
case 3:
case 5:
$in_table_bookmaker = Odds2way::where('sport_id', $sport_id)->groupBy('bookmaker_id')->pluck('bookmaker_id')->toArray();
break;
}
foreach ($client_bookmakers as $client_bookmaker_id) {
$i = 0;
foreach ($bookmakers as $bookmaker) {
$i = 1;
foreach ($bookmakers_soccer as $bookmaker_id) {
ComparingBookmaker::updateOrCreate(
['method_id' => 1, 'sport_id' => 1, 'client_bookmaker_id' => $client_bookmaker_id, 'bookmaker_id' => $bookmaker_id],
['is_active' => 1, 'time_lastcheck' => 600, 'margin_threshold' => 110, 'sorting' => $i]
);
$i++;
$is_hidden = \in_array($bookmaker->id, $in_table_bookmaker) ? 0 : 1;
}
}
}
foreach ($client_bookmakers as $client_bookmaker_id) {
$sports = Sport::getActiveSports();
if (($key = array_search(1, $sports)) !== false) {
unset($sports[$key]);
}
if ($client_bookmaker_id != $bookmaker->id) {
$bookmakers_other = Bookmaker::where('in_other', 1)->orderBy('name')->pluck('id')->toArray();
if ($bookmaker->is_active) {
for ($method_id = 1; $method_id <= 4; $method_id++) {
ComparingBookmaker::updateOrCreate(
['method_id' => $method_id, 'sport_id' => $sport_id, 'client_bookmaker_id' => $client_bookmaker_id, 'bookmaker_id' => $bookmaker->id],
['is_hidden' => $is_hidden, 'is_active' => 1, 'time_lastcheck' => 600, 'margin_threshold' => 110, 'sorting' => $i]
);
}
} else {
for ($method_id = 1; $method_id <= 4; $method_id++) {
ComparingBookmaker::where('method_id', $method_id)
->where('sport_id', $sport_id)
->where('bookmaker_id', $bookmaker->id)
->where('client_bookmaker_id', $client_bookmaker_id)
->delete();
}
}
}
ComparingBookmaker::where('method_id', 1)->whereIn('sport_id', $sports)->whereNotIn('bookmaker_id', $bookmakers_other)->delete();
foreach ($res as $client) {
$client_bookmakers = $client->bookmaker;
foreach ($client_bookmakers as $client_bookmaker_id) {
foreach ($sports as $sport_id) {
$i = 1;
foreach ($bookmakers_other as $bookmaker_id) {
ComparingBookmaker::updateOrCreate(
['method_id' => 1, 'sport_id' => $sport_id, 'client_bookmaker_id' => $client_bookmaker_id, 'bookmaker_id' => $bookmaker_id],
['is_active' => 1, 'time_lastcheck' => 600, 'margin_threshold' => 110, 'sorting' => $i]
);
$i++;
}
}
}
}
}
}
@@ -6,6 +6,7 @@ use App\Filament\Tables\Columns\BookmakerIcon;
use Filament\Actions\EditAction;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Columns\ToggleColumn;
use Filament\Tables\Enums\FiltersLayout;
use Filament\Tables\Filters\TernaryFilter;
use Filament\Tables\Table;
@@ -15,30 +16,32 @@ class BookmakersTable
{
return $table
->striped()
->recordAction(null)
->defaultPaginationPageOption(5)
->columns([
TextColumn::make('id')->searchable(),
TextColumn::make('name')
->searchable(),
BookmakerIcon::make('icon')->label('Icon'),
TextColumn::make('baid')
->label('BAID')
->numeric()
->sortable(),
ToggleColumn::make('txso')->offColor('gray'),
ToggleColumn::make('txot')->offColor('gray'),
ToggleColumn::make('betsapi')->offColor('gray'),
ToggleColumn::make('direct')->offColor('gray'),
ToggleColumn::make('is_active')->offColor('gray'),
TextColumn::make('name')->searchable(),
BookmakerIcon::make('icon')->label('Icon')->size('lg'),
ToggleColumn::make('in_soccer')->onColor('success'),
ToggleColumn::make('in_other')->onColor('success'),
ToggleColumn::make('txso'),
ToggleColumn::make('txot'),
ToggleColumn::make('betsapi'),
ToggleColumn::make('direct'),
ToggleColumn::make('is_active')->onColor('success'),
ToggleColumn::make('need_check')->onColor('danger'),
])
->defaultSort('name')
->defaultSort('id')
->filters([
TernaryFilter::make('in_soccer'),
TernaryFilter::make('in_other'),
TernaryFilter::make('txso'),
TernaryFilter::make('txot'),
TernaryFilter::make('betsapi'),
TernaryFilter::make('direct'),
TernaryFilter::make('is_active')->default(true),
])
TernaryFilter::make('need_check'),
], FiltersLayout::AboveContent)
->deferFilters(false)
->recordActions([
EditAction::make()->hiddenLabel(),
]);
@@ -1,20 +0,0 @@
<?php
namespace App\Livewire\ComparingBookmaker;
use App\Models\ComparingBookmaker;
use App\Models\User;
class LoadBookmaker
{
public static function load()
{
$user = User::find(auth()->user()->id);
return ComparingBookmaker::query()
->with('bookmaker')
->where('sport_id', $user->sport_id)
->where('client_bookmaker_id', $user->bookmaker_id)
->orderBy('sorting');
}
}
+23 -53
View File
@@ -3,14 +3,13 @@
namespace App\Livewire;
use App\Filament\Tables\Columns\BookmakerIcon;
use App\Livewire\ComparingBookmaker\LoadBookmaker;
use App\Models\ComparingBookmaker;
use App\Models\User;
use Filament\Actions\Action;
use Filament\Actions\BulkAction;
use Filament\Actions\BulkActionGroup;
use Filament\Actions\Concerns\InteractsWithActions;
use Filament\Actions\Contracts\HasActions;
use Filament\Forms\Components\Radio;
use Filament\Forms\Components\TextInput;
use Filament\Schemas\Concerns\InteractsWithSchemas;
use Filament\Schemas\Contracts\HasSchemas;
@@ -20,12 +19,9 @@ use Filament\Tables\Columns\ToggleColumn;
use Filament\Tables\Concerns\InteractsWithTable;
use Filament\Tables\Contracts\HasTable;
use Filament\Tables\Enums\FiltersLayout;
use Filament\Tables\Filters\Filter;
use Filament\Tables\Filters\Indicator;
use Filament\Tables\Filters\TernaryFilter;
use Filament\Tables\Table;
use Illuminate\Contracts\View\View;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Collection;
use Livewire\Component;
@@ -35,83 +31,57 @@ class ComparingBookmakerMenu extends Component implements HasActions, HasSchemas
use InteractsWithSchemas;
use InteractsWithTable;
public $user;
protected $listeners = [
'refresh' => '$refresh',
];
public function table(Table $table): Table
{
$this->user = User::getUser();
return $table
->description('')
->description('Bookmaker order is priority. Maximum time than can pass since last check or update. If older bookmaker will be ignored')
->description('Bookmakers will be compared from top to bottom. First one matches criteria is used for comparition.')
->reorderable('sorting')
->reorderRecordsTriggerAction(function (Action $action) {
return $action->button();
})
->paginated(false)
->striped()
->query(LoadBookmaker::load())
->query(ComparingBookmaker::query()
->with('bookmaker')
->where('sport_id', $this->user->sport_id)
->where('client_bookmaker_id', $this->user->bookmaker_id)
->orderBy('sorting')
)
->columns([
TextColumn::make('Position')
->alignCenter()
->badge()
->rowIndex(),
TextColumn::make('bookmaker_id')->label('Id'),
BookmakerIcon::make('bookmaker.icon')->label('Icon'),
BookmakerIcon::make('bookmaker.icon')->label('Icon')->size('lg'),
TextInputColumn::make('time_lastcheck')
->tooltip('If lastcheck is older bookmaker will be ignored')
->label('Time Passed')
->prefix('Seconds:')
->rules(['required', 'max:200', 'min:100']),
TextInputColumn::make('margin_threshold')
->tooltip('If margin is higher bookmaker will be ignored')
->label('Maximum Margin')
->prefix('Threshold:')
->rules(['required', 'max:200', 'min:100']),
ToggleColumn::make('is_active'),
// ToggleColumn::make('is_active'),
])
->filters([
Filter::make('method_id')
->schema([
Radio::make('method_id')
->inline()
->default(1)
->label('League / Tournament Level')
->options([
1 => 'TOP',
2 => 'MIDDLE',
3 => 'LOW',
]),
])
->query(function (Builder $query, array $data): Builder {
return $query
->when(
$data['method_id'],
fn (Builder $query, $method_id): Builder => $query->where('method_id', $method_id),
);
})->indicateUsing(function (array $data): array {
$indicators = [];
if ($data['method_id'] ?? null) {
switch ($data['method_id']) {
case 1:
$indicators[] = Indicator::make('Method: TOP');
break;
case 2:
$indicators[] = Indicator::make('Method: MIDDLE');
break;
case 3:
$indicators[] = Indicator::make('Method: LOW');
break;
}
}
return $indicators;
})->columnSpan(6),
TernaryFilter::make('is_active')
->columnSpan(2)
->default(1)
->label('Show active'),
], layout: FiltersLayout::AboveContent)
->filtersFormColumns(8)
->searchable(['bookmaker.name'])
// ->filters([
// TernaryFilter::make('is_active')
// ->columnSpan(2)
// ->default(1)
// ->label('Show active'),
// ], layout: FiltersLayout::AboveContent)
->deferFilters(false)
->toolbarActions([
BulkActionGroup::make([
+5 -3
View File
@@ -7,7 +7,7 @@ use Illuminate\Support\Carbon;
class LoadProvider
{
public static function load($search_right)
public static function load($search_right, $user)
{
if ($search_right) {
@@ -15,7 +15,8 @@ class LoadProvider
return Mapper::query()
->where('starttime', '>', Carbon::now())
->where('provider_id', auth()->user()->provider_id)
->where('sport_id', $user->sport_id)
->where('provider_id', $user->provider_id)
->where(function ($query) use ($searchValues) {
foreach ($searchValues as $value) {
$query->orWhere('home', 'LIKE', '%'.$value.'%')
@@ -25,7 +26,8 @@ class LoadProvider
} else {
return Mapper::query()
->where('starttime', '>', Carbon::now())
->where('provider_id', auth()->user()->provider_id);
->where('sport_id', $user->sport_id)
->where('provider_id', $user->provider_id);
}
}
}
+7 -12
View File
@@ -9,7 +9,7 @@ use App\Models\CompetitionGroup;
use App\Models\Country;
use App\Models\Event;
use App\Models\Mapper;
use App\Models\Sport;
use App\Models\User;
use Carbon\Carbon;
use Filament\Actions\Action;
use Filament\Actions\Concerns\InteractsWithActions;
@@ -42,7 +42,7 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable
public $search_left = false;
public $sport_id = 0;
public $user;
protected $listeners = [
'reload_data_left' => '$refresh',
@@ -67,10 +67,10 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable
public function table(Table $table): Table
{
$this->setSportId();
$this->user = User::getUser();
return $table
->query(LoadEvents::load($this->search_left, $this->sport_id))
->query(LoadEvents::load($this->search_left, $this->user->sport_id))
->columns([
MapperLeftColumn::make('left')->label(''),
])
@@ -87,7 +87,7 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable
->searchable()
->preload()
->options(function () {
$res = Event::query()->where('sport_id', $this->sport_id)->where('betradar_id', 0)->where('starttime', '>', Carbon::now())->groupBy('country_id')->pluck('country_id')->toArray();
$res = Event::query()->where('sport_id', $this->user->sport_id)->where('betradar_id', 0)->where('starttime', '>', Carbon::now())->groupBy('country_id')->pluck('country_id')->toArray();
return Country::query()->whereIn('id', $res)->pluck('name', 'id');
})
@@ -105,9 +105,9 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable
->searchable()
->options(function (Get $get) {
if ($get('country_id')) {
$res = Event::query()->where('sport_id', $this->sport_id)->where('betradar_id', 0)->where('starttime', '>', Carbon::now())->whereIn('country_id', $get('country_id'))->groupBy('competition_group_id')->pluck('competition_group_id')->toArray();
$res = Event::query()->where('sport_id', $this->user->sport_id)->where('betradar_id', 0)->where('starttime', '>', Carbon::now())->whereIn('country_id', $get('country_id'))->groupBy('competition_group_id')->pluck('competition_group_id')->toArray();
} else {
$res = Event::query()->where('sport_id', $this->sport_id)->where('betradar_id', 0)->where('starttime', '>', Carbon::now())->groupBy('competition_group_id')->pluck('competition_group_id')->toArray();
$res = Event::query()->where('sport_id', $this->user->sport_id)->where('betradar_id', 0)->where('starttime', '>', Carbon::now())->groupBy('competition_group_id')->pluck('competition_group_id')->toArray();
}
$comps = CompetitionGroup::with('country')->whereIn('id', $res)->get();
@@ -172,11 +172,6 @@ class MapperLeft extends Component implements HasActions, HasSchemas, HasTable
$this->elements_swopped = ! $this->elements_swopped;
}
public function setSportId()
{
$this->sport_id = Sport::getSportId();
}
#[On('search_left')]
public function searchLeft($str)
{
+51 -88
View File
@@ -8,7 +8,7 @@ use App\Livewire\Mapper\StoreMapped;
use App\Models\Country;
use App\Models\Event;
use App\Models\Mapper;
use App\Models\Sport;
use App\Models\User;
use Filament\Actions\Action;
use Filament\Actions\Concerns\InteractsWithActions;
use Filament\Actions\Contracts\HasActions;
@@ -26,7 +26,6 @@ use Filament\Tables\Filters\Indicator;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Auth;
use Livewire\Attributes\Lazy;
use Livewire\Attributes\On;
use Livewire\Component;
@@ -46,6 +45,8 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable
'reload_data_right' => '$refresh',
];
public $user;
public function removeTableFilter(string $filterName, ?string $field = null, bool $shouldTriggerUpdatedFiltersHook = true): void
{
$searchValues = preg_split('/\s+/', $this->search_right, -1, PREG_SPLIT_NO_EMPTY);
@@ -65,8 +66,10 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable
public function table(Table $table): Table
{
$this->user = User::getUser();
return $table
->query(LoadProvider::load($this->search_right))
->query(LoadProvider::load($this->search_right, $this->user))
->columns([
MapperRightColumn::make('right')->label(''),
])->searchable(['home', 'away'])
@@ -74,66 +77,44 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable
->filters([
Filter::make('events')
->schema([
Select::make(name: 'sport_id')
->default(auth()->user()->sport_id)
->prefixIcon(auth()->user()->sport->icon)
->selectablePlaceholder(false)
Select::make('country_id')
->visible(fn () => in_array($this->user->provider_id, [3, 4]))
->placeholder('Country')
->hiddenLabel()
->columnSpan(2)
->label('')
->searchable()
->preload()
->options(function () {
return Sport::query()->where('is_active', 1)->pluck('name', 'id');
})
->multiple()
->columnSpan(2)
->live()
->options(function (Get $get) {
return Mapper::query()->where('sport_id', $this->user->sport_id)->where('provider_id', $this->user->provider_id)->where('starttime', '>', Carbon::now())->groupBy('country_id')->pluck('country', 'country_id')->toArray();
})
->reactive()
->afterStateUpdated(function (callable $set, $livewire) {
$livewire->dispatch('reload_data_left');
$livewire->dispatch('reload_data_right');
// $set('country_id', null);
// $set('group_cc', null);
->afterStateUpdated(function (callable $set) {
$set('group_id', null);
})
->placeholder('Country'),
Select::make('group_cc')
->visible(fn () => $this->user->provider_id == 2)
->placeholder('Country')
->hiddenLabel()
->label('')
->searchable()
->preload()
->multiple()
->columnSpan(2)
->live()
->options(function () {
$res = Mapper::query()->where('sport_id', $this->user->sport_id)->where('provider_id', $this->user->provider_id)->where('starttime', '>', Carbon::now())->groupBy('group_cc')->pluck('group_cc')->toArray();
}),
// Select::make('country_id')
// ->visible(fn () => in_array(Auth()->user()->provider_id, [3, 4]))
// ->placeholder('Country')
// ->hiddenLabel()
// ->label('')
// ->searchable()
// ->preload()
// ->multiple()
// ->columnSpan(2)
// ->live()
// ->options(function (Get $get) {
// return Mapper::query()->where('sport_id', $get('sport_id'))->where('provider_id', Auth::user()->provider_id)->where('starttime', '>', Carbon::now())->groupBy('country_id')->pluck('country', 'country_id')->toArray();
// })
// ->reactive()
// ->afterStateUpdated(function (callable $set) {
// $set('group_id', null);
// })
// ->placeholder('Country'),
// Select::make('group_cc')
// ->visible(fn () => Auth()->user()->provider_id == 2)
// ->placeholder('Country')
// ->hiddenLabel()
// ->label('')
// ->searchable()
// ->preload()
// ->multiple()
// ->columnSpan(2)
// ->live()
// ->options(function () {
// $res = Mapper::query()->where('sport_id', Auth::user()->sport_id)->where('provider_id', Auth::user()->provider_id)->where('starttime', '>', Carbon::now())->groupBy('group_cc')->pluck('group_cc')->toArray();
// return Country::query()->whereIn('iso2', $res)->pluck('name', 'iso2');
// })
// ->reactive()
// ->afterStateUpdated(function (callable $set) {
// $set('group_id', null);
// })
// ->placeholder('Country'),
return Country::query()->whereIn('iso2', $res)->pluck('name', 'iso2');
})
->reactive()
->afterStateUpdated(function (callable $set) {
$set('group_id', null);
})
->placeholder('Country'),
Select::make('group_id')
->placeholder('League')
->label('Leagues')
@@ -144,28 +125,24 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable
->preload()
->multiple()
->options(function (Get $get) {
// if ($get('country_id')) {
// return Mapper::query()->where('sport_id', $get('sport_id'))->where('provider_id', Auth::user()->provider_id)->where('starttime', '>', Carbon::now())->whereIn('country_id', $get('country_id'))->groupBy('group_id')->pluck('group', 'group_id')->toArray();
// } else
// if ($get('group_cc')) {
// return Mapper::query()->where('sport_id', $get('sport_id'))->where('provider_id', Auth::user()->provider_id)->where('starttime', '>', Carbon::now())->whereIn('group_cc', $get('group_cc'))->groupBy('group_id')->pluck('group', 'group_id')->toArray();
// } else {
// }
return Mapper::query()->where('sport_id', $get('sport_id'))->where('provider_id', Auth::user()->provider_id)->where('starttime', '>', Carbon::now())->groupBy('group_id')->pluck('group', 'group_id')->toArray();
if ($get('country_id')) {
return Mapper::query()->where('sport_id', $this->user->sport_id)->where('provider_id', $this->user->provider_id)->where('starttime', '>', Carbon::now())->whereIn('country_id', $get('country_id'))->groupBy('group_id')->pluck('group', 'group_id')->toArray();
} elseif ($get('group_cc')) {
return Mapper::query()->where('sport_id', $this->user->sport_id)->where('provider_id', $this->user->provider_id)->where('starttime', '>', Carbon::now())->whereIn('group_cc', $get('group_cc'))->groupBy('group_id')->pluck('group', 'group_id')->toArray();
} else {
return Mapper::query()->where('sport_id', $this->user->sport_id)->where('provider_id', $this->user->provider_id)->where('starttime', '>', Carbon::now())->groupBy('group_id')->pluck('group', 'group_id')->toArray();
}
})
->live(),
])
->query(function (Builder $query, array $data): Builder {
return $query
->when(
$data['sport_id'],
fn (Builder $query, $sport_id) => $query->where('sport_id', $sport_id)
// )->when(
// $data['country_id'],
// fn (Builder $query, $country_id) => $query->whereIn('country_id', $country_id)
// )->when(
// $data['group_cc'],
// fn (Builder $query, $group_cc) => $query->whereIn('group_cc', $group_cc)
$data['country_id'],
fn (Builder $query, $country_id) => $query->whereIn('country_id', $country_id)
)->when(
$data['group_cc'],
fn (Builder $query, $group_cc) => $query->whereIn('group_cc', $group_cc)
)->when(
$data['group_id'],
fn (Builder $query, $group_id) => $query->whereIn('group_id', $group_id)
@@ -199,6 +176,7 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable
$livewire->fill(['tableSearch' => '']);
$livewire->resetTableFiltersForm(); // Clears all filters
$this->dispatch('reload_data_right');
$this->dispatch('reload_data_left');
}),
]);
}
@@ -216,21 +194,6 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable
$this->dispatch('reload_data_right');
}
// In the same Table class
protected function removeTableFilters(): void
{
// Custom logic before or after removing filters
// Example: Log the action
\Log::info('Custom filter removal logic triggered.');
// Call the parent method to perform the default removal
parent::removeTableFilters();
// Or, if you want full control, you can manually clear:
// $this->tableFilters = [];
// $this->dispatch('refresh-table');
}
public function rightAction(): Action
{
return Action::make('right')
+12 -6
View File
@@ -6,6 +6,7 @@ use App\Filament\Tables\Columns\BookmakerIcon;
use App\Models\Bookmaker;
use App\Models\MultilineClient;
use App\Models\MultilineSetting;
use App\Models\User;
use Filament\Actions\Concerns\InteractsWithActions;
use Filament\Actions\Contracts\HasActions;
use Filament\Forms\Components\Radio;
@@ -32,17 +33,22 @@ class MultilineBookmaker extends Component implements HasActions, HasSchemas, Ha
public static $default_filter;
public static function load_filter()
public $user;
public static function load_filter($sport_id)
{
self::$default_filter = MultilineSetting::where('sport_id', auth()->user()->sport_id)->orderBy('id')->pluck('id')->first();
self::$default_filter = MultilineSetting::where('sport_id', $sport_id)->orderBy('id')->pluck('id')->first();
}
public function table(Table $table): Table
{
self::load_filter();
$this->user = User::getUser();
self::load_filter($this->user->sport_id);
return $table
->query(MultilineClient::query()->where('sport_id', auth()->user()->sport_id))
->query(MultilineClient::query()->where('sport_id', $this->user->sport_id))
->paginated(false)
->columns([
IconColumn::make('sport.icon')
@@ -61,7 +67,7 @@ class MultilineBookmaker extends Component implements HasActions, HasSchemas, Ha
$table = MultilineSetting::where('id', $livewire->tableFilters['multiline_setting_id'])->value('table');
$bookies = DB::table($table)
->where('sport_id', auth()->user()->sport_id)
->where('sport_id', $this->user->sport_id)
->groupBy('bookmaker_id')->pluck('bookmaker_id');
$res = Bookmaker::whereIn('id', $bookies)->pluck('name', 'id');
@@ -85,7 +91,7 @@ class MultilineBookmaker extends Component implements HasActions, HasSchemas, Ha
->columnSpan(6)
->columnSpanFull()
->hiddenLabel()
->options(fn () => MultilineSetting::where('sport_id', auth()->user()->sport_id)->orderBy('name')->pluck('name', 'id')),
->options(fn () => MultilineSetting::where('sport_id', $this->user->sport_id)->orderBy('name')->pluck('name', 'id')),
])
->query(function (Builder $query, array $data): Builder {
return $query
-1
View File
@@ -14,7 +14,6 @@ class ComparingBookmaker extends Model
'time_lastcheck',
'margin_threshold',
'is_active',
'is_hidden',
'sorting',
];
+5 -8
View File
@@ -28,6 +28,11 @@ class Sport extends Model
}
}
public static function getActiveSports()
{
return Sport::query()->where('is_active', 1)->pluck('id')->toArray();
}
public static function getSportForClient()
{
$user = User::find(auth()->user()->id);
@@ -37,12 +42,4 @@ class Sport extends Model
return Sport::query()->whereIn('id', $sports)->pluck('name', 'id');
}
public static function getSportId()
{
$user = User::find(auth()->user()->id);
return $user->sport_id;
}
}
+5
View File
@@ -176,4 +176,9 @@ class User extends Authenticatable implements FilamentUser, HasAppAuthentication
{
return Bookmaker::where('id', auth()->user()->bookmaker_id)->select('id', 'name', 'icon', 'svg')->first();
}
public static function getUser()
{
return User::find(auth()->user()->id);
}
}
Generated
+19 -19
View File
@@ -2731,16 +2731,16 @@
},
{
"name": "laravel/framework",
"version": "v12.47.0",
"version": "v12.48.1",
"source": {
"type": "git",
"url": "https://github.com/laravel/framework.git",
"reference": "ab8114c2e78f32e64eb238fc4b495bea3f8b80ec"
"reference": "0f0974a9769378ccd9c9935c09b9927f3a606830"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/framework/zipball/ab8114c2e78f32e64eb238fc4b495bea3f8b80ec",
"reference": "ab8114c2e78f32e64eb238fc4b495bea3f8b80ec",
"url": "https://api.github.com/repos/laravel/framework/zipball/0f0974a9769378ccd9c9935c09b9927f3a606830",
"reference": "0f0974a9769378ccd9c9935c09b9927f3a606830",
"shasum": ""
},
"require": {
@@ -2853,7 +2853,7 @@
"league/flysystem-sftp-v3": "^3.25.1",
"mockery/mockery": "^1.6.10",
"opis/json-schema": "^2.4.1",
"orchestra/testbench-core": "^10.8.1",
"orchestra/testbench-core": "^10.9.0",
"pda/pheanstalk": "^5.0.6|^7.0.0",
"php-http/discovery": "^1.15",
"phpstan/phpstan": "^2.0",
@@ -2949,7 +2949,7 @@
"issues": "https://github.com/laravel/framework/issues",
"source": "https://github.com/laravel/framework"
},
"time": "2026-01-13T15:29:06+00:00"
"time": "2026-01-20T16:12:36+00:00"
},
{
"name": "laravel/prompts",
@@ -6194,20 +6194,20 @@
},
{
"name": "swisnl/filament-backgrounds",
"version": "2.0.1",
"version": "2.0.2",
"source": {
"type": "git",
"url": "https://github.com/swisnl/filament-backgrounds.git",
"reference": "08e2917a440243bb8eade4aea5ee7ea225137d10"
"reference": "ae5bb5f909b3e11905b98eaee88ef46a56bdb952"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/swisnl/filament-backgrounds/zipball/08e2917a440243bb8eade4aea5ee7ea225137d10",
"reference": "08e2917a440243bb8eade4aea5ee7ea225137d10",
"url": "https://api.github.com/repos/swisnl/filament-backgrounds/zipball/ae5bb5f909b3e11905b98eaee88ef46a56bdb952",
"reference": "ae5bb5f909b3e11905b98eaee88ef46a56bdb952",
"shasum": ""
},
"require": {
"filament/filament": "^4.0",
"filament/filament": "^4.0|^5.0",
"illuminate/contracts": "^11.0|^12.0",
"php": "^8.2",
"spatie/laravel-package-tools": "^1.15.0"
@@ -6266,7 +6266,7 @@
"type": "github"
}
],
"time": "2025-11-12T08:04:10+00:00"
"time": "2026-01-20T16:02:48+00:00"
},
{
"name": "symfony/clock",
@@ -10971,11 +10971,11 @@
},
{
"name": "phpstan/phpstan",
"version": "2.1.34",
"version": "2.1.35",
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/070ba754a949fcade788e16e8dc5a5935b7cf2ee",
"reference": "070ba754a949fcade788e16e8dc5a5935b7cf2ee",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/72f843c7f59d3aac0b7510f5e70913a9b72a8e88",
"reference": "72f843c7f59d3aac0b7510f5e70913a9b72a8e88",
"shasum": ""
},
"require": {
@@ -11020,7 +11020,7 @@
"type": "github"
}
],
"time": "2026-01-19T19:52:16+00:00"
"time": "2026-01-20T17:33:48+00:00"
},
{
"name": "phpunit/php-code-coverage",
@@ -12814,12 +12814,12 @@
],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"stability-flags": {},
"prefer-stable": true,
"prefer-lowest": false,
"platform": {
"php": "^8.3"
},
"platform-dev": [],
"plugin-api-version": "2.6.0"
"platform-dev": {},
"plugin-api-version": "2.9.0"
}
@@ -22,7 +22,9 @@ return new class extends Migration
$table->boolean('betsapi')->default(0);
$table->boolean('direct')->default(0);
$table->boolean('is_active')->default(0);
$table->integer('provider_id')->default(0)->nullable()->index()->references('id')->on('providers');
$table->boolean('in_soccer')->default(0);
$table->boolean('in_other')->default(0);
$table->boolean('need_check')->default(0);
$table->boolean('deleted')->default(0);
$table->timestamps();
});
@@ -20,7 +20,6 @@ return new class extends Migration
$table->integer('time_lastcheck')->default(0);
$table->integer('margin_threshold')->default(0);
$table->boolean('is_active')->default(false);
$table->boolean('is_hidden')->default(false);
$table->integer('sorting')->nullable()->default(0);
$table->timestamps();
});
+50 -50
View File
@@ -9,57 +9,57 @@ class BookmakerSeeder extends Seeder
{
public function run(): void
{
$sql = "INSERT INTO `bookmakers` (`id`, `name`, `icon`, `svg`, `baid`, `txso`, `txot`, `betsapi`, `direct`, `is_active`, `provider_id`, `deleted`, `created_at`, `updated_at`)
$sql = "INSERT INTO `bookmakers` (`id`, `name`, `icon`, `svg`, `baid`, `txso`, `txot`, `betsapi`, `direct`, `is_active`, `in_soccer`, `in_other`, `need_check`, `deleted`, `created_at`, `updated_at`)
VALUES
(1, 'MISSING', 'missing', NULL, 0, 0, 0, 2, 0, 0, 0, 0, NULL, '2025-08-23 10:07:59'),
(5, 'Expekt', 'expekt', NULL, 0, 1, 1, 1, 0, 1, 0, 0, NULL, NULL),
(6, 'UniBet', 'unibet', NULL, 10, 1, 1, 2, 0, 1, 0, 0, NULL, NULL),
(10, 'Magloo Nigeria', 'magloo-nig', NULL, 0, 0, 0, 1, 0, 1, 0, 0, NULL, '2025-08-23 10:19:02'),
(13, 'Sportingbet', 'sportingbet', NULL, 0, 1, 1, 1, 0, 1, 0, 0, NULL, NULL),
(14, 'Betika', 'betika', NULL, 0, 0, 0, 1, 0, 1, 0, 0, NULL, NULL),
(15, 'Intertops', 'intertops', NULL, 0, 0, 0, 1, 0, 1, 0, 0, NULL, NULL),
(16, 'Magloo Kenia', 'magloo-kenia', NULL, 0, 0, 0, 1, 0, 1, 0, 0, NULL, '2025-08-23 10:15:23'),
(17, 'Ladbrokes', 'ladbrokes', NULL, 7, 0, 1, 2, 0, 1, 0, 0, NULL, NULL),
(26, 'Interwetten', 'interwetten', NULL, 0, 1, 1, 1, 0, 1, 0, 0, NULL, NULL),
(30, 'BWin', 'bwin', NULL, 3, 1, 1, 2, 0, 1, 0, 0, NULL, '2025-08-23 10:08:34'),
(35, 'Logifuture Nigeria', 'logifuture-nig', NULL, 0, 0, 0, 1, 0, 1, 0, 0, NULL, NULL),
(36, 'Logifuture Colombia', 'logifuture-col', NULL, 0, 0, 0, 1, 0, 1, 0, 0, NULL, NULL),
(42, 'William Hill', 'willhill', NULL, 0, 1, 1, 1, 0, 1, 0, 0, NULL, NULL),
(49, 'Bet At Home', 'betathome', NULL, 0, 0, 1, 1, 0, 1, 0, 0, NULL, NULL),
(83, 'Pinnacle', 'pinnacle', NULL, 0, 1, 1, 1, 0, 1, 0, 0, NULL, NULL),
(110, 'BetFair', 'betfair', NULL, 4, 1, 0, 2, 0, 1, 0, 0, NULL, '2025-08-23 10:10:10'),
(117, 'SNAI', 'snai', NULL, 0, 1, 1, 1, 0, 1, 0, 0, NULL, NULL),
(118, 'Nordicbet', 'nordicbet', NULL, 0, 0, 1, 1, 0, 1, 0, 0, NULL, NULL),
(126, 'Bet365', 'bet365', NULL, 2, 0, 1, 2, 0, 1, 0, 0, NULL, '2025-08-23 10:08:17'),
(128, 'Goldbet', 'goldbet', NULL, 0, 0, 0, 1, 0, 1, 0, 0, NULL, NULL),
(234, '5 Dimes', '5dimes', NULL, 0, 1, 0, 1, 0, 1, 0, 1, NULL, NULL),
(274, '10Bet', '10bet', NULL, 6, 0, 1, 2, 0, 0, 0, 0, NULL, NULL),
(314, 'Matchbook', 'matchbook', NULL, 0, 1, 0, 1, 0, 1, 0, 0, NULL, NULL),
(327, 'Sbobet', 'sbobet', NULL, 14, 1, 0, 2, 0, 1, 0, 0, NULL, '2025-08-23 10:19:43'),
(340, 'Betway', 'betway', NULL, 5, 0, 0, 2, 0, 0, 0, 0, NULL, NULL),
(363, 'Tipico', 'tipico', NULL, 0, 0, 1, 1, 0, 1, 0, 0, NULL, NULL),
(380, 'PartyBets', 'partybets', NULL, 0, 1, 0, 1, 0, 1, 0, 0, NULL, NULL),
(388, 'Eurobet', 'eurobet', NULL, 0, 1, 1, 1, 0, 1, 0, 0, NULL, NULL),
(395, 'BetClick', 'betclick', NULL, 0, 1, 0, 1, 0, 1, 0, 0, NULL, NULL),
(399, 'Bet3000', 'bet3000', NULL, 0, 1, 1, 1, 0, 1, 0, 0, NULL, NULL),
(413, 'Better', 'better', NULL, 0, 0, 1, 1, 0, 1, 0, 0, NULL, NULL),
(539, 'Marathonbet', 'marathonbet', NULL, 0, 1, 1, 1, 0, 1, 0, 0, NULL, NULL),
(577, 'Sisal', 'sisal', NULL, 0, 0, 1, 1, 0, 1, 0, 0, NULL, NULL),
(625, 'Betaland', 'betaland', NULL, 0, 1, 0, 1, 0, 1, 0, 0, NULL, NULL),
(627, 'PlanetWin365', 'planetwin365', NULL, 8, 0, 0, 2, 0, 0, 0, 0, NULL, NULL),
(649, '1XBet', '1xbet', NULL, 18, 0, 0, 2, 0, 1, 2, 0, NULL, NULL),
(658, 'Bet9ja', 'bet9ja', NULL, 0, 0, 0, 1, 0, 1, 0, 0, NULL, NULL),
(668, 'SportPesa', 'sportpesa', NULL, 0, 1, 0, 1, 0, 1, 0, 0, NULL, NULL),
(823, 'BetKing', 'betking', NULL, 0, 1, 1, 1, 0, 1, 0, 0, NULL, NULL),
(824, 'BetPlay', 'betplay', NULL, 0, 1, 0, 1, 0, 1, 0, 0, NULL, NULL),
(825, 'SportyBet', 'sportybet', NULL, 0, 1, 1, 1, 0, 1, 0, 0, NULL, NULL),
(827, 'WPlay', 'wplay', NULL, 0, 1, 0, 1, 0, 1, 0, 0, NULL, NULL),
(828, 'ColBet', 'colbet', NULL, 0, 1, 0, 1, 0, 1, 0, 0, NULL, NULL),
(1000, '888Sport', '888sport', NULL, 11, 0, 0, 2, 0, 0, 0, 0, NULL, NULL),
(1001, 'Betsson', 'betsson', NULL, 13, 0, 0, 2, 0, 0, 0, 0, NULL, NULL),
(1002, 'DafaBet', 'dafabet', NULL, 16, 0, 0, 2, 0, 0, 0, 1, NULL, NULL),
(1003, 'BetVictor', 'betvictor', NULL, 17, 0, 0, 2, 0, 0, 0, 1, NULL, NULL),
(1004, 'TitanBet', 'titanbet', NULL, 15, 0, 0, 2, 0, 0, 0, 1, NULL, NULL);";
(1, 'MISSING', 'missing', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, '2025-08-23 10:07:59'),
(5, 'Expekt', 'expekt', NULL, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, NULL, '2026-01-21 08:02:55'),
(6, 'UniBet', 'unibet', NULL, 10, 1, 1, 0, 0, 1, 1, 1, 0, 0, NULL, '2026-01-21 08:08:47'),
(10, 'Magloo Nigeria', 'magloo-nig', NULL, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, NULL, '2026-01-21 08:05:32'),
(13, 'Sportingbet', 'sportingbet', NULL, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, NULL, '2026-01-21 08:08:30'),
(14, 'Betika', 'betika', NULL, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, NULL, '2026-01-21 08:01:21'),
(15, 'Intertops', 'intertops', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, '2026-01-21 08:05:13'),
(16, 'Magloo Kenia', 'magloo-kenia', NULL, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, NULL, '2026-01-21 08:05:31'),
(17, 'Ladbrokes', 'ladbrokes', NULL, 7, 1, 1, 0, 0, 1, 1, 1, 0, 0, NULL, '2026-01-21 08:05:40'),
(26, 'Interwetten', 'interwetten', NULL, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, NULL, '2026-01-21 08:03:06'),
(30, 'BWin', 'bwin', NULL, 3, 1, 1, 1, 0, 1, 1, 1, 0, 0, NULL, '2026-01-21 08:16:22'),
(35, 'Logifuture Nigeria', 'logifuture-nig', NULL, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, NULL, '2026-01-21 08:05:31'),
(36, 'Logifuture Colombia', 'logifuture-col', NULL, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, NULL, '2026-01-21 08:05:30'),
(42, 'William Hill', 'willhill', NULL, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, NULL, '2026-01-21 08:18:14'),
(49, 'Bet At Home', 'betathome', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, NULL, '2026-01-21 08:20:50'),
(83, 'Pinnacle', 'pinnacle', NULL, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, NULL, '2026-01-21 08:21:02'),
(110, 'BetFair', 'betfair', NULL, 4, 1, 0, 1, 0, 1, 1, 0, 1, 0, NULL, '2026-01-21 08:21:12'),
(117, 'SNAI', 'snai', NULL, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, NULL, '2026-01-21 08:08:28'),
(118, 'Nordicbet', 'nordicbet', NULL, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, NULL, '2026-01-21 08:03:29'),
(126, 'Bet365', 'bet365', NULL, 2, 0, 1, 1, 0, 1, 1, 1, 0, 0, NULL, '2026-01-21 08:02:11'),
(128, 'Goldbet', 'goldbet', NULL, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, NULL, '2026-01-21 08:22:36'),
(234, '5 Dimes', '5dimes', NULL, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, NULL, NULL),
(274, '10Bet', '10bet', NULL, 6, 0, 0, 0, 0, 0, 0, 0, 1, 0, NULL, '2026-01-21 08:22:47'),
(314, 'Matchbook', 'matchbook', NULL, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, NULL, '2026-01-21 08:06:53'),
(327, 'Sbobet', 'sbobet', NULL, 14, 1, 0, 0, 0, 1, 1, 0, 0, 0, NULL, '2026-01-21 08:03:43'),
(340, 'Betway', 'betway', NULL, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL),
(363, 'Tipico', 'tipico', NULL, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, NULL, '2026-01-21 08:08:45'),
(380, 'PartyBets', 'partybets', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, '2026-01-21 08:03:41'),
(388, 'Eurobet', 'eurobet', NULL, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, NULL, '2026-01-21 08:02:52'),
(395, 'BetClick', 'betclick', NULL, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, NULL, '2026-01-21 08:01:06'),
(399, 'Bet3000', 'bet3000', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, '2026-01-21 08:04:27'),
(413, 'Better', 'better', NULL, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, NULL, '2026-01-21 08:02:42'),
(539, 'Marathonbet', 'marathonbet', NULL, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, NULL, '2026-01-21 08:03:25'),
(577, 'Sisal', 'sisal', NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, '2026-01-21 08:03:55'),
(625, 'Betaland', 'betaland', NULL, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, NULL, '2026-01-21 08:01:05'),
(627, 'PlanetWin365', 'planetwin365', NULL, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL),
(649, '1XBet', '1xbet', NULL, 18, 1, 0, 0, 0, 1, 1, 0, 2, 0, NULL, '2026-01-21 08:13:48'),
(658, 'Bet9ja', 'bet9ja', NULL, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, NULL, '2026-01-21 08:08:03'),
(668, 'SportPesa', 'sportpesa', NULL, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, NULL, '2026-01-21 08:08:33'),
(823, 'BetKing', 'betking', NULL, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, NULL, '2026-01-21 08:16:03'),
(824, 'BetPlay', 'betplay', NULL, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, NULL, '2026-01-21 08:02:37'),
(825, 'SportyBet', 'sportybet', NULL, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, NULL, '2026-01-21 08:08:44'),
(827, 'WPlay', 'wplay', NULL, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, NULL, '2026-01-21 08:08:51'),
(828, 'ColBet', 'colbet', NULL, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, NULL, '2026-01-21 08:02:50'),
(1000, '888Sport', '888sport', NULL, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL),
(1001, 'Betsson', 'betsson', NULL, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL),
(1002, 'DafaBet', 'dafabet', NULL, 16, 0, 0, 0, 0, 0, 0, 0, 0, 1, NULL, NULL),
(1003, 'BetVictor', 'betvictor', NULL, 17, 0, 0, 0, 0, 0, 0, 0, 0, 1, NULL, NULL),
(1004, 'TitanBet', 'titanbet', NULL, 15, 0, 0, 0, 0, 0, 0, 0, 0, 1, NULL, NULL);";
DB::unprepared($sql);
}
+33
View File
@@ -73,4 +73,37 @@ button[wire\:click="resetTableFiltersForm"] {
#mapper_right .fi-ta-filter-indicators div button,
#mapper_left .fi-ta-filter-indicators div button {
display: block;
}
/* .fi-ta-table>tbody {
@apply divide-none
} */
#ComparingBookmakerMenu {
.fi-ta-cell,
.fi-input,
.fi-select-input,
.fi-ta-cell div {
padding-top: 1px !important;
padding-bottom: 1px !important;
margin-top: 0px !important;
margin-bottom: 0px !important;
border-radius: 0% !important;
}
.flex {
padding-top: 0px !important;
padding-bottom: 0px !important;
gap: 3px !important;
}
.fi-tabs {
padding-top: 3px !important;
padding-bottom: 3px !important;
}
.fi-header-heading {
font-size: 1.5rem !important;
}
}
@@ -1,3 +1,3 @@
<div>
<div id="ComparingBookmakerMenu">
{{ $this->table }}
</div>
</div>