mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-02 14:36:17 +00:00
fix enums
This commit is contained in:
@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Actions\PHP;
|
||||
|
||||
use App\Enums\PHP;
|
||||
use App\Enums\ServiceStatus;
|
||||
use App\Models\Server;
|
||||
use App\Models\Service;
|
||||
@ -40,7 +41,7 @@ public static function rules(Server $server): array
|
||||
'version' => [
|
||||
'required',
|
||||
Rule::in(config('core.php_versions')),
|
||||
Rule::notIn($server->installedPHPVersions()),
|
||||
Rule::notIn(array_merge($server->installedPHPVersions(), [PHP::NONE])),
|
||||
],
|
||||
];
|
||||
}
|
||||
|
@ -18,6 +18,12 @@ final class Database
|
||||
|
||||
const MARIADB104 = 'mariadb104';
|
||||
|
||||
const MARIADB106 = 'mariadb1006';
|
||||
|
||||
const MARIADB1011 = 'mariadb1011';
|
||||
|
||||
const MARIADB114 = 'mariadb114';
|
||||
|
||||
const POSTGRESQL12 = 'postgresql12';
|
||||
|
||||
const POSTGRESQL13 = 'postgresql13';
|
||||
|
@ -19,6 +19,7 @@ public function creationRules(array $input): array
|
||||
'version' => [
|
||||
'required',
|
||||
Rule::in(config('core.php_versions')),
|
||||
Rule::notIn([\App\Enums\PHP::NONE]),
|
||||
Rule::unique('services', 'version')
|
||||
->where('type', 'php')
|
||||
->where('server_id', $this->service->server_id),
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\ServerTypes;
|
||||
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class Regular extends AbstractType
|
||||
{
|
||||
public function createRules(array $input): array
|
||||
@ -13,7 +15,7 @@ public function createRules(array $input): array
|
||||
],
|
||||
'php' => [
|
||||
'required',
|
||||
'in:none,'.implode(',', config('core.php_versions')),
|
||||
Rule::in(config('core.php_versions')),
|
||||
],
|
||||
'database' => [
|
||||
'required',
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace App\Web\Pages\Servers\PHP;
|
||||
|
||||
use App\Actions\PHP\InstallNewPHP;
|
||||
use App\Enums\PHP;
|
||||
use App\Models\Service;
|
||||
use App\Web\Pages\Servers\Page;
|
||||
use App\Web\Pages\Servers\PHP\Widgets\PHPList;
|
||||
@ -43,7 +44,7 @@ protected function getHeaderActions(): array
|
||||
Select::make('version')
|
||||
->options(
|
||||
collect(config('core.php_versions'))
|
||||
->filter(fn ($version) => ! in_array($version, $installedPHPs))
|
||||
->filter(fn ($version) => ! in_array($version, array_merge($installedPHPs, [PHP::NONE])))
|
||||
->mapWithKeys(fn ($version) => [$version => $version])
|
||||
->toArray()
|
||||
)
|
||||
|
Reference in New Issue
Block a user