map for events

This commit is contained in:
Benjamin Takats
2022-12-15 19:40:15 +01:00
parent f12fa41fbb
commit ca5b74d072
3 changed files with 92 additions and 26 deletions

View File

@@ -24,6 +24,18 @@ class BitcoinEventTable extends Component
public function render()
{
return view('livewire.bitcoin-event.bitcoin-event-table', [
'markers' => BitcoinEvent::query()
->with([
'venue.city.country',
])
->whereHas('venue.city.country',
fn($query) => $query->where('countries.code', $this->country->code))
->get()
->map(fn($event) => [
'id' => $event->id,
'name' => $event->name,
'coords' => [$event->venue->city->latitude, $event->venue->city->longitude],
]),
'events' => BitcoinEvent::query()
->get()
->map(fn($event) => [
@@ -36,6 +48,18 @@ class BitcoinEventTable extends Component
]);
}
public function filterByMarker($id)
{
return to_route('bitcoinEvent.table.bitcoinEvent', [
'country' => $this->country->code,
'table' => [
'filters' => [
'byid' => $id,
],
]
]);
}
public function popover($content, $ids)
{
return to_route('bitcoinEvent.table.bitcoinEvent', [