fumetto max ok

This commit is contained in:
salam committed 2026-01-03 17:46:23 +01:00
1 parent 9e7384daf8
commit 9c78f507f4
58 files changed
+672 -144

No files matched your search

+163 -18
View File
@@ -3,46 +3,191 @@
namespace App\Console\Commands\Grapper\Magloo;
use App\Console\Commands\Curl;
use App\Console\Commands\Grapper\Magloo\Odds\FilterHandicap;
use App\Console\Commands\Grapper\Magloo\Odds\FilterTotals;
use App\Console\Commands\Grapper\Magloo\Odds\FilterTotalsQ1;
use App\Console\Commands\Nuh;
use App\Models\Event;
use App\Models\Odds3way;
use App\Models\OddsDc;
use App\Models\OddsHandicap;
use App\Models\OddsHandicapQ1;
use App\Models\OddsQualify;
use App\Models\OddsTotal;
use App\Models\OddsTotalQ1;
use App\Models\Sport;
use App\Utilities\Margin;
use App\Utilities\Notice;
use Illuminate\Support\Carbon;
class Odds
{
public static function grap()
{
$debug = Nuh::$options['d'] ?? 0;
$test = Nuh::$options['t'] ?? 0;
$echo = Nuh::$options['e'] ?? 0;
$proxy = Nuh::$options['p'] ?? 0;
$sportmap = Sport::map('magl', 1, [1, 3]);
if ($proxy) {
Notice::note('PROXY USED', 'r');
}
if ($debug) {
Notice::note('ODDS '.Nuh::$options['process'], 'b');
}
switch (Nuh::$options['provider_id']) {
case 3:
// KENIA
if ($test) {
$base_url = 'https://int.external.api.algorez.com/api/sb/affiliates/30/en/1/prematch/sport';
} else {
$base_url = 'https://api.externalsvc.com/api/sb/affiliates/30/en/1/prematch/sport';
}
$base_url = 'https://api.externalsvc.com/api/sb/affiliates/20/1/prematch/sport/';
$bookmaker_id = 10;
break;
case 4:
// NIGERIA
if ($test) {
$base_url = 'https://int.external.api.algorez.com/api/sb/affiliates/20/en/1/prematch/sport';
} else {
$base_url = 'https://api.externalsvc.com/api/sb/affiliates/20/en/1/prematch/sport';
}
break;
default:
Notice::note('prosses name does not exist', 'r', 1);
$base_url = 'https://api.externalsvc.com/api/sb/affiliates/30/1/prematch/sport/';
$bookmaker_id = 16;
break;
}
$sportmap = Sport::map('magl');
foreach ($sportmap as $magloo_sport_id => $sport_id) {
$url = $base_url.$magloo_sport_id.'/odds';
$_data = Curl::load($url, 1);
$data = Curl::load($url);
if (! is_array($data) or \count($data) == 0) {
Notice::note('no data in feed', 'r', 1);
dd($_data);
return;
}
foreach ($data as $match) {
$betradar_id = (int) preg_replace('/\D/', '', $match['p']);
$starttime = Carbon::parse($match['dt'])->toDateTimeString();
$event_id = Event::where('betradar_id', $betradar_id)->value('id');
if ($event_id) {
$base = [];
$base['sport_id'] = $sport_id;
$base['provider_id'] = Nuh::$options['provider_id'];
$base['bmoid'] = preg_replace('/\D/', '', $match['i']);
$base['flag'] = 1;
// dd($match['M']);
foreach ($match['M'] as $magloo_bettype_id => $value) {
switch ($magloo_bettype_id) {
case 1:
// 1x2
$odds = [];
$odds['h3w'] = $value['static'][1] ?? 1;
$odds['d3w'] = $value['static'][2] ?? 1;
$odds['a3w'] = $value['static'][3] ?? 1;
$odds['margin'] = (float) Margin::calculate($odds, 1);
$odds['starttime'] = $starttime;
Odds3way::updateOrCreate([
'event_id' => $event_id,
'bookmaker_id' => $bookmaker_id,
], $base + $odds);
break;
case 2:
// to qalify
$odds = [];
$odds['htq'] = $value['static'][4] ?? 1;
$odds['atq'] = $value['static'][5] ?? 1;
$odds['margin'] = (float) Margin::calculate($odds, 1);
OddsQualify::updateOrCreate([
'event_id' => $event_id,
'bookmaker_id' => $bookmaker_id,
], $base + $odds);
break;
case 10:
// double chance
$odds = [];
$odds['dc1x'] = $value['static'][9] ?? 1;
$odds['dc12'] = $value['static'][10] ?? 1;
$odds['dcx2'] = $value['static'][11] ?? 1;
$odds['margin'] = (float) Margin::calculate($odds, 1);
OddsDc::updateOrCreate([
'event_id' => $event_id,
'bookmaker_id' => $bookmaker_id,
], $base + $odds);
break;
case 10:
// ggng
$odds = [];
$odds['gg'] = $value['static'][74] ?? 1;
$odds['ng'] = $value['static'][76] ?? 1;
$odds['margin'] = (float) Margin::calculate($odds, 1);
OddsDc::updateOrCreate([
'event_id' => $event_id,
'bookmaker_id' => $bookmaker_id,
], $base + $odds);
break;
case 16:
// points
$odds = FilterHandicap::get($value);
$odds['starttime'] = $starttime;
OddsHandicap::updateOrCreate([
'event_id' => $event_id,
'bookmaker_id' => $bookmaker_id,
], $base + $odds);
break;
case 2000:
// points qt
$odds = FilterHandicap::get($value);
OddsHandicap::updateOrCreate([
'event_id' => $event_id,
'bookmaker_id' => $bookmaker_id,
], $base + $odds);
break;
case 2025:
// points qt
$odds = FilterHandicapQ1::get($value);
OddsHandicapQ1::updateOrCreate([
'event_id' => $event_id,
'bookmaker_id' => $bookmaker_id,
], $base + $odds);
break;
case 17:
case 2002:
// totals
$odds = FilterTotals::get($value, $sport_id);
OddsTotal::updateOrCreate([
'event_id' => $event_id,
'bookmaker_id' => $bookmaker_id,
], $base + $odds);
break;
case 2012:
// totals qt
$odds = FilterTotalsQ1::get($value, $sport_id);
OddsTotalQ1::updateOrCreate([
'event_id' => $event_id,
'bookmaker_id' => $bookmaker_id,
], $base + $odds);
break;
}
}
}
}
}
}
}
@@ -0,0 +1,48 @@
<?php
namespace App\Console\Commands\Grapper\Magloo\Odds;
use App\Utilities\Margin;
class FilterHandicap
{
public static function get($_array)
{
$_points = [];
foreach ($_array as $handicap => $value) {
if (fmod(abs($handicap), 1) == 0.5) {
if ($value[1714] > 1 and $value[1715] > 1) {
$_points[$handicap]['home'] = $value[1714];
$_points[$handicap]['away'] = $value[1715];
}
}
}
$tmp = 10000;
$handicap = false;
foreach ($_points as $key => $value) {
$x = 0;
foreach ($value as $k => $v) {
if ($x == 0) {
$x = $v;
} else {
$x -= $v;
}
}
$x = abs($x);
if ($x < $tmp) {
$handicap = $key;
$tmp = $x;
}
}
$return = [];
if ($handicap) {
$return['home'] = $_points[$handicap]['home'];
$return['away'] = $_points[$handicap]['away'];
$return['margin'] = (float) Margin::calculate($return, 1);
$return['handicap'] = $handicap;
}
return $return;
}
}
@@ -0,0 +1,50 @@
<?php
namespace App\Console\Commands\Grapper\Magloo\Odds;
use App\Utilities\Margin;
class FilterHandicapQ1
{
public static function get($_array)
{
$_points = [];
foreach ($_array as $handicap => $value) {
$t = explode('_', $handicap);
$handicap = $t[1];
if (fmod(abs($handicap), 1) == 0.5) {
if ($value[1714] > 1 and $value[1715] > 1) {
$_points[$handicap]['home'] = $value[1714];
$_points[$handicap]['away'] = $value[1715];
}
}
}
$tmp = 10000;
$handicap = false;
foreach ($_points as $key => $value) {
$x = 0;
foreach ($value as $k => $v) {
if ($x == 0) {
$x = $v;
} else {
$x -= $v;
}
}
$x = abs($x);
if ($x < $tmp) {
$handicap = $key;
$tmp = $x;
}
}
$return = [];
if ($handicap) {
$return['home'] = $_points[$handicap]['home'];
$return['away'] = $_points[$handicap]['away'];
$return['margin'] = (float) Margin::calculate($return, 1);
$return['handicap'] = $handicap;
}
return $return;
}
}
@@ -0,0 +1,51 @@
<?php
namespace App\Console\Commands\Grapper\Magloo\Odds;
use App\Utilities\Margin;
class FilterTotals
{
public static function get($_array, $sport_id)
{
$_totals = [];
foreach ($_array as $total => $value) {
if (fmod(abs($total), 1) == 0.5) {
if ($value[12] > 1 and $value[13] > 1) {
$_totals[$total]['over'] = $value[12];
$_totals[$total]['under'] = $value[13];
}
}
}
if ($sport_id == 1) {
$spread = '2.5';
} else {
$tmp = 10000;
$spread = false;
foreach ($_totals as $key => $value) {
$x = 0;
foreach ($value as $v) {
if ($x == 0) {
$x = $v;
} else {
$x -= $v;
}
}
$x = abs($x);
if ($x < $tmp) {
$spread = $key;
$tmp = $x;
}
}
}
$return = [];
if (isset($_totals[$spread])) {
$return['over'] = $_totals[$spread]['over'];
$return['under'] = $_totals[$spread]['under'];
$return['margin'] = (float) Margin::calculate($return, 1);
$return['total'] = $spread;
}
return $return;
}
}
@@ -0,0 +1,53 @@
<?php
namespace App\Console\Commands\Grapper\Magloo\Odds;
use App\Utilities\Margin;
class FilterTotalsQ1
{
public static function get($_array, $sport_id)
{
$_totals = [];
foreach ($_array as $total => $value) {
if (fmod(abs($total), 1) == 0.5) {
$t = explode('_', $total);
$total = $t[1];
if ($value[12] > 1 and $value[13] > 1) {
$_totals[$total]['over'] = $value[12];
$_totals[$total]['under'] = $value[13];
}
}
}
if ($sport_id == 1) {
$spread = '2.5';
} else {
$tmp = 10000;
$spread = false;
foreach ($_totals as $key => $value) {
$x = 0;
foreach ($value as $k => $v) {
if ($x == 0) {
$x = $v;
} else {
$x -= $v;
}
}
$x = abs($x);
if ($x < $tmp) {
$spread = $key;
$tmp = $x;
}
}
}
$return = [];
if (isset($_totals[$spread])) {
$return['over'] = $_totals[$spread]['over'];
$return['under'] = $_totals[$spread]['under'];
$return['margin'] = (float) Margin::calculate($return, 1);
$return['total'] = $spread;
}
return $return;
}
}
@@ -232,9 +232,6 @@ class Odds
case 'bmoid':
$odds['bmoid'] = (string) $attributeValue;
break;
case 'last_updated':
$odds['source_updated_at'] = Carbon::createFromDate((string) $attributeValue)->toDateTimeString();
break;
}
}
@@ -21,7 +21,7 @@ class _3Way
$odds['h3w'] = (float) $value->o1;
$odds['d3w'] = (float) $value->o2;
$odds['a3w'] = (float) $value->o3;
$odds['starting_time'] = (string) $value['starting_time'];
$odds['starttime'] = (string) $value['starttime'];
}
$odds['margin'] = (float) Margin::calculate([$odds['h3w'], $odds['d3w'], $odds['a3w']], 1);
+1
View File
@@ -0,0 +1 @@
[{"i":3591912,"p":"sr:match:66762620","dt":"2026-01-03T12:30:00Z","M":{"16":{"0.5":{"1714":1.63,"1715":2.1},"1.5":{"1714":1.13,"1715":4.7},"-0.5":{"1714":4.25,"1715":1.17}},"1":{"static":{"1":4.25,"2":2.72,"3":2.1}},"17":{"0.5":{"12":1.14,"13":4.8},"1.5":{"12":1.74,"13":1.98},"2.5":{"12":3.3,"13":1.27},"3.5":{"12":7.1,"13":1.04},"4.5":{"12":16.0,"13":1.0}},"18":{"0.5":{"12":1.84,"13":1.8},"1.5":{"12":5.7,"13":1.07}},"19":{"0.5":{"12":1.37,"13":2.72},"1.5":{"12":2.9,"13":1.3},"2.5":{"12":1.0,"13":1.0}},"10":{"static":{"9":1.66,"10":1.4,"11":1.18}},"27":{"static":{"74":2.57,"76":1.43}},"14":{"1":{"1712":3.4,"1713":4.7,"1711":1.63},"2":{"1712":1.0,"1713":1.0,"1711":1.0},"-1":{"1712":4.9,"1713":1.17,"1711":12.0}}}},{"i":3586861,"p":"sr:match:61974122","dt":"2026-01-03T12:15:00Z","M":{"16":{"-2.5":{"1714":3.0,"1715":1.31},"-1.5":{"1714":1.81,"1715":1.86},"-0.5":{"1714":1.32,"1715":3.0}},"1":{"static":{"1":1.32,"2":5.2,"3":7.6}},"17":{"0.5":{"12":1.0,"13":18.0},"1.5":{"12":1.07,"13":6.0},"2.5":{"12":1.37,"13":2.75},"3.5":{"12":1.99,"13":1.73},"4.5":{"12":3.2,"13":1.28},"5.5":{"12":5.7,"13":1.08},"6.5":{"12":10.75,"13":1.0}},"18":{"1.5":{"12":1.26,"13":3.2},"2.5":{"12":1.93,"13":1.72},"3.5":{"12":3.45,"13":1.22}},"19":{"0.5":{"12":1.5,"13":2.3},"1.5":{"12":3.65,"13":1.2}},"10":{"static":{"9":1.05,"10":1.13,"11":3.1}},"27":{"static":{"74":1.61,"76":2.13}},"14":{"-1":{"1712":4.05,"1713":3.0,"1711":1.81},"-2":{"1712":4.05,"1713":1.86,"1711":3.0},"-3":{"1712":5.4,"1713":1.31,"1711":5.4}}}},{"i":3596036,"p":"sr:match:67054878","dt":"2026-01-04T05:30:00Z","M":{"16":{"0.5":{"1714":2.03,"1715":1.62},"1.5":{"1714":1.37,"1715":2.63},"-0.5":{"1714":4.25,"1715":1.14}},"1":{"static":{"1":4.25,"2":4.2,"3":1.62}},"17":{"0.5":{"12":1.0,"13":15.5},"1.5":{"12":1.09,"13":4.95},"2.5":{"12":1.44,"13":2.52},"3.5":{"12":2.1,"13":1.62},"4.5":{"12":3.4,"13":1.24},"5.5":{"12":6.0,"13":1.05},"6.5":{"12":11.0,"13":1.0}},"18":{"0.5":{"12":1.25,"13":3.0},"1.5":{"12":2.48,"13":1.39},"2.5":{"12":6.2,"13":1.03}},"19":{"0.5":{"12":1.02,"13":6.7},"1.5":{"12":1.44,"13":2.35},"2.5":{"12":2.47,"13":1.37}},"10":{"static":{"9":2.12,"10":1.17,"11":1.17}},"27":{"static":{"74":1.44,"76":2.48}},"14":{"1":{"1712":3.6,"1713":2.63,"1711":2.03},"2":{"1712":4.3,"1713":4.95,"1711":1.37}}}},{"i":3596684,"p":"sr:match:63259975","dt":"2026-01-04T11:00:00Z","M":{"16":{"0.5":{"1714":1.55,"1715":2.15},"1.5":{"1714":1.16,"1715":4.1},"-0.5":{"1714":2.95,"1715":1.3}},"1":{"static":{"1":2.95,"2":3.5,"3":2.15}},"17":{"0.5":{"12":1.0,"13":11.25},"1.5":{"12":1.19,"13":3.8},"2.5":{"12":1.7,"13":1.99},"3.5":{"12":2.72,"13":1.35},"4.5":{"12":5.0,"13":1.09},"5.5":{"12":9.9,"13":1.0}},"18":{"0.5":{"12":1.23,"13":3.15},"1.5":{"12":2.38,"13":1.43},"2.5":{"12":5.8,"13":1.04}},"19":{"0.5":{"12":1.13,"13":4.05},"1.5":{"12":1.93,"13":1.67},"2.5":{"12":4.1,"13":1.12}},"10":{"static":{"9":1.6,"10":1.24,"11":1.33}},"27":{"static":{"74":1.56,"76":2.18}},"14":{"1":{"1712":3.85,"1713":4.1,"1711":1.55},"-1":{"1712":4.25,"1713":1.3,"1711":5.9}}}},{"i":3591318,"p":"sr:match:62156652","dt":"2026-01-03T15:00:00Z","M":{"16":{"0.5":{"1714":1.12,"1715":5.0},"-1.5":{"1714":2.63,"1715":1.4},"-0.5":{"1714":1.6,"1715":2.15}},"1":{"static":{"1":1.6,"2":3.95,"3":5.0}},"17":{"0.5":{"12":1.0,"13":11.75},"1.5":{"12":1.19,"13":4.0},"2.5":{"12":1.65,"13":2.1},"3.5":{"12":2.58,"13":1.42},"4.5":{"12":4.55,"13":1.14},"5.5":{"12":8.7,"13":1.01}},"18":{"0.5":{"12":1.06,"13":5.9},"1.5":{"12":1.57,"13":2.15},"2.5":{"12":2.85,"13":1.32}},"19":{"0.5":{"12":1.43,"13":2.48},"1.5":{"12":3.25,"13":1.25}},"10":{"static":{"9":1.14,"10":1.21,"11":2.2}},"27":{"static":{"74":1.64,"76":2.08}},"14":{"-1":{"1712":3.65,"1713":2.15,"1711":2.63},"-2":{"1712":4.55,"1713":1.4,"1711":5.1}}}},{"i":3592955,"p":"sr:match:67173398","dt":"2026-01-03T16:00:00Z","M":{"16":{"0.5":{"1714":1.42,"1715":2.6},"1.5":{"1714":1.07,"1715":6.1},"-0.5":{"1714":2.75,"1715":1.38}},"1":{"static":{"1":2.75,"2":3.0,"3":2.6}},"17":{"0.5":{"12":1.07,"13":6.4},"1.5":{"12":1.54,"13":2.33},"2.5":{"12":2.72,"13":1.4},"3.5":{"12":5.5,"13":1.09},"4.5":{"12":12.25,"13":1.0}},"18":{"0.5":{"12":1.44,"13":2.45},"1.5":{"12":3.3,"13":1.24}},"19":{"0.5":{"12":1.41,"13":2.55},"1.5":{"12":3.15,"13":1.26}},"10":{"static":{"9":1.44,"10":1.34,"11":1.4}},"27":{"static":{"74":2.18,"76":1.58}},"14":{"1":{"1712":3.95,"1713":6.1,"1711":1.42},"-1":{"1712":3.95,"1713":1.38,"1711":6.3}}}},{"i":3550543,"p":"sr:match:61514960","dt":"2026-01-18T12:30:00Z","M":{"16":{"0.5":{"1714":1.68,"1715":2.2},"1.5":{"1714":1.23,"1715":4.2},"-3.5":{"1714":37.0,"1715":1.0},"-2.5":{"1714":17.5,"1715":1.01},"2.5":{"1714":1.06,"1715":9.5},"3.5":{"1714":1.0,"1715":22.0},"4.5":{"1714":1.0,"1715":42.0},"-1.5":{"1714":7.1,"1715":1.1},"-0.5":{"1714":3.25,"1715":1.35}},"1":{"static":{"1":3.25,"2":3.55,"3":2.2}},"17":{"0.5":{"12":1.03,"13":11.75},"1.5":{"12":1.24,"13":4.1},"2.5":{"12":1.74,"13":2.1},"3.5":{"12":2.8,"13":1.44},"4.5":{"12":5.1,"13":1.17},"5.5":{"12":10.0,"13":1.05},"6.5":{"12":19.5,"13":1.0}},"18":{"Line truncated
@@ -135,7 +135,7 @@ class EventsTable
->tooltip(fn ($record) => $record->id)
->visibleFrom('lg'),
MatchIds::make('match_ids')->grow(false)->visibleFrom('xl'),
MatchIds::make('ids')->grow(false)->visibleFrom('xl'),
TextColumn::make('starttime')
->label('Start')
@@ -196,8 +196,8 @@ class EventsTable
->verticalAlignment(VerticalAlignment::Start)
->width(225)
->label('Totals'),
])->searchable(['id', 'betsapi_id', 'betradar_id', 'bet365_id', 'bwin_id'])
->poll('5s')
])->searchable(['id', 'betsapi_id', 'betradar_id', 'bet365_id', 'bwin_id', 'magnig_id', 'magken_id', 'lognig_id', 'logcol_id'])
->poll('10s')
->defaultSort('starttime', 'ASC')
->filters([
Filter::make('events')
@@ -11,6 +11,8 @@ class Column3way extends Column
protected $data;
protected ?array $max;
protected ?array $bookmakers;
protected ?bool $has_data;
@@ -31,6 +33,14 @@ class Column3way extends Column
{
$this->data = Odds3way::with('bookmaker')->where('event_id', $record->id)->get();
$this->max['h3w'] = $this->data->max('h3w');
$this->max['d3w'] = $this->data->max('d3w');
$this->max['a3w'] = $this->data->max('a3w');
$this->max['margin'] = $this->data->max('margin');
$this->has_data = count($this->data) ? true : false;
}
@@ -39,6 +49,11 @@ class Column3way extends Column
return $this->data;
}
public function getMax()
{
return $this->max;
}
public function hasData()
{
return $this->has_data;
+15
View File
@@ -9,6 +9,8 @@ class ColumnDc extends Column
{
protected string $view = 'filament.tables.columns.column-dc';
protected ?array $max;
protected $data;
protected ?array $bookmakers;
@@ -31,6 +33,14 @@ class ColumnDc extends Column
{
$this->data = OddsDc::with('bookmaker')->where('event_id', $record->id)->get();
$this->max['dc1x'] = $this->data->max('dc1x');
$this->max['dc12'] = $this->data->max('dc12');
$this->max['dcx2'] = $this->data->max('dcx2');
$this->max['margin'] = $this->data->max('margin');
$this->has_data = count($this->data) ? true : false;
}
@@ -39,6 +49,11 @@ class ColumnDc extends Column
return $this->data;
}
public function getMax()
{
return $this->max;
}
public function hasData()
{
return $this->has_data;
+13
View File
@@ -9,6 +9,8 @@ class ColumnDnb extends Column
{
protected string $view = 'filament.tables.columns.column-dnb';
protected ?array $max;
protected $data;
protected ?array $bookmakers;
@@ -31,6 +33,12 @@ class ColumnDnb extends Column
{
$this->data = OddsDnb::with('bookmaker')->where('event_id', $record->id)->get();
$this->max['dnb1'] = $this->data->max('dnb1');
$this->max['dnb2'] = $this->data->max('dnb2');
$this->max['margin'] = $this->data->max('margin');
$this->has_data = count($this->data) ? true : false;
}
@@ -39,6 +47,11 @@ class ColumnDnb extends Column
return $this->data;
}
public function getMax()
{
return $this->max;
}
public function hasData()
{
return $this->has_data;
@@ -9,6 +9,8 @@ class ColumnGgng extends Column
{
protected string $view = 'filament.tables.columns.column-ggng';
protected ?array $max;
protected $data;
protected ?array $bookmakers;
@@ -31,6 +33,12 @@ class ColumnGgng extends Column
{
$this->data = OddsGgng::with('bookmaker')->where('event_id', $record->id)->get();
$this->max['gg'] = $this->data->max('gg');
$this->max['ng'] = $this->data->max('ng');
$this->max['margin'] = $this->data->max('margin');
$this->has_data = count($this->data) ? true : false;
}
@@ -39,6 +47,11 @@ class ColumnGgng extends Column
return $this->data;
}
public function getMax()
{
return $this->max;
}
public function hasData()
{
return $this->has_data;
@@ -9,6 +9,8 @@ class ColumnTotal extends Column
{
protected string $view = 'filament.tables.columns.column-total';
protected ?array $max;
protected $data;
protected ?array $bookmakers;
@@ -31,6 +33,12 @@ class ColumnTotal extends Column
{
$this->data = OddsTotal::with('bookmaker')->where('event_id', $record->id)->get();
$this->max['over'] = $this->data->max('over');
$this->max['under'] = $this->data->max('under');
$this->max['margin'] = $this->data->max('margin');
$this->has_data = count($this->data) ? true : false;
}
@@ -39,6 +47,11 @@ class ColumnTotal extends Column
return $this->data;
}
public function getMax()
{
return $this->max;
}
public function hasData()
{
return $this->has_data;
+13
View File
@@ -9,6 +9,8 @@ class ColumnTq extends Column
{
protected string $view = 'filament.tables.columns.column-tq';
protected ?array $max;
protected $data;
protected ?array $bookmakers;
@@ -31,6 +33,12 @@ class ColumnTq extends Column
{
$this->data = OddsQualify::with('bookmaker')->where('event_id', $record->id)->get();
$this->max['htq'] = $this->data->max('htq');
$this->max['atq'] = $this->data->max('atq');
$this->max['margin'] = $this->data->max('margin');
$this->has_data = count($this->data) ? true : false;
}
@@ -39,6 +47,11 @@ class ColumnTq extends Column
return $this->data;
}
public function getMax()
{
return $this->max;
}
public function hasData()
{
return $this->has_data;
+26 -3
View File
@@ -49,7 +49,26 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable
->filters([
Filter::make('events')
->schema([
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 () {
return Mapper::query()->where('sport_id', Auth::user()->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('')
@@ -67,8 +86,7 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable
->afterStateUpdated(function (callable $set) {
$set('group_id', null);
})
->placeholder('Country')
->label('Countries'),
->placeholder('Country'),
Select::make('group_id')
->placeholder('League')
->label('Leagues')
@@ -79,7 +97,9 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable
->preload()
->multiple()
->options(function (Get $get) {
if ($get('group_cc')) {
if ($get('country_id')) {
return Mapper::query()->where('sport_id', Auth::user()->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();
} elseif ($get('group_cc')) {
return Mapper::query()->where('sport_id', Auth::user()->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', Auth::user()->sport_id)->where('provider_id', Auth::user()->provider_id)->where('starttime', '>', Carbon::now())->groupBy('group_id')->pluck('group', 'group_id')->toArray();
@@ -90,6 +110,9 @@ class MapperRight extends Component implements HasActions, HasSchemas, HasTable
->query(function (Builder $query, array $data): Builder {
return $query
->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)
)->when(
+8 -8
View File
@@ -15,22 +15,22 @@ class LoadEvents
return Event::query()->where('sport_id', Auth::user()->sport_id)->where('betsapi_id', 0);
break;
case 20:
case 3:
// Magloo Kenia
return Event::query()->where('sport_id', Auth::user()->sport_id)->where('magnig_id', 0);
break;
case 24:
// Magloo Nigeria
return Event::query()->where('sport_id', Auth::user()->sport_id)->where('magken_id', 0);
break;
case 26:
case 4:
// Magloo Nigeria
return Event::query()->where('sport_id', Auth::user()->sport_id)->where('magnig_id', 0);
break;
case 5:
// Logifuture Nigeria
return Event::query()->where('sport_id', Auth::user()->sport_id)->where('lognig_id', 0);
break;
case 27:
case 6:
// Magloo Colombia
return Event::query()->where('sport_id', Auth::user()->sport_id)->where('logcol_id', 0);
break;
+2 -2
View File
@@ -85,11 +85,11 @@ class StoreMapped
break;
case 3:
// MAGLOO KENIA
$event->magnig_id = $mapper->event_id;
$event->magken_id = $mapper->event_id;
break;
case 4:
// MAGLOO NIGERIA
$event->magken_id = $mapper->event_id;
$event->magnig_id = $mapper->event_id;
break;
case 5:
// LOGIFUTUR NIGERA
-1
View File
@@ -21,7 +21,6 @@ class Odds2way extends Model
'margin',
'flag',
'nuh_check',
'source_updated_at',
'add_time',
'updated_at',
];
-1
View File
@@ -21,7 +21,6 @@ class Odds2wayS1 extends Model
'margin',
'flag',
'nuh_check',
'source_updated_at',
'add_time',
'updated_at',
];
-1
View File
@@ -22,7 +22,6 @@ class Odds3way extends Model
'margin',
'flag',
'nuh_check',
'source_updated_at',
'add_time',
'updated_at',
];
-1
View File
@@ -22,7 +22,6 @@ class OddsDc extends Model
'margin',
'flag',
'nuh_check',
'source_updated_at',
'add_time',
'updated_at',
];
-1
View File
@@ -21,7 +21,6 @@ class OddsDnb extends Model
'margin',
'flag',
'nuh_check',
'source_updated_at',
'add_time',
'updated_at',
];
-1
View File
@@ -21,7 +21,6 @@ class OddsGgng extends Model
'margin',
'flag',
'nuh_check',
'source_updated_at',
'add_time',
'updated_at',
];
-1
View File
@@ -22,7 +22,6 @@ class OddsHandicap extends Model
'margin',
'flag',
'nuh_check',
'source_updated_at',
'add_time',
'updated_at',
];
-1
View File
@@ -22,7 +22,6 @@ class OddsHandicapQ1 extends Model
'margin',
'flag',
'nuh_check',
'source_updated_at',
'add_time',
'updated_at',
];
-1
View File
@@ -21,7 +21,6 @@ class OddsQualify extends Model
'margin',
'flag',
'nuh_check',
'source_updated_at',
'add_time',
'updated_at',
];
-1
View File
@@ -22,7 +22,6 @@ class OddsTotal extends Model
'margin',
'flag',
'nuh_check',
'source_updated_at',
'add_time',
'updated_at',
];
-1
View File
@@ -22,7 +22,6 @@ class OddsTotalQ1 extends Model
'margin',
'flag',
'nuh_check',
'source_updated_at',
'add_time',
'updated_at',
];