67 lines
2.2 KiB
PHP
67 lines
2.2 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Pages;
|
|
|
|
use App\Settings\NetworkSettings;
|
|
use Filament\Forms;
|
|
use Filament\Forms\Form;
|
|
use Filament\Pages\SettingsPage;
|
|
use Filament\Forms\Components\TextInput;
|
|
use Filament\Forms\Components\Select;
|
|
use Filament\Forms\Components\Fieldset;
|
|
|
|
class ManageNetwork extends SettingsPage
|
|
{
|
|
protected static ?string $navigationIcon = 'heroicon-o-cog-6-tooth';
|
|
|
|
protected static string $settings = NetworkSettings::class;
|
|
|
|
protected static ?string $navigationLabel = '网络连接配置管理';
|
|
|
|
protected static ?string $title = '网络连接配置管理';
|
|
public function form(Form $form): Form
|
|
{
|
|
return $form
|
|
->schema([
|
|
Select::make('dhcp_enabled')
|
|
->options([
|
|
true => "是",
|
|
false => "否"
|
|
])
|
|
->default(false)
|
|
->label("DHCP启用")
|
|
->required()
|
|
->reactive(),
|
|
|
|
Fieldset::make()
|
|
->schema([
|
|
TextInput::make('ip_address')
|
|
->label("IP地址")
|
|
->placeholder('如127.0.0.1')
|
|
->required(),
|
|
|
|
TextInput::make('subnet_mask')
|
|
->label('子网掩码')
|
|
->placeholder('如255.255.255.0')
|
|
->required(),
|
|
|
|
TextInput::make('gateway')
|
|
->label('网关')
|
|
->placeholder('如192.168.1.1')
|
|
->required(),
|
|
|
|
TextInput::make('dns_server_1')
|
|
->label('DNS地址')
|
|
->placeholder('如6.6.6.6')
|
|
->required(),
|
|
|
|
TextInput::make('dns_server_2')
|
|
->label('DNS备用地址')
|
|
->placeholder('如114.114.114.114')
|
|
->required(),
|
|
])
|
|
->visible(fn($get) => in_array($get('dhcp_enabled'), [false])),
|
|
]);
|
|
}
|
|
}
|