Enhance ManualServers functionality: add user-provided information display and credential handling; improve TagsInput validation; update navigation properties
This commit is contained in:
@@ -96,19 +96,26 @@ class FilamentInput
|
||||
->disabled($setting->disabled ?? false)
|
||||
->hint($setting->hint ?? '')
|
||||
->hintColor('primary')
|
||||
->helperText($setting->description ?? '');
|
||||
->helperText($setting->description ?? '')
|
||||
->live(onBlur: true);
|
||||
|
||||
// For required TagsInput, validate that array has at least one item
|
||||
// Standard 'required' rule considers empty arrays as valid
|
||||
// For required TagsInput, add custom validation
|
||||
if ($setting->required ?? false) {
|
||||
$input->required()
|
||||
->rule(function () {
|
||||
$input->rules([
|
||||
function () {
|
||||
return function (string $attribute, $value, \Closure $fail) {
|
||||
if (!is_array($value) || empty($value)) {
|
||||
$fail('The :attribute field must have at least 1 items.');
|
||||
// Check if value is an array and has at least one item
|
||||
if (!is_array($value)) {
|
||||
$fail('The :attribute field is required.');
|
||||
return;
|
||||
}
|
||||
if (count($value) === 0) {
|
||||
$fail('The :attribute field is required.');
|
||||
return;
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
||||
return $input;
|
||||
|
||||
Reference in New Issue
Block a user