Skip to content
Merged

Dev #3508

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
115 changes: 115 additions & 0 deletions app/Nova/GetInvolvedPage.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
<?php

namespace App\Nova;

use Illuminate\Http\Request;
use Laravel\Nova\Fields\Boolean;
use Laravel\Nova\Fields\ID;
use Laravel\Nova\Fields\Select;
use Laravel\Nova\Fields\Text;
use Laravel\Nova\Fields\Textarea;
use Laravel\Nova\Http\Requests\NovaRequest;

class GetInvolvedPage extends Resource
{
public static $group = 'Content';

public static $model = \App\StaticPage::class;

public static $title = 'name';

public static $priority = 10;

public static function label()
{
return 'Get Involved';
}

public static function singularLabel()
{
return 'Get Involved Page';
}

public static function uriKey(): string
{
return 'get-involved-page';
}

public static function authorizedToViewAny(Request $request): bool
{
return true;
}

public static function indexQuery(NovaRequest $request, $query)
{
return $query->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(),
];
}
}
2 changes: 2 additions & 0 deletions app/Providers/NovaServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down
21 changes: 21 additions & 0 deletions database/seeders/StaticPagesSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading