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

@ -33,6 +33,7 @@ use Illuminate\Contracts\Encryption\Encrypter;
* @property \Carbon\Carbon $updated_at
*
* @property \Pterodactyl\Models\Location $location
* @property \Pterodactyl\Models\Mount[]|\Illuminate\Database\Eloquent\Collection $mounts
* @property \Pterodactyl\Models\Server[]|\Illuminate\Database\Eloquent\Collection $servers
* @property \Pterodactyl\Models\Allocation[]|\Illuminate\Database\Eloquent\Collection $allocations
*/
@ -182,6 +183,7 @@ class Node extends Model
'bind_port' => $this->daemonSFTP,
],
],
'allowed_mounts' => $this->mounts->pluck('source')->toArray(),
'remote' => route('index'),
];
}
@ -219,6 +221,14 @@ class Node extends Model
);
}
/**
* @return \Illuminate\Database\Eloquent\Relations\HasManyThrough
*/
public function mounts()
{
return $this->hasManyThrough(Mount::class, MountNode::class, 'node_id', 'id', 'id', 'mount_id');
}
/**
* Gets the location associated with a node.
*