Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Make redirect fields listable by default #161

Merged
merged 1 commit into from
Jan 16, 2024
Merged
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
5 changes: 5 additions & 0 deletions src/Blueprints/RedirectBlueprint.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public function __invoke()
'type' => 'text',
'display' => 'Source',
'instructions' => 'Enter the URL pattern that Redirect should match. This matches against the path only e.g.: Exact Match: `/recipes/`, or RegEx Match: `.*RecipeID=(.*)`',
'listable' => true,
'validate' => ['required', 'string', function (string $attribute, $value, Closure $fail) {
$existing = Redirect::query()
->where('source', $value)
Expand All @@ -41,6 +42,7 @@ public function __invoke()
'type' => 'text',
'display' => 'Destination',
'instructions' => 'Enter the destination URL that should be redirected to. This can either be a fully qualified URL or a relative URL. e.g.: Exact Match: `/new-recipes/` or RegEx Match: `/new-recipes/$1`',
'listable' => true,
'validate' => 'required_unless:type,410|nullable|string',
],
],
Expand All @@ -50,6 +52,7 @@ public function __invoke()
'type' => 'select',
'display' => 'Match type',
'instructions' => 'Details on RegEx matching can be found at [regexr.com](http://regexr.com/)',
'listable' => true,
'validate' => 'required|string',
'options' => [
MatchTypeEnum::EXACT => 'Exact Match',
Expand All @@ -63,6 +66,7 @@ public function __invoke()
'field' => [
'type' => 'select',
'display' => 'Redirect type',
'listable' => true,
'validate' => 'required|string',
'options' => [
'302' => 'Temporary (302)',
Expand All @@ -82,6 +86,7 @@ public function __invoke()
'type' => 'toggle',
'default' => true,
'display' => 'Enabled',
'listable' => true,
'validate' => 'required|boolean',
],
],
Expand Down