Lance Pioch bcbacb47cd
Fix #606 - Prevent database hosts bulk selection if host has any databases (#640)
* Prevent hosts with databases from being selected for bulk actions

* Add icons

* Update input to select

* Update app/Filament/Resources/DatabaseHostResource/Pages/ListDatabaseHosts.php

* Add placeholder
2024-10-20 14:20:32 -04:00

51 lines
1.6 KiB
PHP

<?php
namespace App\Filament\Resources\DatabaseResource\Pages;
use App\Filament\Resources\DatabaseResource;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Form;
use Filament\Resources\Pages\CreateRecord;
class CreateDatabase extends CreateRecord
{
protected static string $resource = DatabaseResource::class;
public function form(Form $form): Form
{
return $form
->schema([
Select::make('server_id')
->relationship('server', 'name')
->searchable()
->preload()
->required(),
Select::make('database_host_id')
->relationship('host', 'name')
->searchable()
->selectablePlaceholder(false)
->preload()
->required(),
TextInput::make('database')
->required()
->maxLength(255),
TextInput::make('remote')
->required()
->maxLength(255)
->default('%'),
TextInput::make('username')
->required()
->maxLength(255),
TextInput::make('password')
->password()
->revealable()
->required(),
TextInput::make('max_connections')
->numeric()
->minValue(0)
->default(0),
]);
}
}