Improves server model and cleans up model code calls.

This commit is contained in:
Dane Everitt
2017-02-05 19:19:46 -05:00
parent b1389262e2
commit 02458c909d
8 changed files with 71 additions and 80 deletions

View File

@@ -52,4 +52,15 @@ class Allocation extends Model
'port' => 'integer',
'server_id' => 'integer',
];
/**
* Accessor to automatically provide the IP alias if defined.
*
* @param null|string $value
* @return string
*/
public function getAliasAttribute($value)
{
return (is_null($this->ip_alias)) ? $this->ip : $this->ip_alias;
}
}