-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathGetInvolvedPage.php
More file actions
115 lines (88 loc) · 2.99 KB
/
GetInvolvedPage.php
File metadata and controls
115 lines (88 loc) · 2.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
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(),
];
}
}