Files
2026-10-04 15:25:03 +02:00

31 lines
786 B
PHP

<?php
namespace App\Filament\Resources\Events\Tables\Tools;
use App\Models\Event;
use Illuminate\Support\Carbon;
class LoadClientStartimeDifference
{
public static function load()
{
$events = Event::with('event_bookmaker')
->where('sport_id', auth()->user()->sport_id)
->where('starttime', '>=', Carbon::now())
->whereHas('event_bookmaker', function ($query) {
$query->where('bookmaker_id', auth()->user()->bookmaker_id);
})
->get();
$event_ids = [];
foreach ($events as $event) {
if ($event->starttime != $event->event_bookmaker->starttime) {
$event_ids[] = $event->id;
}
}
return array_unique($event_ids);
}
}