2018-03-02 03:27:37 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Pterodactyl\Http\Requests\Server\Database;
|
|
|
|
|
|
|
|
use Pterodactyl\Http\Requests\Server\ServerFormRequest;
|
|
|
|
|
|
|
|
class StoreServerDatabaseRequest extends ServerFormRequest
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
public function authorize()
|
|
|
|
{
|
|
|
|
if (! parent::authorize()) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return config('pterodactyl.client_features.databases.enabled');
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2018-05-13 14:50:56 +00:00
|
|
|
* Return the user permission to validate this request against.
|
2018-03-02 03:27:37 +00:00
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
protected function permission(): string
|
|
|
|
{
|
|
|
|
return 'create-database';
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2018-05-13 14:50:56 +00:00
|
|
|
* Rules to validate this request against.
|
2018-03-02 03:27:37 +00:00
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function rules()
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
'database' => 'required|string|min:1',
|
|
|
|
'remote' => 'required|string|regex:/^[0-9%.]{1,15}$/',
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|