mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-29 16:44:44 +02:00
Fix rule validation?
This commit is contained in:
parent
c5b441e54a
commit
615b70f9a2
@ -252,13 +252,13 @@ class EditServer extends EditRecord
|
|||||||
->schema([
|
->schema([
|
||||||
Forms\Components\TextInput::make('variable_value')
|
Forms\Components\TextInput::make('variable_value')
|
||||||
->rules([
|
->rules([
|
||||||
fn (ServerVariable $variable): Closure => function (string $attribute, $value, Closure $fail) use ($variable) {
|
fn (Forms\Get $get): Closure => function (string $attribute, $value, Closure $fail) use ($get) {
|
||||||
$validator = Validator::make(['validatorkey' => $value], [
|
$validator = Validator::make(['validatorkey' => $value], [
|
||||||
'validatorkey' => $variable->variable->rules,
|
'validatorkey' => $get('rules'),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
$message = str($validator->errors()->first())->replace('validatorkey', $variable->variable->name);
|
$message = str($validator->errors()->first())->replace('validatorkey', $get('name'));
|
||||||
|
|
||||||
$fail($message);
|
$fail($message);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en" data-theme="{{ config('scramble.theme', 'dark') }}">
|
<html lang="en" data-theme="dark">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user