wi-adrema-plugin/support/FetchAllEvents.php

22 lines
399 B
PHP
Raw Normal View History

2024-02-01 01:58:40 +01:00
<?php
namespace Silva\Adrema\Support;
2024-02-04 01:12:22 +01:00
use Illuminate\Support\Collection;
2024-04-26 15:31:32 +02:00
use Cache;
2024-02-04 01:12:22 +01:00
2024-02-01 01:58:40 +01:00
class FetchAllEvents
{
2024-02-04 01:12:22 +01:00
public function run(): ?Collection
2024-02-01 01:58:40 +01:00
{
2024-04-26 15:31:32 +02:00
$events = Cache::remember('adrema-all-events', 3600, function () {
return app(Proxy::class)->run('/api/form');
});
2024-02-04 01:12:22 +01:00
if (!$events) {
return null;
}
return collect($events);
2024-02-01 01:58:40 +01:00
}
}