Set the name to the first part of the domain

This commit is contained in:
Lance Pioch 2024-03-30 20:32:20 -04:00
parent d32d0692f8
commit db9b3e9b67

View File

@ -38,7 +38,9 @@ class CreateNode extends CreateRecord
})
->helperText(fn ($state) => is_ip($state) ? 'You can also enter in the domain name instead!' : 'You can also enter the IP address instead!')
->afterStateUpdated(function (Forms\Set $set, ?string $state) {
$set('name', $state);
[$subdomain] = str($state)->explode('.', 2);
$set('name', $subdomain);
})
->maxLength(191),