misc_pterodactyl-panel/app/Http/Requests/Admin/DatabaseHostFormRequest.php

31 lines
726 B
PHP
Raw Normal View History

<?php
namespace Pterodactyl\Http\Requests\Admin;
use Pterodactyl\Models\DatabaseHost;
use Illuminate\Contracts\Validation\Validator;
class DatabaseHostFormRequest extends AdminFormRequest
{
public function rules(): array
{
if ($this->method() !== 'POST') {
return DatabaseHost::getRulesForUpdate($this->route()->parameter('host'));
}
return DatabaseHost::getRules();
}
/**
* Modify submitted data before it is passed off to the validator.
*/
protected function getValidatorInstance(): Validator
{
2021-01-23 20:33:34 +00:00
if (!$this->filled('node_id')) {
$this->merge(['node_id' => null]);
}
return parent::getValidatorInstance();
}
}