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'),

View File

@@ -17,11 +17,11 @@ class MeetupTable extends Component
public function filterByMarker($id)
{
$meetup = Meetup::with(['city.country'])
->find($id);
->find($id);
return to_route('meetup.landing', [
'country' => $meetup->city->country->code,
'meetup' => $meetup,
'meetup' => $meetup,
]);
}
@@ -31,17 +31,18 @@ class MeetupTable extends Component
return view('livewire.meetup.meetup-table', [
'markers' => Meetup::query()
->with([
'city.country',
])
->whereHas('city.country',
fn($query) => $query->where('countries.code', $this->country->code))
->get()
->map(fn($meetup) => [
'id' => $meetup->id,
'name' => $meetup->name,
'coords' => [$meetup->city->latitude, $meetup->city->longitude],
]),
->where('visible_on_map', true)
->with([
'city.country',
])
->whereHas('city.country',
fn($query) => $query->where('countries.code', $this->country->code))
->get()
->map(fn($meetup) => [
'id' => $meetup->id,
'name' => $meetup->name,
'coords' => [$meetup->city->latitude, $meetup->city->longitude],
]),
])->layout('layouts.app', [
'SEOData' => new SEOData(
title: __('Meetups'),

View File

@@ -14,7 +14,7 @@ class WorldMap extends Component
public function filterByMarker($id)
{
$meetup = Meetup::with(['city.country'])
->find($id);
->find($id);
return to_route('meetup.landing', [
'country' => $meetup->city->country->code,
@@ -26,15 +26,16 @@ class WorldMap extends Component
{
return view('livewire.meetup.world-map', [
'allMarkers' => Meetup::query()
->with([
'city.country',
])
->get()
->map(fn ($meetup) => [
'id' => $meetup->id,
'name' => $meetup->name,
'coords' => [$meetup->city->latitude, $meetup->city->longitude],
]),
->where('visible_on_map', true)
->with([
'city.country',
])
->get()
->map(fn($meetup) => [
'id' => $meetup->id,
'name' => $meetup->name,
'coords' => [$meetup->city->latitude, $meetup->city->longitude],
]),
])->layout('layouts.app', [
'SEOData' => new SEOData(
title: __('World map of meetups'),