Compare commits
No commits in common. "898e932ceb0303fa896d47b5bb2d59e0a7629409" and "3ec9149d755a74163cbff2be14af830d44b0c2f6" have entirely different histories.
898e932ceb
...
3ec9149d75
|
@ -1 +1 @@
|
|||
Subproject commit bd4118040fd2643b71f7f152ca2668f2097820a2
|
||||
Subproject commit b65ae906b25488c56b5c232642d848d95fb57de0
|
|
@ -149,9 +149,8 @@ abstract class EventManager extends ComponentBase
|
|||
return;
|
||||
}
|
||||
|
||||
$eventData = app(FetchAllEvents::class)->run();
|
||||
$this->eventMeta = data_get($eventData, 'meta', []);
|
||||
$this->events = $this->page['events'] = collect($eventData['data']);
|
||||
$this->eventMeta = data_get(app(FetchAllEvents::class)->run(), 'meta', []);
|
||||
$this->events = $this->page['events'] = collect(app(FetchAllEvents::class)->run()['data']);
|
||||
$this->event = $this->page['event'] = $this->events->first(fn ($event) => $event['slug'] == $eventSlug);
|
||||
$this->currentUrl = url()->current();
|
||||
}
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
<?php
|
||||
|
||||
use Silva\Adrema\Support\ClearCache;
|
||||
use Silva\Adrema\Support\Proxy;
|
||||
|
||||
Route::get('/adrema-api/{route}', fn (string $route) => Response::json(app(Proxy::class)->run($route, 'get')))
|
||||
->where('route', '[a-zA-Z0-9\-/]+')->middleware('api');
|
||||
Route::post('/adrema-api/{route}', fn (string $route) => app(Proxy::class)->submit($route))
|
||||
->where('route', '[a-zA-Z0-9\-/]+')->middleware('api');
|
||||
|
||||
Route::get('/adrema/clear-cache', fn () => app(ClearCache::class)->run());
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Silva\Adrema\Support;
|
||||
|
||||
use Cache;
|
||||
|
||||
class ClearCache
|
||||
{
|
||||
public function run(): void
|
||||
{
|
||||
Cache::forget('adrema-all-events');
|
||||
}
|
||||
}
|
|
@ -8,12 +8,11 @@ class FetchAllEvents
|
|||
{
|
||||
public function run(): ?Collection
|
||||
{
|
||||
$events = app(Proxy::class)->run('api/form');
|
||||
$events = app(Proxy::class)->run('/api/form');
|
||||
|
||||
if (!$events) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return collect($events);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace Silva\Adrema\Support;
|
||||
|
||||
use Cache;
|
||||
use Silva\Adrema\Models\Settings;
|
||||
use Http;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
@ -10,15 +9,6 @@ use Illuminate\Http\JsonResponse;
|
|||
class Proxy
|
||||
{
|
||||
public function run(string $url): ?array
|
||||
{
|
||||
if ($url === 'api/form') {
|
||||
return Cache::rememberForever('adrema-all-events', fn () => $this->get($url));
|
||||
}
|
||||
|
||||
return $this->get($url);
|
||||
}
|
||||
|
||||
protected function get(string $url): ?array
|
||||
{
|
||||
$response = Http::acceptJson()->get($this->url($url));
|
||||
|
||||
|
|
Loading…
Reference in New Issue