Use belongsTo versus hasOne when more logical.

This commit is contained in:
Dane Everitt 2017-02-05 18:00:39 -05:00
parent 323f1d943f
commit b1389262e2
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
4 changed files with 16 additions and 16 deletions

View file

@ -62,20 +62,20 @@ class Database extends Model
/**
* Gets the host database server associated with a database.
*
* @return \Illuminate\Database\Eloquent\Relations\HasOne
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function host()
{
return $this->hasOne(DatabaseServer::class, 'id', 'db_server');
return $this->belongsTo(DatabaseServer::class, 'db_server');
}
/**
* Gets the server associated with a database.
*
* @return \Illuminate\Database\Eloquent\Relations\HasOne
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function server()
{
return $this->hasOne(Server::class, 'id', 'server_id');
return $this->belongsTo(Server::class);
}
}