This commit is contained in:
salam committed 2026-01-26 18:26:02 +01:00
1 parent 9ca5657827
commit 6f3d608704
47 files changed
+1005 -145

No files matched your search

-12
View File
@@ -1,12 +0,0 @@
<?php
namespace App\Actions;
class AlarmGenerator
{
public static function run($record)
{
dd($record);
}
}
@@ -72,6 +72,7 @@ class Bet365
EventBookmaker::updateOrCreate([
'event_id' => $event->id,
'sport_id' => $event->sport_id,
'bookmaker_id' => $bookmaker_id,
], ['starttime' => $event->starttime, 'in_feed' => 1, 'bmoid' => $event->bet365_id]);
@@ -52,22 +52,30 @@ class FindFixture
case 3:
// MAGLOO KENIA
$res = EventBookmaker::where('bookmaker_id', 10)->where('event_id', $event_id)->first();
$match = Event::where('id', $res->event_id)->first();
if ($res) {
$match = Event::where('id', $res->event_id)->first();
}
break;
case 4:
// MAGLOO NIGERIA
$res = EventBookmaker::where('bookmaker_id', 16)->where('event_id', $event_id)->first();
$match = Event::where('id', $res->event_id)->first();
if ($res) {
$match = Event::where('id', $res->event_id)->first();
}
break;
case 5:
// LOGIFUTUR NIGERA
$res = EventBookmaker::where('bookmaker_id', 35)->where('event_id', $event_id)->first();
$match = Event::where('id', $res->event_id)->first();
if ($res) {
$match = Event::where('id', $res->event_id)->first();
}
break;
case 6:
// LOGIFUTUR COLOMBIA
$res = EventBookmaker::where('bookmaker_id', 36)->where('event_id', $event_id)->first();
$match = Event::where('id', $res->event_id)->first();
if ($res) {
$match = Event::where('id', $res->event_id)->first();
}
break;
}
}
@@ -59,6 +59,7 @@ class Logifuture
EventBookmaker::updateOrCreate([
'event_id' => $event['id'],
'sport_id' => $sport_id,
'bookmaker_id' => Nuh::$options['bookmaker_id'],
], ['in_feed' => 1, 'bmoid' => $event['event_id'], 'startime' => $event['starttime']]);
@@ -106,8 +106,9 @@ class Fixtures
EventBookmaker::updateOrCreate([
'event_id' => $event['id'],
'sport_id' => $sport_id,
'bookmaker_id' => Nuh::$options['bookmaker_id'],
], ['in_feed' => 1, 'bmoid' => $event['event_id']]);
], ['in_feed' => 1, 'bmoid' => $event['event_id'], 'starttime' => $event['starttime']]);
}
}
}
+1 -2
View File
@@ -57,8 +57,6 @@ class Odds
$betradar_id = (int) preg_replace('/\D/', '', $match['p']);
$bmoid = preg_replace('/\D/', '', $match['i']);
$starttime = Carbon::parse($match['dt'])->toDateTimeString();
$event_id = Event::where('betradar_id', $betradar_id)->value('id');
@@ -77,6 +75,7 @@ class Odds
EventBookmaker::updateOrCreate([
'event_id' => $event_id,
'sport_id' => $sport_id,
'bookmaker_id' => Nuh::$options['bookmaker_id'],
], ['starttime' => $starttime, 'in_feed' => 1, 'bmoid' => $base['bmoid']]);
@@ -8,10 +8,19 @@ class FilterTotals
{
$_totals = [];
foreach ($_array as $total => $value) {
if (fmod(abs($total), 1) == 0.5) {
if ($value[12] > 1 and $value[13] > 1) {
$_totals[$total]['over'] = number_format($value[12], 2);
$_totals[$total]['under'] = number_format($value[13], 2);
if ($sport_id == 1) {
if ($total == 2.5) {
if ($value[12] > 1 and $value[13] > 1) {
$_totals[$total]['over'] = number_format($value[12], 2);
$_totals[$total]['under'] = number_format($value[13], 2);
}
}
} else {
if (fmod(abs($total), 1) == 0.5) {
if ($value[12] > 1 and $value[13] > 1) {
$_totals[$total]['over'] = number_format($value[12], 2);
$_totals[$total]['under'] = number_format($value[13], 2);
}
}
}
}
@@ -14,6 +14,7 @@ class MaglooStore1x2
$odds['d3w'] = number_format($value['static'][2], 2) ?? 1;
$odds['a3w'] = number_format($value['static'][3], 2) ?? 1;
$odds['margin'] = (float) Margin::calculate($odds, 1);
$odds['flags'] = 1;
$odds = array_merge($odds, $base);
$res = Odds3way::where('event_id', $base['event_id'])->where('bookmaker_id', $base['bookmaker_id'])->first();
@@ -23,6 +24,7 @@ class MaglooStore1x2
$res->h3w = $odds['h3w'];
$res->a3w = $odds['d3w'];
$res->d3w = $odds['a3w'];
$res->flags = 1;
if ($res->isDirty()) {
$res->oddchange_at = now();
}
@@ -14,6 +14,7 @@ class MaglooStoreDc
$odds['dc12'] = number_format($value['static'][10], 2) ?? 1;
$odds['dcx2'] = number_format($value['static'][11], 2) ?? 1;
$odds['margin'] = (float) Margin::calculate($odds, 1);
$odds['flags'] = 1;
$odds = array_merge($odds, $base);
$res = OddsDc::where('event_id', $base['event_id'])->where('bookmaker_id', $base['bookmaker_id'])->first();
@@ -24,6 +25,7 @@ class MaglooStoreDc
$res->dc1x = $odds['dc1x'];
$res->dc12 = $odds['dc12'];
$res->dcx2 = $odds['dcx2'];
$res->flags = 1;
if ($res->isDirty()) {
$res->oddchange_at = now();
}
@@ -13,6 +13,7 @@ class MaglooStoreGgng
$odds['gg'] = number_format($value['static'][74], 2) ?? 1;
$odds['ng'] = number_format($value['static'][76], 2) ?? 1;
$odds['margin'] = (float) Margin::calculate($odds, 1);
$odds['flags'] = 1;
$odds = array_merge($odds, $base);
$res = OddsGgng::where('event_id', $base['event_id'])->where('bookmaker_id', $base['bookmaker_id'])->first();
@@ -22,6 +23,7 @@ class MaglooStoreGgng
} else {
$res->gg = $odds['gg'];
$res->ng = $odds['ng'];
$res->flags = 1;
if ($res->isDirty()) {
$res->oddchange_at = now();
}
@@ -17,6 +17,7 @@ class MaglooStorePoints
$odds['active_spread'] = $value['active_spread'];
$odds['handicap'] = $handicap;
$odds['difference'] = abs(1 / $odds['home'] - 1 / $odds['away']);
$odds['flags'] = 1;
$odds = array_merge($odds, $base);
@@ -28,6 +29,7 @@ class MaglooStorePoints
if (! $res) {
OddsPoint::create($odds);
} else {
$res->flags = 1;
$res->home = number_format($odds['home'], 2);
$res->away = number_format($odds['away'], 2);
$res->handicap = number_format($odds['handicap'], 2);
@@ -17,6 +17,7 @@ class MaglooStorePointsQ1
$odds['active_spread'] = $value['active_spread'];
$odds['handicap'] = $handicap;
$odds['difference'] = abs(1 / $odds['home'] - 1 / $odds['away']);
$odds['flags'] = 1;
$odds = array_merge($odds, $base);
@@ -28,6 +29,7 @@ class MaglooStorePointsQ1
if (! $res) {
OddsPointQ1::create($odds);
} else {
$res->flags = 1;
$res->home = number_format($odds['home'], 2);
$res->away = number_format($odds['away'], 2);
$res->handicap = number_format($odds['handicap'], 2);
@@ -17,6 +17,7 @@ class MaglooStoreTotals
$odds['active_spread'] = $value['active_spread'];
$odds['total'] = $total;
$odds['difference'] = abs(1 / $odds['over'] - 1 / $odds['under']);
$odds['flags'] = 1;
$odds = array_merge($odds, $base);
@@ -28,6 +29,7 @@ class MaglooStoreTotals
if (! $res) {
OddsTotal::create($odds);
} else {
$res->flags = 1;
$res->over = number_format($odds['over'], 2);
$res->under = number_format($odds['under'], 2);
$res->total = number_format($odds['total'], 2);
@@ -17,6 +17,7 @@ class MaglooStoreTotalsQ1
$odds['active_spread'] = $value['active_spread'];
$odds['total'] = $total;
$odds['difference'] = abs(1 / $odds['over'] - 1 / $odds['under']);
$odds['flags'] = 1;
$odds = array_merge($odds, $base);
@@ -28,6 +29,7 @@ class MaglooStoreTotalsQ1
if (! $res) {
OddsTotalQ1::create($odds);
} else {
$res->flags = 1;
$res->over = number_format($odds['over'], 2);
$res->under = number_format($odds['under'], 2);
$res->total = number_format($odds['total'], 2);
@@ -14,12 +14,14 @@ class MaglooStoreTq
$odds['atq'] = number_format($value['static'][5], 2) ?? 1;
$odds['margin'] = (float) Margin::calculate($odds, 1);
$odds = array_merge($odds, $base);
$odds['flags'] = 1;
$res = OddsTq::where('event_id', $base['event_id'])->where('bookmaker_id', $base['bookmaker_id'])->first();
if (! $res) {
OddsTq::create($odds);
} else {
$res->flags = 1;
$res->htq = $odds['htq'];
$res->atq = $odds['atq'];
if ($res->isDirty()) {
@@ -319,6 +319,7 @@ class Odds
case 'starting_time':
EventBookmaker::updateOrInsert([
'event_id' => $event_id,
'sport_id' => $sport_id,
'bookmaker_id' => $bookmaker_id,
], ['starttime' => $attributeValue]);
break;
@@ -333,6 +334,7 @@ class Odds
case 'starting_time':
EventBookmaker::updateOrInsert([
'event_id' => $event_id,
'sport_id' => $sport_id,
'bookmaker_id' => $bookmaker_id,
], ['starttime' => $attributeValue]);
break;
@@ -347,6 +349,7 @@ class Odds
case 'starting_time':
EventBookmaker::updateOrInsert([
'event_id' => $event_id,
'sport_id' => $sport_id,
'bookmaker_id' => $bookmaker_id,
], ['starttime' => $attributeValue]);
break;
@@ -3,6 +3,7 @@
namespace App\Console\Commands\Services;
use App\Console\Commands\Nuh;
use App\Console\Commands\Services\Tasks\AlarmGenerator;
use App\Console\Commands\Services\Tasks\CallTxoddsMarkets;
use App\Console\Commands\Services\Tasks\DBMapper;
use App\Console\Commands\Services\Tasks\GenerateDefaultSetting;
@@ -21,6 +22,9 @@ class Services
case 'Generate Default Setting':
GenerateDefaultSetting::run();
break;
case 'Alarm Generator':
AlarmGenerator::run();
break;
}
}
@@ -0,0 +1,30 @@
<?php
namespace App\Console\Commands\Services\Tasks\Alarm;
use App\Console\Commands\Nuh;
use App\Models\ComparingBookmaker;
class AlarmBookmakerFilter
{
public static function get($client_bookmaker_id)
{
$res = ComparingBookmaker::where('sport_id', Nuh::$options['sport_id'])
->where('client_bookmaker_id', $client_bookmaker_id)
->where('is_active', 1)
->orderBy('sorting', 'asc')
->select('bookmaker_id', 'time_lastcheck', 'margin_threshold', 'sorting')
->get();
$arr = [];
foreach ($res as $value) {
$arr[$value->bookmaker_id] = [
'sorting' => $value->sorting,
'time_lastcheck' => $value->time_lastcheck,
'margin_threshold' => $value->margin_threshold,
];
}
return $arr;
}
}
@@ -0,0 +1,16 @@
<?php
namespace App\Console\Commands\Services\Tasks\Alarm;
class AlarmFilterClient
{
public static function get($odds, $client_bookmaker_id)
{
if (isset($odds[$client_bookmaker_id])) {
return $odds[$client_bookmaker_id];
}
return [];
}
}
@@ -0,0 +1,23 @@
<?php
namespace App\Console\Commands\Services\Tasks\Alarm;
class AlarmFilterCompare
{
public static function get($odds, $filter)
{
foreach ($filter as $bookmaker_id => $value) {
if (isset($odds[$bookmaker_id])) {
$data = $odds[$bookmaker_id];
if ($data['margin'] <= $value['margin_threshold']) {
$data['bookmaker_id'] = $bookmaker_id;
return $data;
}
}
}
return [];
}
}
@@ -0,0 +1,29 @@
<?php
namespace App\Console\Commands\Services\Tasks\Alarm;
use Illuminate\Support\Facades\DB;
class AlarmLoadOdds
{
public static function get($event_id, $table, $oddnames)
{
$res = DB::table($table)->where('flags', 1)->where('event_id', $event_id)->get();
$odds = explode(',', $oddnames);
$arr = [];
foreach ($res as $value) {
if ($table == 'odds_dc') {
$arr[(int) $value->bookmaker_id]['margin'] = (float) $value->margin * 2;
} else {
$arr[(int) $value->bookmaker_id]['margin'] = (float) $value->margin;
}
foreach ($odds as $odd) {
$arr[(int) $value->bookmaker_id][$odd] = (float) $value->$odd;
}
}
return $arr;
}
}
@@ -0,0 +1,28 @@
<?php
namespace App\Console\Commands\Services\Tasks\Alarm;
class AlarmMap
{
public static function get($table)
{
$map = [
'odds_2ways' => ['alarm_2w_h2w' => 'h3w', 'alarm_2w_a2w' => 'a2w'],
'odds_2ways_s1' => ['alarm_2ws1_h2w' => 'h3w', 'alarm_2ws1_a2w' => 'a2w'],
'odds_3ways' => ['alarm_3w_h3w' => 'h3w', 'alarm_3w_d3w' => 'd3w', 'alarm_3w_a3w' => 'a3w'],
'odds_3ways_ht' => ['alarm_3wht_h3w' => 'h3w', 'alarm_3wht_d3w' => 'd3w', 'alarm_3wht_a3w' => 'a3w'],
'odds_dc' => ['alarm_dc_dc1x' => 'dc1x', 'alarm_dc_dc12' => 'dc12', 'alarm_dc_dcx2' => 'dcx2'],
'odds_dnb' => ['alarm_dbn_dnb1' => 'dnb1', 'alarm_dbn_dnb2' => 'dnb2'],
'odds_ggng' => ['alarm_ggng_gg' => 'gg', 'alarm_ggng_ng' => 'ng'],
'odds_points' => ['alarm_po_home' => 'home', 'alarm_po_away' => 'away'],
'odds_points_ht' => ['alarm_poht_home' => 'home', 'alarm_poht_away' => 'away'],
'odds_points_q1' => ['alarm_poq1_home' => 'home', 'alarm_poq1_away' => 'away'],
'odds_totals' => ['alarm_to_over' => 'over', 'alarm_to_under' => 'under'],
'odds_totals_ht' => ['alarm_toht_over' => 'over', 'alarm_toht_under' => 'under'],
'odds_totals_q1' => ['alarm_toq1_over' => 'over', 'alarm_toq1_under' => 'under'],
'odds_tq' => ['alarm_tq_htq' => 'htq', 'alarm_tq_atq' => 'atq'],
];
return $map[$table];
}
}
@@ -0,0 +1,24 @@
<?php
namespace App\Console\Commands\Services\Tasks\Alarm;
use App\Console\Commands\Nuh;
use App\Models\MultilineSetting;
class AlarmMultilineSetting
{
public static function get()
{
$res = MultilineSetting::where('sport_id', Nuh::$options['sport_id'])->get();
$arr = [];
foreach ($res as $value) {
$arr[$value->id] = [
'table' => $value->table,
'oddnames' => $value->oddnames,
];
}
return $arr;
}
}
@@ -0,0 +1,25 @@
<?php
namespace App\Console\Commands\Services\Tasks\Alarm;
use App\Console\Commands\Nuh;
use App\Models\AlarmSetting;
class AlarmSettings
{
public static function get($client_bookmaker_id)
{
$res = AlarmSetting::where('sport_id', Nuh::$options['sport_id'])
->where('client_bookmaker_id', $client_bookmaker_id)
->where('disabled', 0)
->select('multiline_setting_id', 'level_id', 'alarm_threshold')
->get();
$arr = [];
foreach ($res as $value) {
$arr[$value->multiline_setting_id][$value->level_id] = $value->alarm_threshold;
}
return $arr;
}
}
@@ -0,0 +1,42 @@
<?php
namespace App\Console\Commands\Services\Tasks\Alarm;
use App\Models\EventBookmaker;
class AlarmStore
{
public static function get($event_id, $table, $client_bookmaker_id, $alarm_threshold, $compare_odds, $client_odds)
{
$oddnames = AlarmMap::get($table);
if (! $compare_odds) {
return;
}
if (! $client_odds) {
return;
}
$update_array = [];
foreach ($oddnames as $fieldname => $oddname) {
$threshold = $client_odds[$oddname] - $compare_odds[$oddname];
if ($threshold > $alarm_threshold[3]) {
// ROT
$update_array[$fieldname] = 3;
} elseif ($threshold > $alarm_threshold[2]) {
// ORANGE
$update_array[$fieldname] = 2;
} elseif ($threshold > $alarm_threshold[1]) {
// GRÜNE
$update_array[$fieldname] = 1;
} else {
// Rset Alarm
$update_array[$fieldname] = 0;
}
}
EventBookmaker::where('event_id', $event_id)->where('bookmaker_id', $client_bookmaker_id)->update($update_array);
}
}
@@ -0,0 +1,57 @@
<?php
namespace App\Console\Commands\Services\Tasks;
use App\Console\Commands\Nuh;
use App\Console\Commands\Services\Tasks\Alarm\AlarmBookmakerFilter;
use App\Console\Commands\Services\Tasks\Alarm\AlarmFilterClient;
use App\Console\Commands\Services\Tasks\Alarm\AlarmFilterCompare;
use App\Console\Commands\Services\Tasks\Alarm\AlarmLoadOdds;
use App\Console\Commands\Services\Tasks\Alarm\AlarmMultilineSetting;
use App\Console\Commands\Services\Tasks\Alarm\AlarmSettings;
use App\Console\Commands\Services\Tasks\Alarm\AlarmStore;
use App\Models\Client;
use App\Models\EventBookmaker;
use App\Utilities\Notice;
class AlarmGenerator
{
public static function run()
{
$debug = Nuh::$options['d'] ?? 0;
if ($debug) {
Notice::note('ALARM GENERATOR', 'b');
}
$clients = Client::get();
$multilines = AlarmMultilineSetting::get();
foreach ($clients as $client) {
foreach ($client->bookmaker as $client_bookmaker_id) {
$alarm_threshold = AlarmSettings::get($client_bookmaker_id);
$filter = AlarmBookmakerFilter::get($client_bookmaker_id);
$res = EventBookmaker::where('bookmaker_id', $client_bookmaker_id)->where('sport_id', Nuh::$options['sport_id'])->get();
foreach ($res as $event) {
foreach ($multilines as $multiline_id => $multiline) {
$odds = AlarmLoadOdds::get($event->event_id, $multiline['table'], $multiline['oddnames']);
$compare_odds = AlarmFilterCompare::get($odds, $filter);
$client_odds = AlarmFilterClient::get($odds, $client_bookmaker_id);
AlarmStore::get($event->event_id, $multiline['table'], $client_bookmaker_id, $alarm_threshold[$multiline_id], $compare_odds, $client_odds);
}
}
}
}
}
}
@@ -3,6 +3,7 @@
namespace App\Console\Commands\Services\Tasks;
use App\Console\Commands\Nuh;
use App\Models\AlarmSetting;
use App\Models\BettypeUser;
use App\Models\Bookmaker;
use App\Models\Client;
@@ -24,11 +25,45 @@ class GenerateDefaultSetting
}
/**************************************************
* MULTILINE SLOTS
* 1) ALARM BOOKMAKER
**************************************************/
if ($debug) {
Notice::note('1) MULTILINE SLOTS', 'p');
Notice::note('1) ALARM BOOKMAKER', 'p');
}
$alarm_thresholds = [1 => 0.01, 2 => 0.2, 3 => 0.3];
$clients = Client::get();
foreach ($clients as $client) {
foreach ($client->sport as $sport_id) {
foreach ($client->bookmaker as $client_bookmaker_id) {
$multilines = MultilineSetting::where('sport_id', $sport_id)->get()->pluck('id');
foreach ($multilines as $multiline_id) {
foreach ($alarm_thresholds as $level_id => $alarm_threshold) {
AlarmSetting::firstOrCreate(
['client_bookmaker_id' => $client_bookmaker_id, 'sport_id' => $sport_id, 'multiline_setting_id' => $multiline_id, 'level_id' => $level_id],
['name' => "LEVEL $level_id", 'alarm_threshold' => $alarm_threshold]
);
}
}
}
}
}
/**************************************************
* 2) MULTILINE SLOTS
**************************************************/
if ($debug) {
Notice::note('2) MULTILINE SLOTS', 'p');
}
$bookmaker_slots = [1 => 6, 2 => 30, 3 => 649, 4 => 126];
@@ -58,11 +93,11 @@ class GenerateDefaultSetting
}
/**************************************************
* BETTYPES for USER in MONITOR
* 3) BETTYPES for USER in MONITOR
**************************************************/
if ($debug) {
Notice::note('2) GENERATOR BETTYPES IM COMPARATORE FOR USERS', 'p');
Notice::note('3) GENERATOR BETTYPES IM COMPARATORE FOR USERS', 'p');
}
$users = User::get();
@@ -83,11 +118,11 @@ class GenerateDefaultSetting
}
/**************************************************
* COMPARING BOOKMAKER
* 4) COMPARING BOOKMAKER
**************************************************/
if ($debug) {
Notice::note('3) COMPARING BOOKMAKER', 'p');
Notice::note('4) COMPARING BOOKMAKER', 'p');
}
$res = Client::get();
@@ -104,13 +139,12 @@ class GenerateDefaultSetting
$i = 1;
foreach ($bookmakers_soccer as $bookmaker_id) {
$margin_threshold = $bookmaker_id == 110 ? 103 : 115;
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]
['is_active' => 1, 'time_lastcheck' => 600, 'margin_threshold' => $margin_threshold, 'sorting' => $i]
);
$i++;
}
}
}
@@ -184,6 +184,11 @@ class EventsTable
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('reload_data_left');
$livewire->dispatch('reload_data_right');
$set('country_id', null);
$set('competition_group_id', null);
@@ -76,6 +76,7 @@ class SupervisorsTable
'Txodds Markets' => 'Txodds Markets',
'DB Mapper' => 'DB Mapper',
'Generate Default Setting' => 'Generate Default Setting',
'Alarm Generator' => 'Alarm Generator',
];
case 9:
case 10:
@@ -316,6 +316,7 @@ class ColumnOdds extends Column
public function setCompare($record)
{
$this->compare = null;
$this->data->filter(function ($model) {
if ($model->bookmaker_id != auth()->user()->bookmaker_id) {
+111
View File
@@ -0,0 +1,111 @@
<?php
namespace App\Livewire;
use App\Models\AlarmSetting;
use App\Models\MultilineSetting;
use Filament\Actions\Concerns\InteractsWithActions;
use Filament\Actions\Contracts\HasActions;
use Filament\Forms\Components\Radio;
use Filament\Schemas\Concerns\InteractsWithSchemas;
use Filament\Schemas\Contracts\HasSchemas;
use Filament\Tables\Columns\IconColumn;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Columns\TextInputColumn;
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\Table;
use Illuminate\Contracts\View\View;
use Illuminate\Database\Eloquent\Builder;
use Livewire\Component;
class AlarmBookmaker extends Component implements HasActions, HasSchemas, HasTable
{
use InteractsWithActions;
use InteractsWithSchemas;
use InteractsWithTable;
protected $listeners = [
'reload_alarm_bookmaker' => '$refresh',
];
public static $default_filter;
public static function load_filter($sport_id)
{
self::$default_filter = MultilineSetting::where('sport_id', $sport_id)
->orderBy('id')->pluck('id')->first();
}
public function table(Table $table): Table
{
self::load_filter(auth()->user()->sport_id);
return $table
->query(AlarmSetting::query()
->where('client_bookmaker_id', auth()->user()->bookmaker_id)
->where('sport_id', auth()->user()->sport_id))
->paginated(false)
->columns([
IconColumn::make('sport.icon')
->label('')
->width('1rem')
->icon(function ($record): string {
return $record->sport->icon;
})
->color(fn ($record): string => match ($record->level_id) {
1 => 'success',
2 => 'warning',
3 => 'danger',
}),
TextColumn::make('sport.name'),
TextColumn::make('multiline_setting.name')->label('Bettype'),
TextColumn::make('name')
->color(fn ($record): string => match ($record->level_id) {
1 => 'success',
2 => 'warning',
3 => 'danger',
}),
TextInputColumn::make('alarm_threshold')
->tooltip('Between 0.01 - 2.00')
->width('2rem')
->prefix('Threshold:')
->rules(['required', 'decimal:2', 'between:0,2']),
ToggleColumn::make('disabled')
->label('Status')
->offColor('success')
->onColor('danger'),
])
->defaultSort('level_id')
->deferFilters(false)
->filters([
Filter::make('multiline_setting_id')
->schema([
Radio::make('multiline_setting_id')
->inline()
->columnSpan(6)
->default(self::$default_filter)
->columnSpanFull()
->hiddenLabel()
->options(fn () => MultilineSetting::where('sport_id', auth()->user()->sport_id)->orderBy('name')->pluck('name', 'id')),
])
->query(function (Builder $query, array $data): Builder {
return $query
->when(
$data['multiline_setting_id'],
fn (Builder $query, $multiline_setting_id): Builder => $query->where('multiline_setting_id', $multiline_setting_id),
);
})
->columns(6)->columnSpan(6),
], layout: FiltersLayout::AboveContent)
->hiddenFilterIndicators();
}
public function render(): View
{
return view('livewire.alarm-bookmaker');
}
}
+1 -1
View File
@@ -34,7 +34,7 @@ class ComparingBookmakerMenu extends Component implements HasActions, HasSchemas
public $user;
protected $listeners = [
'refresh' => '$refresh',
'refresh_comparing_bookmaker' => '$refresh',
];
public function table(Table $table): Table
+4
View File
@@ -83,6 +83,7 @@ class StoreMapped
// MAGLOO KENIA
EventBookmaker::updateOrCreate([
'event_id' => $arguments['id'],
'sport_id' => $event->sport_id,
'bookmaker_id' => 16,
], ['starttime' => $mapper->starttime, 'in_feed' => 1, 'bmoid' => $mapper->event_id, 'is_swopped' => $swopped]);
break;
@@ -90,6 +91,7 @@ class StoreMapped
// MAGLOO NIGERIA
EventBookmaker::updateOrCreate([
'event_id' => $arguments['id'],
'sport_id' => $event->sport_id,
'bookmaker_id' => 10,
], ['starttime' => $mapper->starttime, 'in_feed' => 1, 'bmoid' => $mapper->event_id, 'is_swopped' => $swopped]);
break;
@@ -97,6 +99,7 @@ class StoreMapped
// LOGIFUTUR NIGERA
EventBookmaker::updateOrCreate([
'event_id' => $arguments['id'],
'sport_id' => $event->sport_id,
'bookmaker_id' => 35,
], ['starttime' => $mapper->starttime, 'in_feed' => 1, 'bmoid' => $mapper->event_id, 'is_swopped' => $swopped]);
break;
@@ -104,6 +107,7 @@ class StoreMapped
// LOGIFUTUR COLOMBIA
EventBookmaker::updateOrCreate([
'event_id' => $arguments['id'],
'sport_id' => $event->sport_id,
'bookmaker_id' => 36,
], ['starttime' => $mapper->starttime, 'in_feed' => 1, 'bmoid' => $mapper->event_id, 'is_swopped' => $swopped]);
break;
+5 -11
View File
@@ -31,25 +31,19 @@ class MultilineBookmaker extends Component implements HasActions, HasSchemas, Ha
use InteractsWithSchemas;
use InteractsWithTable;
public static $default_filter;
protected $listeners = [
'reload_bookmaker_multiline' => '$refresh',
];
public $user;
public static function load_filter($sport_id)
{
self::$default_filter = MultilineSetting::where('sport_id', $sport_id)
->orderBy('id')->pluck('id')->first();
}
public function table(Table $table): Table
{
$this->user = User::getUser();
self::load_filter($this->user->sport_id);
return $table
->query(MultilineClient::query()->where('client_bookmaker_id', auth()->user()->bookmaker_id)->where('sport_id', $this->user->sport_id))
->query(MultilineClient::query()->where('client_bookmaker_id', $this->user->bookmaker_id)->where('sport_id', $this->user->sport_id))
->paginated(false)
->columns([
IconColumn::make('sport.icon')
@@ -88,7 +82,7 @@ class MultilineBookmaker extends Component implements HasActions, HasSchemas, Ha
->schema([
Radio::make('multiline_setting_id')
->inline()
->default(self::$default_filter)
->default(1)
->columnSpan(6)
->columnSpanFull()
->hiddenLabel()
+19 -1
View File
@@ -6,5 +6,23 @@ use Illuminate\Database\Eloquent\Model;
class AlarmSetting extends Model
{
//
protected $fillable = [
'client_bookmaker_id',
'sport_id',
'disabled',
'multiline_setting_id',
'name',
'level_id',
'alarm_threshold',
];
public function multiline_setting()
{
return $this->belongsTo(MultilineSetting::class);
}
public function sport()
{
return $this->belongsTo(Sport::class);
}
}
+46 -14
View File
@@ -8,6 +8,7 @@ class EventBookmaker extends Model
{
protected $fillable = [
'event_id',
'sport_id',
'bookmaker_id',
'starttime',
'bmoid',
@@ -15,20 +16,51 @@ class EventBookmaker extends Model
'is_swopped',
'send_status',
'has_to_qualify',
'alarm_2w',
'alarm_2ws1',
'alarm_3w',
'alarm_3wht',
'alarm_dc',
'alarm_dbn',
'alarm_ggng',
'alarm_po',
'alarm_poht',
'alarm_poq1',
'alarm_to',
'alarm_toht',
'alarm_toq1',
'alarm_tq',
'alarm_2w_h2w',
'alarm_2w_a2w',
'alarm_2ws1_h2w',
'alarm_2ws1_a2w',
'alarm_3w_h3w',
'alarm_3w_d3w',
'alarm_3w_a3w',
'alarm_3wht_h3w',
'alarm_3wht_d3w',
'alarm_3wht_a3w',
'alarm_dc_dc1x',
'alarm_dc_dc12',
'alarm_dc_dcx2',
'alarm_dbn_dnb1',
'alarm_dbn_dnb2',
'alarm_ggng_gg',
'alarm_ggng_ng',
'alarm_po_home',
'alarm_po_away',
'alarm_poht_home',
'alarm_poht_away',
'alarm_poq1_home',
'alarm_poq1_away',
'alarm_to_over',
'alarm_to_under',
'alarm_toht_over',
'alarm_toht_under',
'alarm_toq1_over',
'alarm_toq1_under',
'alarm_tq_htq',
'alarm_tq_atq',
];
public function event()