mirror of
https://github.com/pelican-dev/panel.git
synced 2025-09-24 10:57:48 +02:00
Use constants
This commit is contained in:
parent
9d9720a5a2
commit
69acc48b5e
@ -3,6 +3,7 @@
|
||||
namespace App\Filament\Resources\DatabaseHostResource\Pages;
|
||||
|
||||
use App\Filament\Resources\DatabaseHostResource;
|
||||
use App\Models\Objects\Endpoint;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Components\Section;
|
||||
@ -44,7 +45,7 @@ class CreateDatabaseHost extends CreateRecord
|
||||
->numeric()
|
||||
->default(3306)
|
||||
->minValue(0)
|
||||
->maxValue(65535),
|
||||
->maxValue(Endpoint::PORT_CEIL),
|
||||
Forms\Components\TextInput::make('max_databases')
|
||||
->label('Max databases')
|
||||
->helpertext('Blank is unlimited.')
|
||||
|
@ -4,6 +4,7 @@ namespace App\Filament\Resources\DatabaseHostResource\Pages;
|
||||
|
||||
use App\Filament\Resources\DatabaseHostResource;
|
||||
use App\Models\DatabaseHost;
|
||||
use App\Models\Objects\Endpoint;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
use Filament\Forms;
|
||||
@ -39,7 +40,7 @@ class EditDatabaseHost extends EditRecord
|
||||
->required()
|
||||
->numeric()
|
||||
->minValue(0)
|
||||
->maxValue(65535),
|
||||
->maxValue(Endpoint::PORT_CEIL),
|
||||
Forms\Components\TextInput::make('max_databases')
|
||||
->label('Max databases')
|
||||
->helpertext('Blank is unlimited.')
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Rules;
|
||||
|
||||
use App\Models\Objects\Endpoint;
|
||||
use Closure;
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
|
||||
@ -23,11 +24,11 @@ class Port implements ValidationRule
|
||||
$fail('The :attribute must be an integer.');
|
||||
}
|
||||
|
||||
if ($value <= 1024) {
|
||||
if ($value <= Endpoint::PORT_FLOOR) {
|
||||
$fail('The :attribute must be greater than 1024.');
|
||||
}
|
||||
|
||||
if ($value > 65535) {
|
||||
if ($value > Endpoint::PORT_CEIL) {
|
||||
$fail('The :attribute must be less than 65535.');
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user