[restricted-email-domains] fix possible json structure error

This commit is contained in:
Pig Fang 2020-10-31 18:19:24 +08:00
parent 41f63895f9
commit fca19f3c00
No known key found for this signature in database
GPG Key ID: A8198F548DADA9E2
2 changed files with 7 additions and 5 deletions

View File

@ -1,7 +1,7 @@
{
"name": "restricted-email-domains",
"title": "Blessing\\RestrictedEmailDomains::general.title",
"version": "0.2.0",
"version": "0.2.1",
"description": "Blessing\\RestrictedEmailDomains::general.description",
"author": "GPlane",
"url": "https://gplane.win/",

View File

@ -20,14 +20,16 @@ class ConfigController extends Controller
$allowList = json_decode(option('restricted-email-domains.allow', '[]'), true);
$denyList = json_decode(option('restricted-email-domains.deny', '[]'), true);
return ['allow' => $allowList, 'deny' => $denyList];
return [
'allow' => array_values($allowList),
'deny' => array_values($denyList),
];
}
public function save(Request $request, $list)
{
option([
"restricted-email-domains.$list" => json_encode($request->input()),
]);
$json = json_encode(array_values($request->input()));
option(["restricted-email-domains.$list" => $json]);
return response()->noContent();
}