This commit is contained in:
philipp lang 2024-02-01 02:04:27 +01:00
parent 53b92624d1
commit a06f5a573d
1 changed files with 2 additions and 3 deletions

View File

@ -4,10 +4,9 @@ namespace Silva\Adrema\Components;
use Cms\Classes\ComponentBase; use Cms\Classes\ComponentBase;
use Cms\Classes\Page; use Cms\Classes\Page;
use FetchAllEvents;
use Silva\Adrema\Exceptions\ComponentException; use Silva\Adrema\Exceptions\ComponentException;
use Silva\Adrema\Models\Settings; use Silva\Adrema\Models\Settings;
use Silva\Adrema\Support\FetchAllEvents as SupportFetchAllEvents; use Silva\Adrema\Support\FetchAllEvents;
class EventIndex extends ComponentBase class EventIndex extends ComponentBase
{ {
@ -40,7 +39,7 @@ class EventIndex extends ComponentBase
$this->eventSlug = $this->property('eventSlug'); $this->eventSlug = $this->property('eventSlug');
if ($this->eventSlug) { if ($this->eventSlug) {
$events = data_get(app(SupportFetchAllEvents::class)->run(), 'data'); $events = data_get(app(FetchAllEvents::class)->run(), 'data');
throw_if(is_null($events), ComponentException::class, 'event_fetching_failed'); throw_if(is_null($events), ComponentException::class, 'event_fetching_failed');
$this->event = collect($events)->first(fn ($event) => $event['slug'] === $this->eventSlug); $this->event = collect($events)->first(fn ($event) => $event['slug'] === $this->eventSlug);