mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-11 06:46:47 +00:00
Shift automatically applies the Laravel coding style - which uses the PSR-12 coding style as a base with some minor additions. You may customize the code style applied by configuring [Pint](https://laravel.com/docs/pint), [PHP CS Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer), or [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) for your project root. For more information on customizing the code style applied by Shift, [watch this short video](https://laravelshift.com/videos/shift-code-style).
46 lines
1.3 KiB
PHP
46 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Livewire\Meetup;
|
|
|
|
use App\Models\Country;
|
|
use App\Models\Meetup;
|
|
use Livewire\Component;
|
|
use RalphJSmit\Laravel\SEO\Support\SEOData;
|
|
|
|
class WorldMap extends Component
|
|
{
|
|
public Country $country;
|
|
|
|
public function filterByMarker($id)
|
|
{
|
|
$meetup = Meetup::with(['city.country'])
|
|
->find($id);
|
|
|
|
return to_route('meetup.landing', [
|
|
'country' => $meetup->city->country->code,
|
|
'meetup' => $meetup,
|
|
]);
|
|
}
|
|
|
|
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],
|
|
]),
|
|
])->layout('layouts.app', [
|
|
'SEOData' => new SEOData(
|
|
title: __('World map of meetups'),
|
|
image: asset('img/screenshot.png')
|
|
),
|
|
]);
|
|
}
|
|
}
|