Model updates for Database Management in ACP

This commit is contained in:
Dane Everitt 2017-02-03 15:19:14 -05:00
parent 9c2d34d6e6
commit 96d3aa767f
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
7 changed files with 137 additions and 43 deletions

View file

@ -55,7 +55,27 @@ class Database extends Model
* @var array
*/
protected $casts = [
'server' => 'integer',
'server_id' => 'integer',
'db_server' => 'integer',
];
/**
* Gets the host database server associated with a database.
*
* @return \Illuminate\Database\Eloquent\Relations\HasOne
*/
public function host()
{
return $this->hasOne(DatabaseServer::class, 'id', 'db_server');
}
/**
* Gets the server associated with a database.
*
* @return \Illuminate\Database\Eloquent\Relations\HasOne
*/
public function server()
{
return $this->hasOne(Server::class, 'id', 'server_id');
}
}