Fix rule validation?

This commit is contained in:
notCharles 2024-05-12 00:55:44 -04:00
parent c5b441e54a
commit 615b70f9a2
2 changed files with 4 additions and 4 deletions

View File

@ -252,13 +252,13 @@ class EditServer extends EditRecord
->schema([
Forms\Components\TextInput::make('variable_value')
->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], [
'validatorkey' => $variable->variable->rules,
'validatorkey' => $get('rules'),
]);
if ($validator->fails()) {
$message = str($validator->errors()->first())->replace('validatorkey', $variable->variable->name);
$message = str($validator->errors()->first())->replace('validatorkey', $get('name'));
$fail($message);
}

View File

@ -1,5 +1,5 @@
<!doctype html>
<html lang="en" data-theme="{{ config('scramble.theme', 'dark') }}">
<html lang="en" data-theme="dark">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">