mapper ok
This commit is contained in:
1 parent
2e57e49f08
commit
c617935e2f
18 files changed
+227
-97
No files matched your search
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user