From 4ded31b502e98aee2cd39fcb22400c14e0cdd967 Mon Sep 17 00:00:00 2001 From: HolgerHatGarKeineNode Date: Wed, 8 Feb 2023 14:32:13 +0100 Subject: [PATCH] btc-meetups updated --- app/Nova/Meetup.php | 13 ++++++++ ...4_add_community_field_to_meetups_table.php | 30 +++++++++++++++++++ routes/api.php | 4 ++- 3 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 database/migrations/2023_02_08_132434_add_community_field_to_meetups_table.php diff --git a/app/Nova/Meetup.php b/app/Nova/Meetup.php index be7408db..438c08cf 100644 --- a/app/Nova/Meetup.php +++ b/app/Nova/Meetup.php @@ -9,6 +9,7 @@ use Illuminate\Http\Request; use Laravel\Nova\Fields\BelongsTo; use Laravel\Nova\Fields\ID; use Laravel\Nova\Fields\Markdown; +use Laravel\Nova\Fields\Select; use Laravel\Nova\Fields\Text; use Laravel\Nova\Http\Requests\NovaRequest; @@ -82,6 +83,18 @@ class Meetup extends Resource ->showStatistics() ->setFileName(fn($originalFilename, $extension, $model) => md5($originalFilename).'.'.$extension), + Select::make(__('Community'), 'community') + ->options( + [ + 'einundzwanzig' => 'Einundzwanzig', + 'bitcoin' => 'Bitcoin', + 'satoshis_coffeeshop' => 'Satoshis Coffeeshop', + ] + ) + ->rules('required', 'string') + ->help(__('This is the community that the meetup belongs to. If a community is not listed, please contact the administrator.')) + ->hideFromIndex(), + Text::make('Name') ->rules('required', 'string') ->creationRules('unique:meetups,name') diff --git a/database/migrations/2023_02_08_132434_add_community_field_to_meetups_table.php b/database/migrations/2023_02_08_132434_add_community_field_to_meetups_table.php new file mode 100644 index 00000000..f2d2e9dc --- /dev/null +++ b/database/migrations/2023_02_08_132434_add_community_field_to_meetups_table.php @@ -0,0 +1,30 @@ +string('community') + ->nullable(); + }); + } + + /** + * Reverse the migrations. + * @return void + */ + public function down() + { + Schema::table('meetups', function (Blueprint $table) { + // + }); + } +}; diff --git a/routes/api.php b/routes/api.php index 818d555f..09905050 100644 --- a/routes/api.php +++ b/routes/api.php @@ -54,7 +54,9 @@ Route::middleware([]) ->with([ 'city.country', ]) - ->whereHas('city', fn($query) => $query->whereNotNull('cities.simplified_geojson')) + ->where('community', '=', 'einundzwanzig') + ->whereHas('city', + fn($query) => $query->whereNotNull('cities.simplified_geojson')) ->get() ->map(fn($meetup) => [ 'id' => $meetup->slug,