Add later registration
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
This commit is contained in:
parent
95857afd0a
commit
8f23442954
|
|
@ -8,6 +8,7 @@ use Cms\Classes\Page;
|
|||
use Silva\Adrema\Exceptions\ComponentException;
|
||||
use Silva\Adrema\Models\Settings;
|
||||
use Silva\Adrema\Support\FetchAllEvents;
|
||||
use Validator;
|
||||
|
||||
abstract class EventManager extends ComponentBase
|
||||
{
|
||||
|
|
@ -15,6 +16,7 @@ abstract class EventManager extends ComponentBase
|
|||
public array $settings = [];
|
||||
public ?array $event = null;
|
||||
public array $eventMeta = [];
|
||||
public array $pageMeta = [];
|
||||
|
||||
/** @var Collection<int, mixed> */
|
||||
public Collection $events;
|
||||
|
|
@ -37,9 +39,22 @@ abstract class EventManager extends ComponentBase
|
|||
$this->loadColors();
|
||||
$this->loadSettings();
|
||||
$this->loadSingleEvent();
|
||||
$this->loadQueryParams();
|
||||
$this->page['breadcrumbs'] = $this->getBreadcrumbs();
|
||||
}
|
||||
|
||||
private function loadQueryParams(): array {
|
||||
$validator = Validator::make(array_only(request()->query(), ['signature', 'id', 'later']), [
|
||||
'signature' => 'required|string',
|
||||
'id' => 'required|string|uuid:4',
|
||||
'later' => 'required|numeric|in:1',
|
||||
]);
|
||||
|
||||
return $validator->fails()
|
||||
? ['later' => '0']
|
||||
: $validator->validated();
|
||||
}
|
||||
|
||||
private function getBreadcrumbs(): Collection
|
||||
{
|
||||
$breadcrumbs = collect([]);
|
||||
|
|
@ -153,6 +168,7 @@ abstract class EventManager extends ComponentBase
|
|||
$this->eventMeta = data_get($eventData, 'meta', []);
|
||||
$this->events = $this->page['events'] = collect($eventData['data']);
|
||||
$this->event = $this->page['event'] = $this->events->first(fn ($event) => $event['slug'] == $eventSlug);
|
||||
$this->pageMeta = $this->loadQueryParams();
|
||||
$this->currentUrl = url()->current();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
<script type="text/javascript">
|
||||
var adrema_event_config = {{__SELF__.event.config | json_encode | raw}};
|
||||
var adrema_event_meta = {{__SELF__.eventMeta | json_encode | raw}};
|
||||
var adrema_page_meta = {{__SELF__.pageMeta | json_encode | raw}};
|
||||
</script>
|
||||
{% endif %}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue