Fix database management things to actually work correctly.

This commit is contained in:
Dane Everitt 2017-07-22 13:55:30 -05:00
parent 580e5ac569
commit 63e39fbe58
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
14 changed files with 124 additions and 119 deletions

View file

@ -33,17 +33,10 @@ class DatabaseHostFormRequest extends AdminFormRequest
*/
public function rules()
{
$this->merge([
'node_id' => ($this->input('node_id') < 1) ? null : $this->input('node_id'),
'host' => gethostbyname($this->input('host')),
]);
$rules = app()->make(DatabaseHost::class)->getRules();
if ($this->method() === 'PATCH') {
$rules['host'] = $rules['host'] . ',' . $this->route()->parameter('host')->id;
if ($this->method() !== 'POST') {
return DatabaseHost::getUpdateRulesForId($this->route()->parameter('host')->id);
}
return $rules;
return DatabaseHost::getCreateRules();
}
}