-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathGetInvolvedPage.php
More file actions
126 lines (100 loc) · 4.32 KB
/
GetInvolvedPage.php
File metadata and controls
126 lines (100 loc) · 4.32 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
116
117
118
119
120
121
122
123
124
125
126
<?php
namespace App\Nova;
use Illuminate\Http\Request;
use Laravel\Nova\Fields\Boolean;
use Laravel\Nova\Fields\ID;
use Laravel\Nova\Fields\Text;
use Laravel\Nova\Fields\Trix;
use Laravel\Nova\Http\Requests\NovaRequest;
use Laravel\Nova\Panel;
class GetInvolvedPage extends Resource
{
public static $group = 'Content';
public static $model = \App\GetInvolvedPage::class;
public static $title = 'id';
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)
{
if (!\Illuminate\Support\Facades\Schema::hasTable('get_involved_page')) {
return $query->whereRaw('1 = 0');
}
$page = \App\GetInvolvedPage::config();
return $query->where('id', $page->id);
}
public static function relatableQuery(NovaRequest $request, $query)
{
if (!\Illuminate\Support\Facades\Schema::hasTable('get_involved_page')) {
return $query->whereRaw('1 = 0');
}
$page = \App\GetInvolvedPage::config();
return $query->where('id', $page->id);
}
public static function authorizedToCreate(Request $request): bool
{
return false;
}
public function fields(Request $request): array
{
return [
ID::make()->onlyOnForms(),
Panel::make('General', [
Boolean::make('Use dynamic content for this page', 'use_dynamic_content'),
])->collapsable()->collapsedByDefault(),
Panel::make('Hero', [
Text::make('Heading', 'intro_heading')->nullable(),
Trix::make('Intro text', 'intro_text')->nullable(),
Text::make('Button text', 'intro_button_text')->nullable(),
Text::make('Button link', 'intro_button_link')->nullable(),
])->collapsable()->collapsedByDefault(),
Panel::make('Movement section', [
Text::make('Heading', 'movement_heading')->nullable(),
Trix::make('Paragraph 1', 'movement_text_1')->nullable(),
Trix::make('Paragraph 2', 'movement_text_2')->nullable(),
])->collapsable()->collapsedByDefault(),
Panel::make('How to start section', [
Text::make('Heading', 'start_heading')->nullable(),
Trix::make('Text', 'start_text')->nullable(),
])->collapsable()->collapsedByDefault(),
Panel::make('Card: Community', [
Text::make('Title', 'card_community_title')->nullable(),
Trix::make('Text', 'card_community_text')->nullable(),
Text::make('Link URL (optional)', 'card_community_link')->nullable(),
Boolean::make('Open in new tab', 'card_community_new_tab'),
])->collapsable()->collapsedByDefault(),
Panel::make('Card: Activity', [
Text::make('Title', 'card_activity_title')->nullable(),
Trix::make('Text', 'card_activity_text')->nullable(),
Text::make('Link URL (optional)', 'card_activity_link')->nullable(),
Boolean::make('Open in new tab', 'card_activity_new_tab'),
])->collapsable()->collapsedByDefault(),
Panel::make('Card: Ambassadors', [
Text::make('Title', 'card_ambassadors_title')->nullable(),
Trix::make('Text', 'card_ambassadors_text')->nullable(),
Text::make('Link URL (optional)', 'card_ambassadors_link')->nullable(),
Boolean::make('Open in new tab', 'card_ambassadors_new_tab'),
])->collapsable()->collapsedByDefault(),
Panel::make('Card: Stories', [
Text::make('Title', 'card_stories_title')->nullable(),
Trix::make('Text', 'card_stories_text')->nullable(),
Text::make('Link URL (optional)', 'card_stories_link')->nullable(),
Boolean::make('Open in new tab', 'card_stories_new_tab'),
])->collapsable()->collapsedByDefault(),
];
}
}