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,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Livewire\Mapper;
|
||||
|
||||
use App\Models\Mapper;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class LoadProvider
|
||||
{
|
||||
public static function load($search_right)
|
||||
{
|
||||
if ($search_right) {
|
||||
|
||||
$searchValues = preg_split('/\s+/', $search_right, -1, PREG_SPLIT_NO_EMPTY);
|
||||
|
||||
return Mapper::query()
|
||||
->where('sport_id', Auth::user()->sport_id)
|
||||
->where('starttime', '>', Carbon::now())
|
||||
->where('provider_id', Auth::user()->provider_id)
|
||||
->where(function ($query) use ($searchValues) {
|
||||
foreach ($searchValues as $value) {
|
||||
$query->orWhere('home', 'LIKE', '%'.$value.'%')
|
||||
->orWhere('away', 'LIKE', '%'.$value.'%');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
return Mapper::query()
|
||||
->where('sport_id', Auth::user()->sport_id)
|
||||
->where('starttime', '>', Carbon::now())
|
||||
->where('provider_id', Auth::user()->provider_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user