filters ok
This commit is contained in:
1 parent
8e9bb0eacb
commit
98d92b2ee3
16 files changed
+365
-189
No files matched your search
@@ -7,7 +7,6 @@ use App\Filament\Resources\Events\Schemas\EventForm;
|
||||
use App\Filament\Resources\Events\Tables\EventsTable;
|
||||
use App\Filament\Resources\Events\Tables\Tools\LoadPartnerDifferences;
|
||||
use App\Models\Event;
|
||||
use Carbon\Carbon;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Table;
|
||||
@@ -47,7 +46,8 @@ class EventResource extends Resource
|
||||
public static function getNavigationBadge(): ?string
|
||||
{
|
||||
return parent::getEloquentQuery()
|
||||
->where('starttime', '>', Carbon::now())
|
||||
->where('sport_id', auth()->user()->sport_id)
|
||||
->where('starttime', '>', now())
|
||||
->count();
|
||||
}
|
||||
|
||||
@@ -60,6 +60,7 @@ class EventResource extends Resource
|
||||
->with('away')
|
||||
->with('event_user_star')
|
||||
->with('event_bookmaker')
|
||||
->where('sport_id', auth()->user()->sport_id)
|
||||
->where('starttime', '>=', now());
|
||||
|
||||
if (auth()->user()->stars) {
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
|
||||
namespace App\Filament\Resources\Events\Tables;
|
||||
|
||||
use App\Filament\Resources\Events\Tables\Tools\CompareOptions;
|
||||
use App\Filament\Resources\Events\Tables\Tools\LoadBettype;
|
||||
use App\Filament\Resources\Events\Tables\Tools\LoadCompareDifferences;
|
||||
use App\Filament\Resources\Events\Tables\Tools\LoadMultiline;
|
||||
use App\Filament\Tables\Columns\ColumnOdds;
|
||||
use App\Filament\Tables\Columns\EventColumn;
|
||||
@@ -15,8 +17,6 @@ use App\Models\EventBookmaker;
|
||||
use App\Models\EventUserStar;
|
||||
use App\Models\Group;
|
||||
use App\Models\OddsTable;
|
||||
use App\Models\Sport;
|
||||
use App\Models\User;
|
||||
use CodeWithKyrian\FilamentDateRange\Forms\Components\DateRangePicker;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\ActionGroup;
|
||||
@@ -53,8 +53,6 @@ class EventsTable
|
||||
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
self::$user = User::getUser();
|
||||
|
||||
LoadMultiline::load();
|
||||
|
||||
LoadBettype::load();
|
||||
@@ -83,7 +81,7 @@ class EventsTable
|
||||
|
||||
TextColumn::make('country.name')
|
||||
->wrap()
|
||||
->hidden(fn () => self::$user->sport_id == 5)
|
||||
->hidden(fn () => auth()->user()->sport_id == 5)
|
||||
->color('gray')
|
||||
->icon(fn ($record) => $record->country?->icon),
|
||||
|
||||
@@ -178,34 +176,13 @@ class EventsTable
|
||||
->extremePaginationLinks()
|
||||
->filters([
|
||||
Filter::make('events')
|
||||
->columns(8)->columnSpan(8)
|
||||
->columns(6)->columnSpan(6)
|
||||
->schema([
|
||||
Hidden::make('filter_alarm_green'),
|
||||
Hidden::make('filter_alarm_yellow'),
|
||||
Hidden::make('filter_alarm_red'),
|
||||
Select::make(name: 'sport_id')
|
||||
->options(fn () => Sport::getSportForClient())
|
||||
->default(self::$user->sport_id)
|
||||
->prefixIcon(self::$user->sport->icon)
|
||||
->selectablePlaceholder(false)
|
||||
->hiddenLabel()
|
||||
->afterStateUpdated(function (callable $set, $state, $livewire) {
|
||||
|
||||
User::where('id', self::$user->id)->update(['sport_id' => (int) $state]);
|
||||
|
||||
$livewire->dispatch('refreshBettypeMenu');
|
||||
$livewire->dispatch('reload_bookmaker_multiline');
|
||||
$livewire->dispatch('reload_alarm_bookmaker');
|
||||
$livewire->dispatch('refresh_comparing_bookmaker');
|
||||
$livewire->dispatch('refreshAlarmWidget');
|
||||
|
||||
$set('country_id', null);
|
||||
$set('competition_group_id', null);
|
||||
$set('group_id', null);
|
||||
|
||||
}),
|
||||
Select::make(name: 'country_id')
|
||||
->hidden(fn () => self::$user->sport_id == 5)
|
||||
->hidden(fn () => auth()->user()->sport_id == 5)
|
||||
->placeholder('Country')
|
||||
->prefixIcon('phosphor-flag')
|
||||
->hiddenLabel()
|
||||
@@ -214,7 +191,7 @@ class EventsTable
|
||||
->searchable()
|
||||
->preload()
|
||||
->options(function () {
|
||||
$res = Event::where('sport_id', self::$user->sport_id)->where('starttime', '>', Carbon::now())->groupBy('country_id')->pluck('country_id')->toArray();
|
||||
$res = Event::where('sport_id', auth()->user()->sport_id)->where('starttime', '>', Carbon::now())->groupBy('country_id')->pluck('country_id')->toArray();
|
||||
|
||||
return Country::query()->whereIn('id', $res)->orderBy('name')->pluck('name', 'id');
|
||||
})
|
||||
@@ -224,7 +201,7 @@ class EventsTable
|
||||
$set('competition_group_id', null);
|
||||
}),
|
||||
Select::make('competition_group_id')
|
||||
->hidden(fn () => self::$user->sport_id == 5)
|
||||
->hidden(fn () => auth()->user()->sport_id == 5)
|
||||
->placeholder('League')
|
||||
->prefixIcon('phosphor-trophy')
|
||||
->hiddenLabel()
|
||||
@@ -233,9 +210,9 @@ class EventsTable
|
||||
->searchable()
|
||||
->options(function (Get $get) {
|
||||
if ($get('country_id')) {
|
||||
$res = Event::where('sport_id', self::$user->sport_id)->with('country')->with('competition_group')->where('country_id', $get('country_id'))->where('starttime', '>', Carbon::now())->groupBy('competition_group_id')->get();
|
||||
$res = Event::where('sport_id', auth()->user()->sport_id)->with('country')->with('competition_group')->where('country_id', $get('country_id'))->where('starttime', '>', Carbon::now())->groupBy('competition_group_id')->get();
|
||||
} else {
|
||||
$res = Event::where('sport_id', self::$user->sport_id)->with('country')->with('competition_group')->where('starttime', '>', Carbon::now())->groupBy('competition_group_id')->get();
|
||||
$res = Event::where('sport_id', auth()->user()->sport_id)->with('country')->with('competition_group')->where('starttime', '>', Carbon::now())->groupBy('competition_group_id')->get();
|
||||
}
|
||||
$arr = [];
|
||||
foreach ($res as $val) {
|
||||
@@ -247,7 +224,7 @@ class EventsTable
|
||||
})
|
||||
->live(),
|
||||
Select::make('group_id')
|
||||
->visible(fn () => self::$user->sport_id == 5)
|
||||
->visible(fn () => auth()->user()->sport_id == 5)
|
||||
->placeholder('Tournament')
|
||||
->prefixIcon('phosphor-trophy')
|
||||
->hiddenLabel()
|
||||
@@ -256,9 +233,9 @@ class EventsTable
|
||||
->searchable()
|
||||
->options(function (Get $get) {
|
||||
if ($get('country_id')) {
|
||||
$res = Event::with('country')->where('sport_id', self::$user->sport_id)->with('group')->where('country_id', $get('country_id'))->where('starttime', '>', Carbon::now())->groupBy('group_id')->get();
|
||||
$res = Event::with('country')->where('sport_id', auth()->user()->sport_id)->with('group')->where('country_id', $get('country_id'))->where('starttime', '>', Carbon::now())->groupBy('group_id')->get();
|
||||
} else {
|
||||
$res = Event::with('country')->where('sport_id', self::$user->sport_id)->with('group')->where('starttime', '>', Carbon::now())->groupBy('group_id')->get();
|
||||
$res = Event::with('country')->where('sport_id', auth()->user()->sport_id)->with('group')->where('starttime', '>', Carbon::now())->groupBy('group_id')->get();
|
||||
}
|
||||
$arr = [];
|
||||
foreach ($res as $val) {
|
||||
@@ -289,52 +266,15 @@ class EventsTable
|
||||
->hiddenLabel()
|
||||
->live(),
|
||||
|
||||
Select::make('special_filter_lteq')
|
||||
Select::make('filter_compare_differences')
|
||||
->placeholder('Compare')
|
||||
->prefixIcon('phosphor-funnel')
|
||||
->hiddenLabel()
|
||||
->allowHtml()
|
||||
->options([
|
||||
'Compare Favorits' => [
|
||||
'flte1' => 'Favorit ≤ Marathonbet',
|
||||
'flte2' => 'Favorit ≤ Bet365',
|
||||
'flte3' => 'Favorit ≤ 1Bet',
|
||||
'flte4' => 'Favorit ≤ Eurobet',
|
||||
'mlt1' => 'Favorit ≥ Marathonbet',
|
||||
'mlt2' => 'Favorit ≥ Bet365',
|
||||
'mlt3' => 'Favorit ≥ 1Bet',
|
||||
'mlt4' => 'Favorit ≥ Eurobet',
|
||||
],
|
||||
'Compare Margins' => [
|
||||
'mgt1' => 'Margin ≥ Marathonbet',
|
||||
'mgt2' => 'Margin ≥ Bet365',
|
||||
'mgt3' => 'Margin ≥ 1Bet',
|
||||
'mgt4' => 'Margin ≥ Eurobet',
|
||||
'mlt1' => 'Margin < Marathonbet',
|
||||
'mlt2' => 'Margin < Bet365',
|
||||
'mlt3' => 'Margin < 1Bet',
|
||||
'mlt4' => 'Margin < Eurobet',
|
||||
],
|
||||
'Compare X' => [
|
||||
'xlt1' => 'X < Marathonbet',
|
||||
'xlt2' => 'X < Bet365',
|
||||
'xlt3' => 'X < 1Bet',
|
||||
'xlt4' => 'X < Eurobet',
|
||||
],
|
||||
]),
|
||||
|
||||
Select::make('filter_missing')
|
||||
->placeholder('Missing')
|
||||
->prefixIcon('phosphor-cow')
|
||||
->hiddenLabel()
|
||||
->allowHtml()
|
||||
->options([1 => '1Bets']),
|
||||
->options(fn () => CompareOptions::load()),
|
||||
])
|
||||
->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->where('country_id', $country_id)
|
||||
)->when(
|
||||
@@ -413,6 +353,29 @@ class EventsTable
|
||||
});
|
||||
});
|
||||
}
|
||||
)->when(
|
||||
$data['filter_compare_differences'],
|
||||
function (Builder $query, $filter_compare_differences) {
|
||||
|
||||
$opt = explode('-', $filter_compare_differences);
|
||||
|
||||
$compare_bookmaker_id = (int) $opt[2];
|
||||
|
||||
switch (auth()->user()->sport_id) {
|
||||
case 1:
|
||||
case 2:
|
||||
$event_ids = LoadCompareDifferences::load($opt[0], $opt[1], 'odds_3ways', $compare_bookmaker_id);
|
||||
break;
|
||||
case 3:
|
||||
$event_ids = LoadCompareDifferences::load($opt[0], $opt[1], 'odds_points', $compare_bookmaker_id);
|
||||
break;
|
||||
case 5:
|
||||
$event_ids = LoadCompareDifferences::load($opt[0], $opt[1], 'odds_2ways', $compare_bookmaker_id);
|
||||
break;
|
||||
|
||||
}
|
||||
$query->whereIn('id', $event_ids);
|
||||
}
|
||||
|
||||
)->when(
|
||||
$data['favorit_threshold'],
|
||||
@@ -523,6 +486,24 @@ class EventsTable
|
||||
$indicators[] = Indicator::make('Favorits')->removeField('stars_status')->color('info');
|
||||
}
|
||||
|
||||
if ($data['filter_compare_differences'] ?? null) {
|
||||
$opt = explode('-', $data['filter_compare_differences']);
|
||||
$title = $opt[0];
|
||||
switch ($opt[1]) {
|
||||
case 'lte':
|
||||
$title .= ' ≤ ';
|
||||
break;
|
||||
case 'gte':
|
||||
$title .= ' ≥ ';
|
||||
break;
|
||||
case 'lt':
|
||||
$title .= ' > ';
|
||||
break;
|
||||
}
|
||||
$title .= $opt[3];
|
||||
$indicators[] = Indicator::make($title)->removeField('filter_compare_differences')->color('warning');
|
||||
}
|
||||
|
||||
return $indicators;
|
||||
}),
|
||||
], layout: FiltersLayout::AboveContent)
|
||||
@@ -551,20 +532,20 @@ class EventsTable
|
||||
->tooltip('Add to favorits')
|
||||
->action(function ($record) {
|
||||
$res = EventUserStar::where('event_id', $record->id)
|
||||
->where('user_id', self::$user->id)
|
||||
->where('user_id', auth()->user()->id)
|
||||
->first();
|
||||
if ($res) {
|
||||
EventUserStar::find($res->id)->delete();
|
||||
} else {
|
||||
EventUserStar::insert(['event_id' => $record->id, 'user_id' => self::$user->id]);
|
||||
EventUserStar::insert(['event_id' => $record->id, 'user_id' => auth()->user()->id]);
|
||||
}
|
||||
}),
|
||||
ActionGroup::make([
|
||||
// EditAction::make(),
|
||||
DeleteAction::make()->visible(fn () => self::$user->hasRole('super_admin')),
|
||||
DeleteAction::make()->visible(fn () => auth()->user()->hasRole('super_admin')),
|
||||
Action::make('txodds_odds')
|
||||
->label('TxOdds')
|
||||
->disabled(fn () => ! self::$user->hasRole('super_admin'))
|
||||
->disabled(fn () => ! auth()->user()->hasRole('super_admin'))
|
||||
->icon('phosphor-arrow-square-out')
|
||||
->url(fn ($record): string => route('txodds_odds', ['sportid' => $record->sport_id, 'txoddsid' => $record->id]))
|
||||
->openUrlInNewTab(),
|
||||
@@ -580,7 +561,7 @@ class EventsTable
|
||||
->icon('phosphor-dots-three-vertical'),
|
||||
])->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make()->visible(fn () => self::$user->hasRole('super_admin')),
|
||||
DeleteBulkAction::make()->visible(fn () => auth()->user()->hasRole('super_admin')),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Events\Tables\Tools;
|
||||
|
||||
use App\Filament\Resources\Events\Tables\EventsTable;
|
||||
use App\Models\Bookmaker;
|
||||
|
||||
class CompareOptions
|
||||
{
|
||||
public static function load()
|
||||
{
|
||||
|
||||
$map = Bookmaker::map();
|
||||
$favorits = [];
|
||||
$margins = [];
|
||||
$x = [];
|
||||
switch (auth()->user()->sport_id) {
|
||||
case 1:
|
||||
case 2:
|
||||
$table = 'odds_3ways';
|
||||
break;
|
||||
case 3:
|
||||
$table = 'odds_points';
|
||||
break;
|
||||
case 5:
|
||||
$table = 'odds_2ways';
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
$options = [];
|
||||
foreach (EventsTable::$slots[$table] as $bookmaker_id) {
|
||||
$option = 'Favorit-lte-'.$bookmaker_id.'-'.$map[$bookmaker_id]['name'];
|
||||
$favorits[$option] = 'Favorit ≤ '.$map[$bookmaker_id]['name'];
|
||||
}
|
||||
foreach (EventsTable::$slots[$table] as $bookmaker_id) {
|
||||
$option = 'Favorit-gte-'.$bookmaker_id.'-'.$map[$bookmaker_id]['name'];
|
||||
$favorits[$option] = 'Favorit ≥ '.$map[$bookmaker_id]['name'];
|
||||
}
|
||||
$options['Favorits'] = $favorits;
|
||||
|
||||
foreach (EventsTable::$slots[$table] as $bookmaker_id) {
|
||||
$option = 'Margin-gte-'.$bookmaker_id.'-'.$map[$bookmaker_id]['name'];
|
||||
$margins[$option] = 'Margin ≥ '.$map[$bookmaker_id]['name'];
|
||||
}
|
||||
foreach (EventsTable::$slots[$table] as $bookmaker_id) {
|
||||
$option = 'Margin-lt-'.$bookmaker_id.'-'.$map[$bookmaker_id]['name'];
|
||||
$margins[$option] = 'Margin < '.$map[$bookmaker_id]['name'];
|
||||
}
|
||||
$options['Margins'] = $margins;
|
||||
|
||||
if (auth()->user()->sport_id == 1) {
|
||||
foreach (EventsTable::$slots[$table] as $bookmaker_id) {
|
||||
$option = 'X-lt-'.$bookmaker_id.'-'.$map[$bookmaker_id]['name'];
|
||||
$x[$option] = 'X < '.$map[$bookmaker_id]['name'];
|
||||
}
|
||||
$options['X'] = $x;
|
||||
}
|
||||
|
||||
return $options;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Events\Tables\Tools;
|
||||
|
||||
use App\Models\OddsTable;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class LoadCompareDifferences
|
||||
{
|
||||
public static function load($target, $mode, $table, $compare_bookmaker_id)
|
||||
{
|
||||
$fields = OddsTable::fields();
|
||||
|
||||
// dd($target, $mode, $table, $compare_bookmaker_id);
|
||||
|
||||
// echo $table."\n";
|
||||
// dd(auth()->user()->sport_id);
|
||||
|
||||
$has_active_spread = OddsTable::where('name', $table)->value('has_active_spread');
|
||||
|
||||
if ($has_active_spread) {
|
||||
$clients = DB::table($table)
|
||||
->where('bookmaker_id', auth()->user()->bookmaker_id)
|
||||
->where('active_spread', 1)
|
||||
->get();
|
||||
$comparing = DB::table($table)
|
||||
->where('bookmaker_id', $compare_bookmaker_id)
|
||||
->where('active_spread', 1)
|
||||
->get();
|
||||
} else {
|
||||
// $clients = DB::table($table)->whereIn('bookmaker_id', [auth()->user()->bookmaker_id, $compare_bookmaker_id])->get();
|
||||
$clients = DB::table($table)
|
||||
->where('bookmaker_id', auth()->user()->bookmaker_id)
|
||||
->get();
|
||||
$comparing = DB::table($table)
|
||||
->where('bookmaker_id', $compare_bookmaker_id)
|
||||
->get();
|
||||
}
|
||||
|
||||
$event_ids = [];
|
||||
foreach ($clients as $client) {
|
||||
|
||||
$row1 = get_object_vars($client);
|
||||
|
||||
foreach ($comparing as $compare) {
|
||||
|
||||
$row2 = get_object_vars($compare);
|
||||
|
||||
if ($row1['event_id'] == $row2['event_id']) {
|
||||
|
||||
switch ($target) {
|
||||
case 'Favorit':
|
||||
$bk = 100;
|
||||
$co = 100;
|
||||
foreach ($fields[$table] as $field) {
|
||||
if ($row1[$field] < $bk) {
|
||||
$bk = $row1[$field];
|
||||
}
|
||||
if ($row2[$field] < $co) {
|
||||
$co = $row2[$field];
|
||||
}
|
||||
}
|
||||
switch ($mode) {
|
||||
case 'lte':
|
||||
|
||||
if ($bk > 1 && $co > 1 && $bk <= $co) {
|
||||
$event_ids[] = $row1['event_id'];
|
||||
}
|
||||
break;
|
||||
case 'gte':
|
||||
if ($bk > 1 && $co > 1 && $bk >= $co) {
|
||||
$event_ids[] = $row1['event_id'];
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
case 'Margin':
|
||||
switch ($mode) {
|
||||
case 'gte':
|
||||
if ($row1['margin'] >= $row2['margin']) {
|
||||
$event_ids[] = $row1['event_id'];
|
||||
}
|
||||
break;
|
||||
case 'lt':
|
||||
if ($row1['margin'] < $row2['margin']) {
|
||||
$event_ids[] = $row1['event_id'];
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
case 'X':
|
||||
if ($row1['d3w'] < $row2['d3w']) {
|
||||
$event_ids[] = $row1['event_id'];
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return array_unique($event_ids);
|
||||
}
|
||||
}
|
||||
@@ -13,8 +13,8 @@ class LoadMultiline
|
||||
|
||||
public static function load()
|
||||
{
|
||||
$cb = ComparingBookmaker::where('sport_id', EventsTable::$user->sport_id)
|
||||
->where('client_bookmaker_id', EventsTable::$user->bookmaker_id)
|
||||
$cb = ComparingBookmaker::where('sport_id', auth()->user()->sport_id)
|
||||
->where('client_bookmaker_id', auth()->user()->bookmaker_id)
|
||||
->orderBy('sorting', 'desc')
|
||||
->select('bookmaker_id', 'time_lastcheck', 'margin_threshold', 'is_active')
|
||||
->get();
|
||||
@@ -22,7 +22,7 @@ class LoadMultiline
|
||||
$bookmakers = [];
|
||||
$filter = [];
|
||||
foreach ($cb as $value) {
|
||||
if (EventsTable::$user->bookmaker_id != $value->bookmaker_id) {
|
||||
if (auth()->user()->bookmaker_id != $value->bookmaker_id) {
|
||||
$bookmakers[] = $value->bookmaker_id;
|
||||
$filter[$value->bookmaker_id] = [
|
||||
'time_lastcheck' => $value->time_lastcheck,
|
||||
@@ -31,7 +31,7 @@ class LoadMultiline
|
||||
}
|
||||
}
|
||||
|
||||
$res = MultilineSetting::where('sport_id', EventsTable::$user->sport_id)->get();
|
||||
$res = MultilineSetting::where('sport_id', auth()->user()->sport_id)->get();
|
||||
|
||||
foreach ($res as $value) {
|
||||
EventsTable::$filter[$value->table] = $filter;
|
||||
|
||||
@@ -11,14 +11,29 @@ class LoadPartnerDifferences
|
||||
public static function load()
|
||||
{
|
||||
$fields = OddsTable::fields();
|
||||
|
||||
$event_ids = [];
|
||||
foreach (EventsTable::$bettype_settings as $table) {
|
||||
$books = DB::table($table)
|
||||
->where('bookmaker_id', auth()->user()->bookmaker_id)
|
||||
->get();
|
||||
$partners = DB::table($table)
|
||||
->where('bookmaker_id', auth()->user()->partner_bookmaker_id)
|
||||
->get();
|
||||
|
||||
$has_active_spread = OddsTable::where('name', $table)->value('has_active_spread');
|
||||
|
||||
if ($has_active_spread) {
|
||||
$books = DB::table($table)
|
||||
->where('bookmaker_id', auth()->user()->bookmaker_id)
|
||||
->where('active_spread', 1)
|
||||
->get();
|
||||
$partners = DB::table($table)
|
||||
->where('bookmaker_id', auth()->user()->partner_bookmaker_id)
|
||||
->where('active_spread', 1)
|
||||
->get();
|
||||
} else {
|
||||
$books = DB::table($table)
|
||||
->where('bookmaker_id', auth()->user()->bookmaker_id)
|
||||
->get();
|
||||
$partners = DB::table($table)
|
||||
->where('bookmaker_id', auth()->user()->partner_bookmaker_id)
|
||||
->get();
|
||||
}
|
||||
|
||||
foreach ($books as $book) {
|
||||
$row1 = get_object_vars($book);
|
||||
|
||||
@@ -92,6 +92,8 @@ class AlarmWidget extends StatsOverviewWidget
|
||||
];
|
||||
}
|
||||
|
||||
return [];
|
||||
|
||||
}
|
||||
|
||||
public function filterAlarm($table, $alarm)
|
||||
|
||||
@@ -22,4 +22,18 @@ class Bookmaker extends Model
|
||||
{
|
||||
return $this->belongsTo(Sport::class)->where('is_active', 1);
|
||||
}
|
||||
|
||||
public static function map()
|
||||
{
|
||||
$arr = [];
|
||||
$res = Bookmaker::query()->where('is_active', 1)->get();
|
||||
foreach ($res as $value) {
|
||||
$arr[$value->id] = [
|
||||
'name' => $value->name,
|
||||
'icon' => $value->icon,
|
||||
];
|
||||
}
|
||||
|
||||
return $arr;
|
||||
}
|
||||
}
|
||||
@@ -28,16 +28,9 @@ 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);
|
||||
|
||||
$sports = Client::where('id', $user->client_id)->value('sport');
|
||||
$sports = Client::where('id', auth()->user()->client_id)->value('sport');
|
||||
|
||||
return Sport::query()->whereIn('id', $sports)->pluck('name', 'id');
|
||||
|
||||
|
||||
@@ -32,13 +32,13 @@ class AppServiceProvider extends ServiceProvider
|
||||
PanelsRenderHook::USER_MENU_PROFILE_AFTER,
|
||||
fn (): string => Blade::render('@livewire(\'konto-switcher\')'),
|
||||
);
|
||||
// FilamentView::registerRenderHook(
|
||||
// TablesRenderHook::TOOLBAR_SEARCH_BEFORE,
|
||||
// fn (): string => Blade::render('@livewire(\'sport-switcher\')'),
|
||||
// scopes: [
|
||||
// ListEvents::class,
|
||||
// ]
|
||||
// );
|
||||
FilamentView::registerRenderHook(
|
||||
TablesRenderHook::TOOLBAR_SEARCH_BEFORE,
|
||||
fn (): string => Blade::render('@livewire(\'sport-switcher\')'),
|
||||
scopes: [
|
||||
ListEvents::class,
|
||||
]
|
||||
);
|
||||
FilamentView::registerRenderHook(
|
||||
TablesRenderHook::TOOLBAR_SEARCH_AFTER,
|
||||
fn (): string => Blade::render('@livewire(\'bettype-toggle\')'),
|
||||
|
||||
Reference in new issue
Block a user