delete from mapper if betradarid exists
This commit is contained in:
1 parent
67322ec35b
commit
329aa1a5e4
2 files changed
+8
-1
No files matched your search
@@ -35,7 +35,6 @@ class LoadEvents
|
||||
->with('home')
|
||||
->with('away')
|
||||
->where('sport_id', $sport_id)
|
||||
->where('betradar_id', 0)
|
||||
->where('starttime', '>', Carbon::now());
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Livewire\Mapper;
|
||||
|
||||
use App\Models\Event;
|
||||
use App\Models\Mapper;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
@@ -9,6 +10,12 @@ class LoadProvider
|
||||
{
|
||||
public static function load($search_right, $user)
|
||||
{
|
||||
|
||||
$res = Event::query()->where('betradar_id', '>', 0)->pluck('betradar_id');
|
||||
foreach ($res as $betradar_id) {
|
||||
Mapper::where('betradar_id', $betradar_id)->delete();
|
||||
}
|
||||
|
||||
if ($search_right) {
|
||||
|
||||
$searchValues = preg_split('/\s+/', $search_right, -1, PREG_SPLIT_NO_EMPTY);
|
||||
@@ -23,6 +30,7 @@ class LoadProvider
|
||||
->orWhere('away', 'LIKE', '%'.$value.'%');
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
return Mapper::query()
|
||||
->where('starttime', '>', Carbon::now())
|
||||
|
||||
Reference in new issue
Block a user