fixtures new wip
This commit is contained in:
1 parent
a1057d55a7
commit
69619802ce
27 files changed
+156
-187
No files matched your search
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace App\Livewire\Mapper;
|
||||
|
||||
use App\Models\Element;
|
||||
use App\Models\Event;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class LoadEvents
|
||||
{
|
||||
public static function load($search_left)
|
||||
{
|
||||
if ($search_left) {
|
||||
|
||||
$searchValues = preg_split('/\s+/', $search_left, -1, PREG_SPLIT_NO_EMPTY);
|
||||
|
||||
$element_ids = Element::where(function ($query) use ($searchValues) {
|
||||
foreach ($searchValues as $value) {
|
||||
$query->orWhere('name', 'LIKE', '%'.$value.'%');
|
||||
}
|
||||
})->pluck('id')->toArray();
|
||||
|
||||
$query = Event::query()
|
||||
->with('home')
|
||||
->with('away')
|
||||
->where('sport_id', Auth::user()->sport_id)
|
||||
->where('starttime', '>', Carbon::now())
|
||||
->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('sport_id', Auth::user()->sport_id)
|
||||
->where('starttime', '>', Carbon::now());
|
||||
}
|
||||
|
||||
switch (Auth::user()->provider_id) {
|
||||
case 2:
|
||||
// BETSAPI
|
||||
return $query->where('betsapi_id', 0);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
// Magloo Kenia
|
||||
return $query->where('magken_id', 0);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
// Magloo Nigeria
|
||||
return $query->where('magnig_id', 0);
|
||||
break;
|
||||
|
||||
case 5:
|
||||
// Logifuture Nigeria
|
||||
return $query->where('lognig_id', 0);
|
||||
break;
|
||||
|
||||
case 6:
|
||||
// Magloo Colombia
|
||||
return $query->where('logcol_id', 0);
|
||||
break;
|
||||
|
||||
default:
|
||||
return $query->where('betradar_id', 0);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user