forked from pterodactyl/panel
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDatabaseHostFormRequest.php
More file actions
38 lines (31 loc) · 867 Bytes
/
DatabaseHostFormRequest.php
File metadata and controls
38 lines (31 loc) · 867 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
namespace Pterodactyl\Http\Requests\Admin;
use Pterodactyl\Models\DatabaseHost;
class DatabaseHostFormRequest extends AdminFormRequest
{
/**
* @return mixed
*/
public function rules()
{
if ($this->method() !== 'POST') {
return DatabaseHost::getUpdateRulesForId($this->route()->parameter('host'));
}
return DatabaseHost::getCreateRules();
}
/**
* Modify submitted data before it is passed off to the validator.
*
* @return \Illuminate\Contracts\Validation\Validator
*/
protected function getValidatorInstance()
{
if (! $this->filled('node_id')) {
$this->merge(['node_id' => null]);
}
$this->merge([
'host' => gethostbyname($this->input('host')),
]);
return parent::getValidatorInstance();
}
}