filters ok
This commit is contained in:
1 parent
8e9bb0eacb
commit
98d92b2ee3
16 files changed
+365
-189
No files matched your search
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user