diff --git a/app/Nova/GetInvolvedPage.php b/app/Nova/GetInvolvedPage.php new file mode 100644 index 000000000..95c87a4f1 --- /dev/null +++ b/app/Nova/GetInvolvedPage.php @@ -0,0 +1,115 @@ +where('path', '/get-involved'); + } + + public static function relatableQuery(NovaRequest $request, $query) + { + return $query->where('path', '/get-involved'); + } + + public static function authorizedToCreate(Request $request): bool + { + return false; + } + + public function fields(Request $request): array + { + return [ + ID::make()->sortable(), + + Text::make('Name') + ->sortable() + ->rules('required', 'max:255'), + + Boolean::make('Is Searchable', 'is_searchable'), + + Select::make('Category') + ->options([ + 'General' => 'General', + 'Challenges' => 'Challenges', + 'Tranning' => 'Tranning', + 'Online Courses' => 'Online Courses', + 'Other' => 'Other', + ]) + ->nullable() + ->displayUsingLabels(), + + Select::make('Link Type', 'link_type') + ->options([ + 'internal_link' => 'Internal Link', + 'external_link' => 'External Link', + ]) + ->rules('required') + ->displayUsingLabels(), + + Textarea::make('Description')->nullable(), + + Text::make('Language') + ->sortable() + ->rules('required', 'size:2') + ->default('en'), + + Text::make('Unique Identifier') + ->rules('required', 'unique:static_pages,unique_identifier,{{resourceId}}'), + + Text::make('Path') + ->readonly() + ->rules('required', 'unique:static_pages,path,{{resourceId}}'), + + Text::make('Keywords') + ->rules('nullable') + ->help('Enter keywords separated by commas, e.g., coding, education, technology.'), + + Text::make('Thumbnail')->nullable(), + + Text::make('Meta Title')->nullable(), + + Textarea::make('Meta Description')->nullable(), + + Textarea::make('Meta Keywords')->nullable(), + ]; + } +} diff --git a/app/Providers/NovaServiceProvider.php b/app/Providers/NovaServiceProvider.php index 50354956f..9793704f6 100644 --- a/app/Providers/NovaServiceProvider.php +++ b/app/Providers/NovaServiceProvider.php @@ -3,6 +3,7 @@ namespace App\Providers; use App\Nova\Dashboards\Main; +use App\Nova\GetInvolvedPage as GetInvolvedPageNova; use App\Nova\MediaUpload as MediaUploadNova; use App\Nova\Metrics\EventCount; use App\Nova\Metrics\EventsPerDay; @@ -33,6 +34,7 @@ public function boot(): void // Explicitly register newly added resources to avoid sidebar discovery misses. Nova::resources([ + GetInvolvedPageNova::class, TrainingResourceNova::class, MediaUploadNova::class, SupportCaseNova::class, diff --git a/database/seeders/StaticPagesSeeder.php b/database/seeders/StaticPagesSeeder.php index f784cfffc..763896f09 100644 --- a/database/seeders/StaticPagesSeeder.php +++ b/database/seeders/StaticPagesSeeder.php @@ -112,6 +112,27 @@ public function run(): void 'link_type' => 'internal_link' ]); + StaticPage::updateOrCreate( + [ + 'language' => 'en', + 'path' => '/get-involved', + ], + [ + 'name' => 'Get Involved', + 'description' => 'Get started with EU Code Week: run a coding activity, join a local event, or share your experience using #EUCodeWeek.', + 'unique_identifier' => 'get-involved', + 'path' => '/get-involved', + 'keywords' => ['Get Involved', 'EU Code Week', 'Coding'], + 'thumbnail' => '/images/get-involved.png', + 'meta_title' => 'Get Involved in EU Code Week – Host, Join or Learn', + 'meta_description' => 'Get started with EU Code Week: Run a coding activity, join a local event, or share your experience using #EUCodeWeek. No experience needed!', + 'meta_keywords' => 'EU Code Week, get involved, coding activity, host event, join event', + 'category' => 'General', + 'link_type' => 'internal_link', + 'is_searchable' => false, + ] + ); + // Sub Pages $subPages = [ // Online Cources