mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-11 06:46:47 +00:00
world map
This commit is contained in:
@@ -39,16 +39,6 @@ class MeetupTable extends Component
|
||||
'name' => $meetup->name,
|
||||
'coords' => [$meetup->city->latitude, $meetup->city->longitude],
|
||||
]),
|
||||
'allMarkers' => Meetup::query()
|
||||
->with([
|
||||
'city.country',
|
||||
])
|
||||
->get()
|
||||
->map(fn($meetup) => [
|
||||
'id' => $meetup->id,
|
||||
'name' => $meetup->name,
|
||||
'coords' => [$meetup->city->latitude, $meetup->city->longitude],
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
43
app/Http/Livewire/Meetup/WorldMap.php
Normal file
43
app/Http/Livewire/Meetup/WorldMap.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Livewire\Meetup;
|
||||
|
||||
use App\Models\Country;
|
||||
use App\Models\Meetup;
|
||||
use Livewire\Component;
|
||||
|
||||
class WorldMap extends Component
|
||||
{
|
||||
public Country $country;
|
||||
|
||||
public function filterByMarker($id)
|
||||
{
|
||||
$meetup = Meetup::with(['city.country'])
|
||||
->find($id);
|
||||
|
||||
return to_route('meetup.table.meetup', [
|
||||
'country' => $meetup->city->country->code,
|
||||
'table' => [
|
||||
'filters' => [
|
||||
'byid' => $id,
|
||||
],
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
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],
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user