29 lines
631 B
PHP
29 lines
631 B
PHP
<?php
|
|
|
|
namespace App\Mapper;
|
|
|
|
use App\Models\Event;
|
|
use App\Models\Mapper;
|
|
use Illuminate\Support\Facades\Auth;
|
|
|
|
class FindEvent
|
|
{
|
|
public static function search($event)
|
|
{
|
|
dd($event);
|
|
|
|
$event_id = $event['event_id'];
|
|
|
|
$match_id = Event::where('betsapi_id', $event_id)->value('id');
|
|
|
|
if ($match_id) {
|
|
Mapper::where('event_id', $event_id)->delete();
|
|
} else {
|
|
|
|
Mapper::updateOrCreate(['event_id' => $event_id], $event);
|
|
}
|
|
|
|
return Mapper::query()->where('sport_id', Auth::user()->sport_id)->where('provider_id', Auth::user()->provider_id);
|
|
}
|
|
}
|