parent
0e0b58ba5e
commit
ac1559de5e
4 changed files with 23 additions and 89 deletions
|
@ -2,9 +2,6 @@
|
|||
|
||||
namespace Pterodactyl\Models;
|
||||
|
||||
use MountNode;
|
||||
use MountServer;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property string $uuid
|
||||
|
@ -48,6 +45,11 @@ class Mount extends Model
|
|||
*/
|
||||
protected $attributes = [
|
||||
'id' => 'int',
|
||||
'uuid' => 'string',
|
||||
'name' => 'string',
|
||||
'description' => 'string',
|
||||
'source' => 'string',
|
||||
'target' => 'string',
|
||||
'read_only' => 'bool',
|
||||
'user_mountable' => 'bool',
|
||||
];
|
||||
|
@ -87,18 +89,20 @@ class Mount extends Model
|
|||
/**
|
||||
* Returns all nodes that have this mount assigned.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasManyThrough
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
||||
*/
|
||||
public function nodes()
|
||||
{
|
||||
return $this->hasManyThrough(Server::class, MountNode::class);
|
||||
return $this->belongsToMany(Node::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasManyThrough
|
||||
* Returns all servers that have this mount assigned.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
||||
*/
|
||||
public function servers()
|
||||
{
|
||||
return $this->hasManyThrough(Server::class, MountServer::class);
|
||||
return $this->belongsToMany(Server::class);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
<?php
|
||||
|
||||
use Pterodactyl\Models\Node;
|
||||
use Pterodactyl\Models\Mount;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class MountNode extends Model
|
||||
{
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
public $timestamps = false;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
public $incrementing = false;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'mount_node';
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function node()
|
||||
{
|
||||
return $this->belongsTo(Node::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function mount()
|
||||
{
|
||||
return $this->belongsTo(Mount::class);
|
||||
}
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
<?php
|
||||
|
||||
use Pterodactyl\Models\Mount;
|
||||
use Pterodactyl\Models\Server;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class MountServer extends Model
|
||||
{
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
public $timestamps = false;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
public $incrementing = false;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'mount_server';
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function server()
|
||||
{
|
||||
return $this->belongsTo(Server::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function mount()
|
||||
{
|
||||
return $this->belongsTo(Mount::class);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue