2023-02-02 15:45:17 +00:00
< ? php
2023-02-06 20:16:54 +00:00
namespace App\Settings ;
2023-02-02 15:45:17 +00:00
use Spatie\LaravelSettings\Settings ;
class ServerSettings extends Settings
{
public int $allocation_limit ;
2023-04-02 17:57:28 +00:00
public bool $creation_enabled ;
public bool $enable_upgrade ;
2023-02-04 16:40:42 +00:00
2023-02-02 15:45:17 +00:00
public static function group () : string
{
return 'server' ;
}
2023-02-09 21:34:34 +00:00
2023-02-09 23:31:27 +00:00
/**
* Summary of validations array
* @ return array < string , string >
*/
public static function getValidations ()
{
return [
'allocation_limit' => 'required|integer|min:0' ,
2023-05-08 12:42:46 +00:00
'creation_enabled' => 'nullable|string' ,
'enable_upgrade' => 'nullable|string' ,
2023-02-09 23:31:27 +00:00
];
}
2023-02-09 21:34:34 +00:00
/**
* Summary of optionTypes
* Only used for the settings page
* @ return array < array < 'type' | 'label' | 'description' | 'options' , string | bool | float | int | array < string , string >>>
*/
public static function getOptionInputData ()
{
return [
2023-02-20 12:44:06 +00:00
'category_icon' => 'fas fa-server' ,
2023-02-09 21:34:34 +00:00
'allocation_limit' => [
'label' => 'Allocation Limit' ,
'type' => 'number' ,
'description' => 'The maximum amount of allocations to pull per node for automatic deployment, if more allocations are being used than this limit is set to, no new servers can be created.' ,
],
'creation_enabled' => [
'label' => 'Creation Enabled' ,
'type' => 'boolean' ,
2023-06-25 12:30:03 +00:00
'description' => 'Enable the user server creation.' ,
2023-02-09 21:34:34 +00:00
],
'enable_upgrade' => [
2023-06-25 12:30:03 +00:00
'label' => 'Server Upgrade Enabled' ,
2023-02-09 21:34:34 +00:00
'type' => 'boolean' ,
2023-06-25 12:30:03 +00:00
'description' => 'Enable the server upgrade feature.' ,
2023-02-09 21:34:34 +00:00
],
];
}
}