wip
This commit is contained in:
1 parent
da7d4092ac
commit
0cf815c00f
39 files changed
+582
-1760
No files matched your search
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Events\Tables\Tools;
|
||||
|
||||
use App\Filament\Resources\Events\Tables\EventsTable;
|
||||
use App\Models\ComparingBookmaker;
|
||||
use App\Models\MultilineClient;
|
||||
use App\Models\MultilineSetting;
|
||||
|
||||
class LoadMultiline
|
||||
{
|
||||
public static $user;
|
||||
|
||||
public static function load()
|
||||
{
|
||||
// if (EventsTable::$user->sport_id == 1) {
|
||||
// $cb = ComparingBookmaker::where('sport_id', 1)->where('client_bookmaker_id', EventsTable::$user->bookmaker_id)->orderBy('sorting')->select('bookmaker_id', 'time_lastcheck', 'margin_threshold', 'is_active')->get()->toArray();
|
||||
// } else {
|
||||
// $cb = ComparingBookmaker::where('sport_id', '!=', 1)->where('client_bookmaker_id', EventsTable::$user->bookmaker_id)->orderBy('sorting')->select('bookmaker_id', 'time_lastcheck', 'margin_threshold', 'is_active')->get()->toArray();
|
||||
// }
|
||||
|
||||
$cb = ComparingBookmaker::where('sport_id', EventsTable::$user->sport_id)->where('client_bookmaker_id', EventsTable::$user->bookmaker_id)->orderBy('sorting')->select('bookmaker_id', 'time_lastcheck', 'margin_threshold', 'is_active')->get()->toArray();
|
||||
|
||||
$bookmakers = [];
|
||||
$filter = [];
|
||||
foreach ($cb as $value) {
|
||||
$bookmakers[] = $value['bookmaker_id'];
|
||||
$filter[$value['bookmaker_id']] = [
|
||||
'time_lastcheck' => $value['time_lastcheck'],
|
||||
'margin' => $value['margin_threshold'],
|
||||
];
|
||||
}
|
||||
|
||||
$res = MultilineSetting::where('sport_id', EventsTable::$user->sport_id)->get();
|
||||
|
||||
foreach ($res as $value) {
|
||||
EventsTable::$filter[$value->table] = $filter;
|
||||
if (EventsTable::$user->is_multiline_direct) {
|
||||
EventsTable::$slots[$value->table] = $bookmakers;
|
||||
array_unshift(EventsTable::$slots[$value->table], EventsTable::$user->bookmaker_id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (! EventsTable::$user->is_multiline_direct) {
|
||||
$res = MultilineClient::with('multiline_setting')
|
||||
->select('bookmaker_id', 'multiline_setting_id')
|
||||
->orderBy('sort')
|
||||
->get();
|
||||
|
||||
foreach ($res as $value) {
|
||||
$table = $value->multiline_setting->table;
|
||||
|
||||
if (! isset(EventsTable::$slots[$table])) {
|
||||
EventsTable::$slots[$table][] = (int) EventsTable::$user->bookmaker_id;
|
||||
}
|
||||
EventsTable::$slots[$table][] = (int) $value->bookmaker_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user