filter comparatore wip
This commit is contained in:
1 parent
7a9eeb8aad
commit
937c5908d2
40 files changed
+362
-306
No files matched your search
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Events\Tables\Tools;
|
||||
|
||||
use App\Models\ComparingBookmaker;
|
||||
use App\Models\MultilineClient;
|
||||
use App\Models\MultilineSetting;
|
||||
use App\Models\User;
|
||||
|
||||
class LoadMultilineBookmaker
|
||||
{
|
||||
public static $user;
|
||||
|
||||
public static function load()
|
||||
{
|
||||
self::$user = User::getUser();
|
||||
|
||||
$arr = [];
|
||||
|
||||
// if (self::$user->sport_id == 1) {
|
||||
// $cb = ComparingBookmaker::where('sport_id', 1)->where('client_bookmaker_id', self::$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', self::$user->bookmaker_id)->orderBy('sorting')->select('bookmaker_id', 'time_lastcheck', 'margin_threshold', 'is_active')->get()->toArray();
|
||||
// }
|
||||
|
||||
$cb = ComparingBookmaker::where('sport_id', self::$user->sport_id)->where('client_bookmaker_id', self::$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', self::$user->sport_id)->get();
|
||||
|
||||
foreach ($res as $value) {
|
||||
$arr[$value->table]['filter'] = $filter;
|
||||
$arr[$value->table]['bookmaker'] = $bookmakers;
|
||||
if (auth()->user()->is_multiline_direct) {
|
||||
$arr[$value->table]['slots'] = $bookmakers;
|
||||
}
|
||||
}
|
||||
|
||||
if (! auth()->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;
|
||||
$arr[$table]['slots'][] = (int) self::$user->bookmaker_id;
|
||||
}
|
||||
foreach ($res as $value) {
|
||||
$table = $value->multiline_setting->table;
|
||||
$arr[$table]['slots'][] = (int) $value->bookmaker_id;
|
||||
}
|
||||
}
|
||||
|
||||
return $arr;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user