wip del err
This commit is contained in:
1 parent
812736ca9a
commit
9bcd4432c6
1210 files changed
-220941
No files matched your search
@@ -1,53 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Livewire\Mapper;
|
||||
|
||||
use App\Models\Event;
|
||||
use App\Models\Mapper;
|
||||
use App\Models\Element;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class LoadEvents
|
||||
{
|
||||
public static function load($search_values)
|
||||
{
|
||||
$res = Event::query()->where('betradar_id', '>', 0)->pluck('betradar_id');
|
||||
|
||||
foreach ($res as $betradar_id) {
|
||||
Mapper::where('betradar_id', $betradar_id)->delete();
|
||||
}
|
||||
|
||||
if ($search_values) {
|
||||
$element_ids = Element::where(function ($query) use ($search_values) {
|
||||
foreach ($search_values as $value) {
|
||||
$query->orWhere('name', 'LIKE', '%' . $value . '%');
|
||||
}
|
||||
})->pluck('id')->toArray();
|
||||
|
||||
$query = Event::query()
|
||||
->with('home')
|
||||
->with('away')
|
||||
->where('has_markets', 1)
|
||||
->where('sport_id', auth()->user()->sport_id)
|
||||
->where(function ($query) use ($element_ids) {
|
||||
$query->orWhereIn('home_id', $element_ids)->orWhereIn('away_id', $element_ids);
|
||||
});
|
||||
} else {
|
||||
$query = Event::query()
|
||||
->with('home')
|
||||
->with('away')
|
||||
->where('has_markets', 1)
|
||||
->where('sport_id', auth()->user()->sport_id);
|
||||
}
|
||||
|
||||
switch (Auth::user()->provider_id) {
|
||||
case 2:
|
||||
// BETSAPI
|
||||
return $query->where('bet365_id', 0);
|
||||
|
||||
default:
|
||||
return $query->with('event_bookmaker')->doesntHave('event_bookmaker');
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user