mirror of
https://github.com/pterodactyl/panel.git
synced 2026-11-30 11:25:52 -05:00
Co-authored-by: Anthony <anthony@infraly.co> Co-authored-by: Sky Mulley <daniel.mulley@outlook.com>
27 lines
804 B
PHP
27 lines
804 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Pterodactyl\Validation;
|
|
|
|
final class DatabaseRules
|
|
{
|
|
/**
|
|
* Validation rules for database attributes, consumed by the requests that accept them.
|
|
*
|
|
* @return NormalizedValidationRules
|
|
*/
|
|
public static function rules(): array
|
|
{
|
|
return [
|
|
'server_id' => ['required', 'numeric', 'exists:servers,id'],
|
|
'database_host_id' => ['required', 'exists:database_hosts,id'],
|
|
'database' => ['required', 'string', 'alpha_dash', 'between:3,48'],
|
|
'username' => ['string', 'alpha_dash', 'between:3,100'],
|
|
'max_connections' => ['nullable', 'integer'],
|
|
'remote' => ['required', 'string', 'regex:/^[\w\-\/.%:]+$/'],
|
|
'password' => ['string'],
|
|
];
|
|
}
|
|
}
|