partner programm completed
This commit is contained in:
1 parent
84bfa248cd
commit
a883ccf0ea
22 files changed
+722
-28
No files matched your search
@@ -0,0 +1,41 @@
|
||||
<?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()
|
||||
{
|
||||
$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();
|
||||
|
||||
foreach ($books as $book) {
|
||||
$row1 = get_object_vars($book);
|
||||
foreach ($partners as $partner) {
|
||||
$row2 = get_object_vars($partner);
|
||||
if ($row1['event_id'] == $row2['event_id']) {
|
||||
foreach ($fields[$table] as $field) {
|
||||
if ($row1[$field] != $row2[$field]) {
|
||||
$event_ids[] = $row1['event_id'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return array_unique($event_ids);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user