Skip to content

Commit 29f17ff

Browse files
authored
Merge pull request #3508 from codeeu/dev
Dev
2 parents 5ef2263 + bed7503 commit 29f17ff

3 files changed

Lines changed: 138 additions & 0 deletions

File tree

app/Nova/GetInvolvedPage.php

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
<?php
2+
3+
namespace App\Nova;
4+
5+
use Illuminate\Http\Request;
6+
use Laravel\Nova\Fields\Boolean;
7+
use Laravel\Nova\Fields\ID;
8+
use Laravel\Nova\Fields\Select;
9+
use Laravel\Nova\Fields\Text;
10+
use Laravel\Nova\Fields\Textarea;
11+
use Laravel\Nova\Http\Requests\NovaRequest;
12+
13+
class GetInvolvedPage extends Resource
14+
{
15+
public static $group = 'Content';
16+
17+
public static $model = \App\StaticPage::class;
18+
19+
public static $title = 'name';
20+
21+
public static $priority = 10;
22+
23+
public static function label()
24+
{
25+
return 'Get Involved';
26+
}
27+
28+
public static function singularLabel()
29+
{
30+
return 'Get Involved Page';
31+
}
32+
33+
public static function uriKey(): string
34+
{
35+
return 'get-involved-page';
36+
}
37+
38+
public static function authorizedToViewAny(Request $request): bool
39+
{
40+
return true;
41+
}
42+
43+
public static function indexQuery(NovaRequest $request, $query)
44+
{
45+
return $query->where('path', '/get-involved');
46+
}
47+
48+
public static function relatableQuery(NovaRequest $request, $query)
49+
{
50+
return $query->where('path', '/get-involved');
51+
}
52+
53+
public static function authorizedToCreate(Request $request): bool
54+
{
55+
return false;
56+
}
57+
58+
public function fields(Request $request): array
59+
{
60+
return [
61+
ID::make()->sortable(),
62+
63+
Text::make('Name')
64+
->sortable()
65+
->rules('required', 'max:255'),
66+
67+
Boolean::make('Is Searchable', 'is_searchable'),
68+
69+
Select::make('Category')
70+
->options([
71+
'General' => 'General',
72+
'Challenges' => 'Challenges',
73+
'Tranning' => 'Tranning',
74+
'Online Courses' => 'Online Courses',
75+
'Other' => 'Other',
76+
])
77+
->nullable()
78+
->displayUsingLabels(),
79+
80+
Select::make('Link Type', 'link_type')
81+
->options([
82+
'internal_link' => 'Internal Link',
83+
'external_link' => 'External Link',
84+
])
85+
->rules('required')
86+
->displayUsingLabels(),
87+
88+
Textarea::make('Description')->nullable(),
89+
90+
Text::make('Language')
91+
->sortable()
92+
->rules('required', 'size:2')
93+
->default('en'),
94+
95+
Text::make('Unique Identifier')
96+
->rules('required', 'unique:static_pages,unique_identifier,{{resourceId}}'),
97+
98+
Text::make('Path')
99+
->readonly()
100+
->rules('required', 'unique:static_pages,path,{{resourceId}}'),
101+
102+
Text::make('Keywords')
103+
->rules('nullable')
104+
->help('Enter keywords separated by commas, e.g., coding, education, technology.'),
105+
106+
Text::make('Thumbnail')->nullable(),
107+
108+
Text::make('Meta Title')->nullable(),
109+
110+
Textarea::make('Meta Description')->nullable(),
111+
112+
Textarea::make('Meta Keywords')->nullable(),
113+
];
114+
}
115+
}

app/Providers/NovaServiceProvider.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace App\Providers;
44

55
use App\Nova\Dashboards\Main;
6+
use App\Nova\GetInvolvedPage as GetInvolvedPageNova;
67
use App\Nova\MediaUpload as MediaUploadNova;
78
use App\Nova\Metrics\EventCount;
89
use App\Nova\Metrics\EventsPerDay;
@@ -33,6 +34,7 @@ public function boot(): void
3334

3435
// Explicitly register newly added resources to avoid sidebar discovery misses.
3536
Nova::resources([
37+
GetInvolvedPageNova::class,
3638
TrainingResourceNova::class,
3739
MediaUploadNova::class,
3840
SupportCaseNova::class,

database/seeders/StaticPagesSeeder.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,27 @@ public function run(): void
112112
'link_type' => 'internal_link'
113113
]);
114114

115+
StaticPage::updateOrCreate(
116+
[
117+
'language' => 'en',
118+
'path' => '/get-involved',
119+
],
120+
[
121+
'name' => 'Get Involved',
122+
'description' => 'Get started with EU Code Week: run a coding activity, join a local event, or share your experience using #EUCodeWeek.',
123+
'unique_identifier' => 'get-involved',
124+
'path' => '/get-involved',
125+
'keywords' => ['Get Involved', 'EU Code Week', 'Coding'],
126+
'thumbnail' => '/images/get-involved.png',
127+
'meta_title' => 'Get Involved in EU Code Week – Host, Join or Learn',
128+
'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!',
129+
'meta_keywords' => 'EU Code Week, get involved, coding activity, host event, join event',
130+
'category' => 'General',
131+
'link_type' => 'internal_link',
132+
'is_searchable' => false,
133+
]
134+
);
135+
115136
// Sub Pages
116137
$subPages = [
117138
// Online Cources

0 commit comments

Comments
 (0)