validate([ 'newCityName' => ['required', 'string', 'max:255', 'unique:cities,name'], 'newCityCountryId' => ['required', 'exists:countries,id'], 'newCityLatitude' => ['required', 'numeric'], 'newCityLongitude' => ['required', 'numeric'], ]); $city = City::create([ 'name' => $validated['newCityName'], 'country_id' => $validated['newCityCountryId'], 'latitude' => $validated['newCityLatitude'], 'longitude' => $validated['newCityLongitude'], 'slug' => str($validated['newCityName'])->slug(), 'created_by' => auth()->id(), ]); $this->city_id = $city->id; $this->reset(['newCityName', 'newCityCountryId', 'newCityLatitude', 'newCityLongitude']); \Flux\Flux::modal('add-city')->close(); } public function createMeetup(): void { $validated = $this->validate([ 'name' => ['required', 'string', 'max:255', 'unique:meetups,name'], 'city_id' => ['required', 'exists:cities,id'], 'intro' => ['nullable', 'string'], 'telegram_link' => ['nullable', 'url', 'max:255'], 'webpage' => ['nullable', 'url', 'max:255'], 'twitter_username' => ['nullable', 'string', 'max:255'], 'matrix_group' => ['nullable', 'string', 'max:255'], 'nostr' => ['nullable', 'string', 'max:255'], 'simplex' => ['nullable', 'string', 'max:255'], 'signal' => ['nullable', 'string', 'max:510'], 'community' => ['nullable', 'string', 'max:255'], 'visible_on_map' => ['boolean'], ]); $meetup = Meetup::create($validated); if ($this->logo) { $meetup ->addMedia($this->logo->getRealPath()) ->usingName($meetup->name) ->toMediaCollection('logo'); } session()->flash('status', __('Meetup erfolgreich erstellt!')); $this->redirect(route_with_country('meetups.edit', ['meetup' => $meetup]), navigate: true); } public function with(): array { return [ 'cities' => City::query()->orderBy('name')->get(), 'countries' => Country::query()->orderBy('countries.name')->get(), ]; } }; ?>