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 PterodactylSettings extends Settings
|
|
|
|
{
|
2023-03-30 14:21:31 +00:00
|
|
|
public string $admin_token;
|
|
|
|
public string $user_token;
|
|
|
|
public string $panel_url;
|
2023-02-02 15:45:17 +00:00
|
|
|
public int $per_page_limit;
|
|
|
|
|
|
|
|
public static function group(): string
|
|
|
|
{
|
|
|
|
return 'pterodactyl';
|
|
|
|
}
|
2023-02-03 16:38:03 +00:00
|
|
|
|
2023-04-29 22:17:40 +00:00
|
|
|
|
2023-02-03 16:38:03 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get url with ensured ending backslash
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getUrl(): string
|
|
|
|
{
|
|
|
|
return str_ends_with($this->panel_url, '/') ? $this->panel_url : $this->panel_url . '/';
|
|
|
|
}
|
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 [
|
2023-03-30 14:21:31 +00:00
|
|
|
'panel_url' => 'required|string|url',
|
|
|
|
'admin_token' => 'required|string',
|
|
|
|
'user_token' => 'required|string',
|
2023-02-09 23:31:27 +00:00
|
|
|
'per_page_limit' => 'required|integer|min:1|max:10000',
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
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
|
|
|
'panel_url' => [
|
|
|
|
'label' => 'Panel URL',
|
|
|
|
'type' => 'string',
|
|
|
|
'description' => 'The URL to your Pterodactyl panel.',
|
|
|
|
],
|
|
|
|
'admin_token' => [
|
|
|
|
'label' => 'Admin Token',
|
|
|
|
'type' => 'string',
|
|
|
|
'description' => 'The admin user token for your Pterodactyl panel.',
|
|
|
|
],
|
|
|
|
'user_token' => [
|
|
|
|
'label' => 'User Token',
|
|
|
|
'type' => 'string',
|
|
|
|
'description' => 'The user token for your Pterodactyl panel.',
|
|
|
|
],
|
|
|
|
'per_page_limit' => [
|
|
|
|
'label' => 'Per Page Limit',
|
|
|
|
'type' => 'number',
|
|
|
|
'description' => 'The number of servers to show per page.',
|
|
|
|
],
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|