wip fix
This commit is contained in:
1 parent
9bcd4432c6
commit
6f92f9e1d5
1209 files changed
+220940
No files matched your search
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Events\Tables\Tools;
|
||||
|
||||
use App\Filament\Resources\Events\Tables\EventsTable;
|
||||
use App\Models\OddsTable;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class LoadPartnerDifferences
|
||||
{
|
||||
public static function load()
|
||||
{
|
||||
$event_ids = [];
|
||||
foreach (EventsTable::$bettype_settings as $table) {
|
||||
|
||||
$has_active_spread = OddsTable::where('name', $table)->value('has_active_spread');
|
||||
|
||||
if ($has_active_spread) {
|
||||
$events = DB::table($table)
|
||||
->whereIn('bookmaker_id', [auth()->user()->bookmaker_id, auth()->user()->partner_bookmaker_id])
|
||||
->where('active_spread', 1)
|
||||
->get();
|
||||
} else {
|
||||
$events = DB::table($table)
|
||||
->whereIn('bookmaker_id', [auth()->user()->bookmaker_id, auth()->user()->partner_bookmaker_id])
|
||||
->get();
|
||||
}
|
||||
$res = [];
|
||||
foreach ($events as $value) {
|
||||
$value = get_object_vars($value);
|
||||
$event_id = $value['event_id'];
|
||||
foreach (['id', 'event_id', 'sport_id', 'bookmaker_id', 'provider_id', 'offer_id', 'bmoid', 'margin', 'flags', 'nuh_check', 'last_updated', 'created_at', 'updated_at'] as $fieldname) {
|
||||
unset($value[$fieldname]);
|
||||
}
|
||||
$res[$event_id][] = $value;
|
||||
}
|
||||
|
||||
foreach ($res as $event_id => $odds) {
|
||||
if (count($odds) == 2 && array_diff($odds[0], $odds[1])) {
|
||||
$event_ids[] = $event_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return array_unique($event_ids);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user