Cleanup location model and controller for Admin.

This commit is contained in:
Dane Everitt 2017-02-10 17:09:56 -05:00
parent 0720bfe62f
commit ba175e6b55
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
3 changed files with 27 additions and 21 deletions

View file

@ -41,4 +41,24 @@ class Location extends Model
* @var array
*/
protected $guarded = ['id', 'created_at', 'updated_at'];
/**
* Gets the nodes in a specificed location.
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function nodes()
{
return $this->hasMany(Node::class);
}
/**
* Gets the servers within a given location.
*
* @return \Illuminate\Database\Eloquent\Relations\HasManyThrough
*/
public function servers()
{
return $this->hasManyThrough(Server::class, Node::class);
}
}