2017-06-18 00:48:31 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Pterodactyl\Http\Requests\Admin;
|
|
|
|
|
|
|
|
use Pterodactyl\Models\DatabaseHost;
|
|
|
|
|
|
|
|
class DatabaseHostFormRequest extends AdminFormRequest
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @return mixed
|
|
|
|
*/
|
|
|
|
public function rules()
|
|
|
|
{
|
2017-07-22 18:55:30 +00:00
|
|
|
if ($this->method() !== 'POST') {
|
2019-09-05 05:26:28 +00:00
|
|
|
return DatabaseHost::getRulesForUpdate($this->route()->parameter('host'));
|
2017-06-18 00:48:31 +00:00
|
|
|
}
|
|
|
|
|
2019-09-05 05:26:28 +00:00
|
|
|
return DatabaseHost::getRules();
|
2017-06-18 00:48:31 +00:00
|
|
|
}
|
2018-02-18 19:43:54 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Modify submitted data before it is passed off to the validator.
|
|
|
|
*
|
|
|
|
* @return \Illuminate\Contracts\Validation\Validator
|
|
|
|
*/
|
|
|
|
protected function getValidatorInstance()
|
|
|
|
{
|
2021-01-23 20:33:34 +00:00
|
|
|
if (!$this->filled('node_id')) {
|
2018-02-18 19:43:54 +00:00
|
|
|
$this->merge(['node_id' => null]);
|
|
|
|
}
|
|
|
|
|
|
|
|
return parent::getValidatorInstance();
|
|
|
|
}
|
2017-06-18 00:48:31 +00:00
|
|
|
}
|