forked from Alex/Pterodactyl-Panel
Use belongsTo versus hasOne when more logical.
This commit is contained in:
parent
323f1d943f
commit
b1389262e2
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -63,10 +63,10 @@ class DatabaseServer extends Model
|
||||
/**
|
||||
* Gets the node associated with a database host.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasOne
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function node()
|
||||
{
|
||||
return $this->hasOne(Node::class, 'id', 'linked_node');
|
||||
return $this->belongsTo(Node::class, 'linked_node');
|
||||
}
|
||||
}
|
||||
|
@ -220,11 +220,11 @@ class Node extends Model
|
||||
/**
|
||||
* Gets the location associated with a node.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasOne
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function location()
|
||||
{
|
||||
return $this->hasOne(Location::class, 'id', 'location_id');
|
||||
return $this->belongsTo(Location::class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -221,11 +221,11 @@ class Server extends Model
|
||||
/**
|
||||
* Gets the user who owns the server.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasOne
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function user()
|
||||
{
|
||||
return $this->hasOne(User::class, 'id', 'owner_id');
|
||||
return $this->belongsTo(User::class, 'owner_id');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -251,21 +251,21 @@ class Server extends Model
|
||||
/**
|
||||
* Gets information for the service associated with this server.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasOne
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function service()
|
||||
{
|
||||
return $this->hasOne(Service::class, 'id', 'service_id');
|
||||
return $this->belongsTo(Service::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets information for the service option associated with this server.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasOne
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function option()
|
||||
{
|
||||
return $this->hasOne(ServiceOptions::class, 'id', 'option_id');
|
||||
return $this->belongsTo(ServiceOptions::class);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -281,11 +281,11 @@ class Server extends Model
|
||||
/**
|
||||
* Gets information for the node associated with this server.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasOne
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function node()
|
||||
{
|
||||
return $this->hasOne(Node::class, 'id', 'node_id');
|
||||
return $this->belongsTo(Node::class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user