Forms\Components\TextInput::make('name')
->required()
->maxLength(255)
->helperText(new HtmlString("The name you choose here will be the name used to set up your repository, e.g. https://github.com/company/<strong>name</strong>.git."))
->default(function($state, $livewire) {
return RepositoryService::createDefaultRepositoryName($livewire->ownerRecord->name);
} )
->live()
->unique(ignoreRecord: true)
->rules([
fn (Get $get): Closure => function (string $attribute, $value, Closure $fail) use ($get) {
if ($get('type') === 'github' && GithubService::create()->repoExists($value)) {
$fail("This repository already exists!");
}
}
])
->afterStateUpdated(function (Forms\Contracts\HasForms $livewire, Forms\Components\TextInput $component) {
$livewire->validateOnly($component->getStatePath());
})
Forms\Components\TextInput::make('name')
->required()
->maxLength(255)
->helperText(new HtmlString("The name you choose here will be the name used to set up your repository, e.g. https://github.com/company/<strong>name</strong>.git."))
->default(function($state, $livewire) {
return RepositoryService::createDefaultRepositoryName($livewire->ownerRecord->name);
} )
->live()
->unique(ignoreRecord: true)
->rules([
fn (Get $get): Closure => function (string $attribute, $value, Closure $fail) use ($get) {
if ($get('type') === 'github' && GithubService::create()->repoExists($value)) {
$fail("This repository already exists!");
}
}
])
->afterStateUpdated(function (Forms\Contracts\HasForms $livewire, Forms\Components\TextInput $component) {
$livewire->validateOnly($component->getStatePath());
})