mapper ok

This commit is contained in:
salam committed 2026-01-06 13:09:18 +01:00
1 parent 2e57e49f08
commit c617935e2f
18 files changed
+227 -97

No files matched your search

+21 -5
View File
@@ -8,11 +8,27 @@ use Illuminate\Support\Facades\Auth;
class LoadProvider
{
public static function load()
public static function load($search_right)
{
return Mapper::query()
->where('sport_id', Auth::user()->sport_id)
->where('starttime', '>', Carbon::now())
->where('provider_id', Auth::user()->provider_id);
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);
}
}
}