Apply Laravel coding style

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).
This commit is contained in:
Shift
2023-02-19 16:18:46 +00:00
committed by HolgerHatGarKeineNode
parent a15ca4a2bc
commit 5776b01d15
333 changed files with 4915 additions and 4967 deletions

View File

@@ -12,31 +12,34 @@ class MeetupEventForm extends Component
use Actions;
public string $country;
public ?MeetupEvent $meetupEvent = null;
public bool $recurring = false;
public int $repetitions = 52;
public array $series = [];
public function rules()
{
return [
'meetupEvent.meetup_id' => 'required',
'meetupEvent.start' => 'required',
'meetupEvent.location' => 'string|nullable',
'meetupEvent.meetup_id' => 'required',
'meetupEvent.start' => 'required',
'meetupEvent.location' => 'string|nullable',
'meetupEvent.description' => 'string|nullable',
'meetupEvent.link' => 'string|url|nullable',
'meetupEvent.link' => 'string|url|nullable',
'series.*.start' => 'required',
'recurring' => 'bool',
'recurring' => 'bool',
'repetitions' => 'numeric|min:1',
];
}
public function mount()
{
if (!$this->meetupEvent) {
if (! $this->meetupEvent) {
$this->meetupEvent = new MeetupEvent(
[
'start' => now()
@@ -44,7 +47,7 @@ class MeetupEventForm extends Component
->addHours(17),
]
);
} elseif (!auth()
} elseif (! auth()
->user()
->can('update', $this->meetupEvent)) {
abort(403);
@@ -86,15 +89,15 @@ class MeetupEventForm extends Component
$this->dialog()
->confirm(
[
'title' => __('Delete event'),
'title' => __('Delete event'),
'description' => __('Are you sure you want to delete this event? This action cannot be undone.'),
'icon' => 'warning',
'accept' => [
'label' => __('Yes, delete'),
'icon' => 'warning',
'accept' => [
'label' => __('Yes, delete'),
'method' => 'deleteEvent',
],
'reject' => [
'label' => __('No, cancel'),
'reject' => [
'label' => __('No, cancel'),
'method' => 'cancel',
],
]
@@ -111,7 +114,7 @@ class MeetupEventForm extends Component
public function submit()
{
$this->validate();
if (!$this->meetupEvent->id) {
if (! $this->meetupEvent->id) {
$hasAppointmentsOnThisDate = MeetupEvent::query()
->where('meetup_id', $this->meetupEvent->meetup_id)
->where('start', '>', Carbon::parse($this->meetupEvent->start)
@@ -129,7 +132,7 @@ class MeetupEventForm extends Component
$this->meetupEvent->save();
if (!$this->meetupEvent->id && $this->recurring) {
if (! $this->meetupEvent->id && $this->recurring) {
foreach ($this->series as $event) {
$hasAppointmentsOnThisDate = MeetupEvent::query()
->where('meetup_id', $this->meetupEvent->meetup_id)

View File

@@ -11,7 +11,9 @@ use RalphJSmit\Laravel\SEO\Support\SEOData;
class LandingPage extends Component
{
public Meetup $meetup;
public Country $country;
public ?int $activeEvent = null;
public ?int $year = null;
@@ -34,7 +36,7 @@ class LandingPage extends Component
->where('meetup_events.start', '>=', now())
->orderBy('start')
->get(),
'events' => MeetupEvent::query()
'events' => MeetupEvent::query()
->with([
'meetup.city.country',
])
@@ -42,11 +44,11 @@ class LandingPage extends Component
->where('meetup_events.start', '>=', now())
->orderBy('start')
->get()
->map(fn($event) => [
'id' => $event->id,
'startDate' => $event->start,
'endDate' => $event->start->addHours(1),
'location' => $event->location,
->map(fn ($event) => [
'id' => $event->id,
'startDate' => $event->start,
'endDate' => $event->start->addHours(1),
'location' => $event->location,
'description' => $event->description,
]),
])
@@ -55,7 +57,7 @@ class LandingPage extends Component
title: $this->meetup->name,
description: __('Bitcoiner Meetups are a great way to meet other Bitcoiners in your area. You can learn from each other, share ideas, and have fun!'),
image: $this->meetup->getFirstMediaUrl('logo'),
)
),
]);
}

View File

@@ -12,10 +12,15 @@ use RalphJSmit\Laravel\SEO\Support\SEOData;
class LandingPageEvent extends Component
{
public MeetupEvent $meetupEvent;
public Country $country;
public ?Meetup $meetup = null;
public bool $willShowUp = false;
public bool $perhapsShowUp = false;
public string $name = '';
public function rules()
@@ -23,7 +28,7 @@ class LandingPageEvent extends Component
return [
'name' => [
'required',
new UniqueAttendeeName($this->meetupEvent)
new UniqueAttendeeName($this->meetupEvent),
],
];
}
@@ -40,33 +45,33 @@ class LandingPageEvent extends Component
$attendees = collect($this->meetupEvent->attendees);
$mightAttendees = collect($this->meetupEvent->might_attendees);
if (auth()->check() && $attendees->contains(fn($value) => str($value)->contains('id_'.auth()->id()))) {
$this->name = str($attendees->filter(fn($value) => str($value)->contains('id_'.auth()->id()))
if (auth()->check() && $attendees->contains(fn ($value) => str($value)->contains('id_'.auth()->id()))) {
$this->name = str($attendees->filter(fn ($value) => str($value)->contains('id_'.auth()->id()))
->first())
->after('|')
->toString();
$this->willShowUp = true;
}
if (!auth()->check() && $attendees->contains(fn($value) => str($value)->contains('anon_'.session()->getId()))) {
$this->name = str($attendees->filter(fn($value) => str($value)->contains('anon_'.session()->getId()))
if (! auth()->check() && $attendees->contains(fn ($value) => str($value)->contains('anon_'.session()->getId()))) {
$this->name = str($attendees->filter(fn ($value) => str($value)->contains('anon_'.session()->getId()))
->first())
->after('|')
->toString();
$this->willShowUp = true;
}
if (auth()->check() && $mightAttendees->contains(fn($value) => str($value)->contains('id_'.auth()->id()))) {
$this->name = str($mightAttendees->filter(fn($value) => str($value)->contains('id_'.auth()->id()))
if (auth()->check() && $mightAttendees->contains(fn ($value) => str($value)->contains('id_'.auth()->id()))) {
$this->name = str($mightAttendees->filter(fn ($value) => str($value)->contains('id_'.auth()->id()))
->first())
->after('|')
->toString();
$this->perhapsShowUp = true;
}
if (!auth()->check() && $mightAttendees->contains(fn($value
if (! auth()->check() && $mightAttendees->contains(fn ($value
) => str($value)->contains('anon_'.session()->getId()))) {
$this->name = str($mightAttendees->filter(fn($value) => str($value)->contains('anon_'.session()->getId()))
$this->name = str($mightAttendees->filter(fn ($value) => str($value)->contains('anon_'.session()->getId()))
->first())
->after('|')
->toString();
@@ -79,29 +84,29 @@ class LandingPageEvent extends Component
$attendees = collect($this->meetupEvent->attendees);
$mightAttendees = collect($this->meetupEvent->might_attendees);
if (auth()->check() && $attendees->contains(fn($value) => str($value)->contains('id_'.auth()->id()))) {
$attendees = $attendees->filter(fn($value) => !str($value)->contains('id_'.auth()->id()));
if (auth()->check() && $attendees->contains(fn ($value) => str($value)->contains('id_'.auth()->id()))) {
$attendees = $attendees->filter(fn ($value) => ! str($value)->contains('id_'.auth()->id()));
$this->willShowUp = false;
}
if (!auth()->check() && $attendees->contains(fn($value) => str($value)->contains('anon_'.session()->getId()))) {
$attendees = $attendees->filter(fn($value) => !str($value)->contains('anon_'.session()->getId()));
if (! auth()->check() && $attendees->contains(fn ($value) => str($value)->contains('anon_'.session()->getId()))) {
$attendees = $attendees->filter(fn ($value) => ! str($value)->contains('anon_'.session()->getId()));
$this->willShowUp = false;
}
if (auth()->check() && $mightAttendees->contains(fn($value) => str($value)->contains('id_'.auth()->id()))) {
$mightAttendees = $mightAttendees->filter(fn($value) => !str($value)->contains('id_'.auth()->id()));
if (auth()->check() && $mightAttendees->contains(fn ($value) => str($value)->contains('id_'.auth()->id()))) {
$mightAttendees = $mightAttendees->filter(fn ($value) => ! str($value)->contains('id_'.auth()->id()));
$this->perhapsShowUp = false;
}
if (!auth()->check() && $mightAttendees->contains(fn($value
if (! auth()->check() && $mightAttendees->contains(fn ($value
) => str($value)->contains('anon_'.session()->getId()))) {
$mightAttendees = $mightAttendees->filter(fn($value) => !str($value)->contains('anon_'.session()->getId()));
$mightAttendees = $mightAttendees->filter(fn ($value) => ! str($value)->contains('anon_'.session()->getId()));
$this->perhapsShowUp = false;
}
$this->meetupEvent->update([
'attendees' => $attendees->toArray(),
'attendees' => $attendees->toArray(),
'might_attendees' => $mightAttendees->toArray(),
]);
}
@@ -111,12 +116,12 @@ class LandingPageEvent extends Component
$this->validate();
$attendees = collect($this->meetupEvent->attendees);
if (auth()->check() && !$attendees->contains('id_'.auth()->id().'|'.$this->name)) {
if (auth()->check() && ! $attendees->contains('id_'.auth()->id().'|'.$this->name)) {
$attendees->push('id_'.auth()->id().'|'.$this->name);
$this->willShowUp = true;
}
if (!auth()->check() && !$attendees->contains('anon_'.session()->getId().'|'.$this->name)) {
if (! auth()->check() && ! $attendees->contains('anon_'.session()->getId().'|'.$this->name)) {
$attendees->push('anon_'.session()->getId().'|'.$this->name);
$this->willShowUp = true;
}
@@ -131,12 +136,12 @@ class LandingPageEvent extends Component
$this->validate();
$mightAttendees = collect($this->meetupEvent->might_attendees);
if (auth()->check() && !$mightAttendees->contains('id_'.auth()->id().'|'.$this->name)) {
if (auth()->check() && ! $mightAttendees->contains('id_'.auth()->id().'|'.$this->name)) {
$mightAttendees->push('id_'.auth()->id().'|'.$this->name);
$this->perhapsShowUp = true;
}
if (!auth()->check() && !$mightAttendees->contains('anon_'.session()->getId().'|'.$this->name)) {
if (! auth()->check() && ! $mightAttendees->contains('anon_'.session()->getId().'|'.$this->name)) {
$mightAttendees->push('anon_'.session()->getId().'|'.$this->name);
$this->perhapsShowUp = true;
}
@@ -153,7 +158,7 @@ class LandingPageEvent extends Component
title: $this->meetupEvent->start->asDateTime().' - '.$this->meetup->name,
description: __('Here you can confirm your participation and find more information about the Meetup.').' - '.$this->meetupEvent->description,
image: $this->meetup->getFirstMediaUrl('logo'),
)
),
]);
}
}

View File

@@ -20,7 +20,7 @@ class MeetupEventTable extends Component
public function mount()
{
if (!$this->year) {
if (! $this->year) {
$this->year = now()->year;
}
}
@@ -34,26 +34,26 @@ class MeetupEventTable extends Component
])
->where('meetup_events.start', '>=', now())
->whereHas('meetup.city.country',
fn($query) => $query->where('countries.code', $this->country->code))
fn ($query) => $query->where('countries.code', $this->country->code))
->get()
->map(fn($event) => [
'id' => $event->id,
'name' => $event->meetup->name.': '.$event->location,
->map(fn ($event) => [
'id' => $event->id,
'name' => $event->meetup->name.': '.$event->location,
'coords' => [$event->meetup->city->latitude, $event->meetup->city->longitude],
]),
'events' => MeetupEvent::query()
'events' => MeetupEvent::query()
->with([
'meetup.city.country',
])
->where('meetup_events.start', '>=', now())
->whereHas('meetup.city.country',
fn($query) => $query->where('countries.code', $this->country->code))
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,
->map(fn ($event) => [
'id' => $event->id,
'startDate' => $event->start,
'endDate' => $event->start->addHours(1),
'location' => $event->location,
'description' => $event->description,
]),
])->layout('layouts.app', [
@@ -61,7 +61,7 @@ class MeetupEventTable extends Component
title: __('Meetup dates'),
description: __('List of all meetup dates'),
image: asset('img/screenshot.png')
)
),
]);
}
@@ -69,28 +69,27 @@ class MeetupEventTable extends Component
{
return to_route('meetup.table.meetupEvent', [
'#table',
'country' => $this->country->code,
'year' => $this->year,
'country' => $this->country->code,
'year' => $this->year,
'meetup_events' => [
'filters' => [
'byid' => $id,
],
]
],
]);
}
public function popover($content, $ids)
{
return to_route('meetup.table.meetupEvent', [
'#table',
'year' => $this->year,
'year' => $this->year,
'country' => $this->country->code,
'meetup_events' => [
'meetup_events' => [
'filters' => [
'byid' => $ids,
]
]
],
],
]);
}
}

View File

@@ -18,7 +18,7 @@ class MeetupTable extends Component
return to_route('meetup.landing', [
'country' => $meetup->city->country->code,
'meetup' => $meetup,
'meetup' => $meetup,
]);
}
@@ -32,11 +32,11 @@ class MeetupTable extends Component
'city.country',
])
->whereHas('city.country',
fn($query) => $query->where('countries.code', $this->country->code))
fn ($query) => $query->where('countries.code', $this->country->code))
->get()
->map(fn($meetup) => [
'id' => $meetup->id,
'name' => $meetup->name,
->map(fn ($meetup) => [
'id' => $meetup->id,
'name' => $meetup->name,
'coords' => [$meetup->city->latitude, $meetup->city->longitude],
]),
])->layout('layouts.app', [
@@ -44,7 +44,7 @@ class MeetupTable extends Component
title: __('Meetups'),
description: __('Bitcoiner Meetups are a great way to meet other Bitcoiners in your area. You can learn from each other, share ideas, and have fun!'),
image: asset('img/screenshot.png')
)
),
]);
}
}

View File

@@ -20,6 +20,7 @@ class PrepareForBtcMapItem extends Component
public string $search = '';
public $population;
public $population_date = '';
public ?int $osm_id = null;
@@ -52,7 +53,7 @@ class PrepareForBtcMapItem extends Component
public function rules(): array
{
return [
'search' => 'required|string',
'search' => 'required|string',
'currentPercentage' => 'required|numeric',
'model.simplified_geojson' => 'nullable',
@@ -60,7 +61,7 @@ class PrepareForBtcMapItem extends Component
'OSMBoundaries' => 'bool',
'polygonsOSMfr' => 'bool',
'population' => 'nullable|numeric',
'population' => 'nullable|numeric',
'population_date' => 'nullable|string',
'polygonsOSMfrX' => 'numeric|max:1',
@@ -84,7 +85,7 @@ class PrepareForBtcMapItem extends Component
private function getSearchResults(): void
{
$responses = Http::pool(fn(Pool $pool) => [
$responses = Http::pool(fn (Pool $pool) => [
$pool->acceptJson()
->get(
sprintf('https://nominatim.openstreetmap.org/search?q=%s&format=json&polygon_geojson=1&polygon_threshold=0.0003&email='.config('services.nominatim.email'),
@@ -93,7 +94,7 @@ class PrepareForBtcMapItem extends Component
]);
$this->osmSearchResults = collect($responses[0]->json())
->filter(fn($item
->filter(fn ($item
) => (
$item['geojson']['type'] === 'Polygon'
|| $item['geojson']['type'] === 'MultiPolygon'
@@ -156,7 +157,6 @@ class PrepareForBtcMapItem extends Component
// emit event for AlpineJS
$this->emit('geoJsonUpdated');
} catch (\Exception $e) {
$this->notification()
->error('Error', $e->getMessage());
@@ -180,9 +180,9 @@ class PrepareForBtcMapItem extends Component
->post(
'https://polygons.openstreetmap.fr/?id='.$this->selectedItemOSMPolygons['osm_id'],
[
'x' => $this->polygonsOSMfrX,
'y' => $this->polygonsOSMfrY,
'z' => $this->polygonsOSMfrZ,
'x' => $this->polygonsOSMfrX,
'y' => $this->polygonsOSMfrY,
'z' => $this->polygonsOSMfrZ,
'generate' => 'Submit+Query',
]
);
@@ -247,9 +247,9 @@ class PrepareForBtcMapItem extends Component
$response = Http::acceptJson()
->asForm()
->post('https://osm-boundaries.com/Ajax/GetBoundary', [
'db' => 'osm20221205',
'db' => 'osm20221205',
'waterOrLand' => 'water',
'osmId' => '-'.$this->selectedItemOSMPolygons['osm_id'],
'osmId' => '-'.$this->selectedItemOSMPolygons['osm_id'],
]);
if ($response->json()) {
if (count($response->json()['coordinates'], COUNT_RECURSIVE) > 100000) {
@@ -286,7 +286,7 @@ class PrepareForBtcMapItem extends Component
$this->model->population = str($value)
->replace(['.', ','], '')
->toInteger();
if (!$this->model->population_date) {
if (! $this->model->population_date) {
$this->model->population_date = '2021-12-31';
}
$this->model->save();

View File

@@ -4,7 +4,6 @@ namespace App\Http\Livewire\Meetup;
use App\Models\Country;
use App\Models\Meetup;
use App\Models\MeetupEvent;
use Livewire\Component;
use RalphJSmit\Laravel\SEO\Support\SEOData;
@@ -19,7 +18,7 @@ class WorldMap extends Component
return to_route('meetup.landing', [
'country' => $meetup->city->country->code,
'meetup' => $meetup,
'meetup' => $meetup,
]);
}
@@ -31,16 +30,16 @@ class WorldMap extends Component
'city.country',
])
->get()
->map(fn($meetup) => [
'id' => $meetup->id,
'name' => $meetup->name,
->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')
)
),
]);
}
}