Cleanup mount code; automatically include the mount in the configuration

This commit is contained in:
Dane Everitt 2020-09-13 09:59:54 -07:00
parent 8c6c271916
commit 9a21584c42
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
8 changed files with 69 additions and 20 deletions

View file

@ -367,10 +367,10 @@ class Server extends Model
/**
* Returns all mounts that have this server has mounted.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
* @return \Illuminate\Database\Eloquent\Relations\HasManyThrough
*/
public function mounts()
{
return $this->belongsToMany(Mount::class);
return $this->hasManyThrough(Mount::class, MountServer::class, 'server_id', 'id', 'id', 'mount_id');
}
}