add visible_on_map field to meetups table

This commit is contained in:
HolgerHatGarKeineNode
2023-08-07 15:43:13 +02:00
parent 1339b49a33
commit 34e065a06e
6 changed files with 174 additions and 143 deletions

View File

@@ -22,7 +22,7 @@ class MeetupEventTable extends Component
public function mount()
{
if (! $this->year) {
if (!$this->year) {
$this->year = now()->year;
}
}
@@ -31,33 +31,34 @@ class MeetupEventTable extends Component
{
return view('livewire.meetup.meetup-event-table', [
'markers' => MeetupEvent::query()
->with([
'meetup.city.country',
])
->where('meetup_events.start', '>=', now()->subDay())
->whereHas('meetup.city.country',
fn ($query) => $query->where('countries.code', $this->country->code))
->get()
->map(fn ($event) => [
'id' => $event->id,
'name' => $event->meetup->name.': '.$event->location,
'coords' => [$event->meetup->city->latitude, $event->meetup->city->longitude],
]),
->where('visible_on_map', true)
->with([
'meetup.city.country',
])
->where('meetup_events.start', '>=', now()->subDay())
->whereHas('meetup.city.country',
fn($query) => $query->where('countries.code', $this->country->code))
->get()
->map(fn($event) => [
'id' => $event->id,
'name' => $event->meetup->name . ': ' . $event->location,
'coords' => [$event->meetup->city->latitude, $event->meetup->city->longitude],
]),
'events' => MeetupEvent::query()
->with([
'meetup.city.country',
])
->where('meetup_events.start', '>=', now()->subDay())
->whereHas('meetup.city.country',
fn ($query) => $query->where('countries.code', $this->country->code))
->get()
->map(fn ($event) => [
'id' => $event->id,
'startDate' => $event->start,
'endDate' => $event->start->addHours(1),
'location' => $event->location,
'description' => $event->description,
]),
->with([
'meetup.city.country',
])
->where('meetup_events.start', '>=', now()->subDay())
->whereHas('meetup.city.country',
fn($query) => $query->where('countries.code', $this->country->code))
->get()
->map(fn($event) => [
'id' => $event->id,
'startDate' => $event->start,
'endDate' => $event->start->addHours(1),
'location' => $event->location,
'description' => $event->description,
]),
])->layout('layouts.app', [
'SEOData' => new SEOData(
title: __('Meetup dates'),