mirror of
https://github.com/pterodactyl/panel.git
synced 2025-12-10 15:40:07 -06:00
Update models to declare their return types on relationships
This commit is contained in:
parent
511707a531
commit
e63cd1837f
@ -82,6 +82,9 @@ class ActivityLog extends Model
|
||||
'properties' => ['array'],
|
||||
];
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\MorphTo<\Illuminate\Database\Eloquent\Model, $this>
|
||||
*/
|
||||
public function actor(): MorphTo
|
||||
{
|
||||
$morph = $this->morphTo();
|
||||
@ -92,11 +95,17 @@ class ActivityLog extends Model
|
||||
return $morph;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany<\Pterodactyl\Models\ActivityLogSubject, $this>
|
||||
*/
|
||||
public function subjects(): HasMany
|
||||
{
|
||||
return $this->hasMany(ActivityLogSubject::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasOne<\Pterodactyl\Models\ApiKey, $this>
|
||||
*/
|
||||
public function apiKey(): HasOne
|
||||
{
|
||||
return $this->hasOne(ApiKey::class, 'id', 'api_key_id');
|
||||
|
||||
@ -3,6 +3,8 @@
|
||||
namespace Pterodactyl\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Relations\Pivot;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
* \Pterodactyl\Models\ActivityLogSubject.
|
||||
@ -29,12 +31,18 @@ class ActivityLogSubject extends Pivot
|
||||
|
||||
protected $guarded = ['id'];
|
||||
|
||||
public function activityLog()
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo<\Pterodactyl\Models\ActivityLog, $this>
|
||||
*/
|
||||
public function activityLog(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(ActivityLog::class);
|
||||
}
|
||||
|
||||
public function subject()
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\MorphTo<\Illuminate\Database\Eloquent\Model, $this>
|
||||
*/
|
||||
public function subject(): MorphTo
|
||||
{
|
||||
$morph = $this->morphTo();
|
||||
if (method_exists($morph, 'withTrashed')) {
|
||||
|
||||
@ -114,6 +114,8 @@ class Allocation extends Model
|
||||
|
||||
/**
|
||||
* Gets information for the server associated with this allocation.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo<\Pterodactyl\Models\Server, $this>
|
||||
*/
|
||||
public function server(): BelongsTo
|
||||
{
|
||||
@ -122,6 +124,8 @@ class Allocation extends Model
|
||||
|
||||
/**
|
||||
* Return the Node model associated with this allocation.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo<\Pterodactyl\Models\Node, $this>
|
||||
*/
|
||||
public function node(): BelongsTo
|
||||
{
|
||||
|
||||
@ -161,6 +161,8 @@ class ApiKey extends Model
|
||||
|
||||
/**
|
||||
* Returns the user this token is assigned to.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo<\Pterodactyl\Models\User, $this>
|
||||
*/
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
@ -170,6 +172,8 @@ class ApiKey extends Model
|
||||
/**
|
||||
* Required for support with Laravel Sanctum.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo<\Pterodactyl\Models\User, $this>
|
||||
*
|
||||
* @see \Laravel\Sanctum\Guard::supportsTokens()
|
||||
*/
|
||||
public function tokenable(): BelongsTo
|
||||
|
||||
@ -39,11 +39,17 @@ class AuditLog extends Model
|
||||
'created_at',
|
||||
];
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo<\Pterodactyl\Models\User, $this>
|
||||
*/
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo<\Pterodactyl\Models\Server, $this>
|
||||
*/
|
||||
public function server(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Server::class);
|
||||
|
||||
@ -72,6 +72,9 @@ class Backup extends Model
|
||||
'upload_id' => 'nullable|string',
|
||||
];
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo<\Pterodactyl\Models\Server, $this>
|
||||
*/
|
||||
public function server(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Server::class);
|
||||
|
||||
@ -94,6 +94,8 @@ class Database extends Model
|
||||
|
||||
/**
|
||||
* Gets the host database server associated with a database.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo<\Pterodactyl\Models\DatabaseHost, $this>
|
||||
*/
|
||||
public function host(): BelongsTo
|
||||
{
|
||||
@ -102,6 +104,8 @@ class Database extends Model
|
||||
|
||||
/**
|
||||
* Gets the server associated with a database.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo<\Pterodactyl\Models\Server, $this>
|
||||
*/
|
||||
public function server(): BelongsTo
|
||||
{
|
||||
|
||||
@ -71,6 +71,8 @@ class DatabaseHost extends Model
|
||||
|
||||
/**
|
||||
* Gets the node associated with a database host.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo<\Pterodactyl\Models\Node, $this>
|
||||
*/
|
||||
public function node(): BelongsTo
|
||||
{
|
||||
@ -79,6 +81,8 @@ class DatabaseHost extends Model
|
||||
|
||||
/**
|
||||
* Gets the databases associated with this host.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany<\Pterodactyl\Models\Database, $this>
|
||||
*/
|
||||
public function databases(): HasMany
|
||||
{
|
||||
|
||||
@ -263,6 +263,8 @@ class Egg extends Model
|
||||
|
||||
/**
|
||||
* Gets nest associated with an egg.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo<\Pterodactyl\Models\Nest, $this>
|
||||
*/
|
||||
public function nest(): BelongsTo
|
||||
{
|
||||
@ -271,6 +273,8 @@ class Egg extends Model
|
||||
|
||||
/**
|
||||
* Gets all servers associated with this egg.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany<\Pterodactyl\Models\Server, $this>
|
||||
*/
|
||||
public function servers(): HasMany
|
||||
{
|
||||
@ -279,6 +283,8 @@ class Egg extends Model
|
||||
|
||||
/**
|
||||
* Gets all variables associated with this egg.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany<\Pterodactyl\Models\EggVariable, $this>
|
||||
*/
|
||||
public function variables(): HasMany
|
||||
{
|
||||
@ -287,6 +293,8 @@ class Egg extends Model
|
||||
|
||||
/**
|
||||
* Get the parent egg from which to copy scripts.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo<static, $this>
|
||||
*/
|
||||
public function scriptFrom(): BelongsTo
|
||||
{
|
||||
@ -295,6 +303,8 @@ class Egg extends Model
|
||||
|
||||
/**
|
||||
* Get the parent egg from which to copy configuration settings.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo<static, $this>
|
||||
*/
|
||||
public function configFrom(): BelongsTo
|
||||
{
|
||||
|
||||
@ -84,6 +84,9 @@ class EggVariable extends Model
|
||||
return in_array('required', explode('|', $this->rules));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasOne<\Pterodactyl\Models\Egg, $this>
|
||||
*/
|
||||
public function egg(): HasOne
|
||||
{
|
||||
return $this->hasOne(Egg::class);
|
||||
@ -91,6 +94,8 @@ class EggVariable extends Model
|
||||
|
||||
/**
|
||||
* Return server variables associated with this variable.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany<\Pterodactyl\Models\ServerVariable, $this>
|
||||
*/
|
||||
public function serverVariable(): HasMany
|
||||
{
|
||||
|
||||
@ -51,6 +51,8 @@ class Location extends Model
|
||||
|
||||
/**
|
||||
* Gets the nodes in a specified location.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany<\Pterodactyl\Models\Node, $this>
|
||||
*/
|
||||
public function nodes(): HasMany
|
||||
{
|
||||
@ -59,6 +61,8 @@ class Location extends Model
|
||||
|
||||
/**
|
||||
* Gets the servers within a given location.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasManyThrough<\Pterodactyl\Models\Server, \Pterodactyl\Models\Node, $this>
|
||||
*/
|
||||
public function servers(): HasManyThrough
|
||||
{
|
||||
|
||||
@ -94,6 +94,8 @@ class Mount extends Model
|
||||
|
||||
/**
|
||||
* Returns all eggs that have this mount assigned.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany<\Pterodactyl\Models\Egg, $this>
|
||||
*/
|
||||
public function eggs(): BelongsToMany
|
||||
{
|
||||
@ -102,6 +104,8 @@ class Mount extends Model
|
||||
|
||||
/**
|
||||
* Returns all nodes that have this mount assigned.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany<\Pterodactyl\Models\Node, $this>
|
||||
*/
|
||||
public function nodes(): BelongsToMany
|
||||
{
|
||||
@ -110,6 +114,8 @@ class Mount extends Model
|
||||
|
||||
/**
|
||||
* Returns all servers that have this mount assigned.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany<\Pterodactyl\Models\Server, $this>
|
||||
*/
|
||||
public function servers(): BelongsToMany
|
||||
{
|
||||
|
||||
@ -48,6 +48,8 @@ class Nest extends Model
|
||||
|
||||
/**
|
||||
* Gets all eggs associated with this service.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany<\Pterodactyl\Models\Egg, $this>
|
||||
*/
|
||||
public function eggs(): HasMany
|
||||
{
|
||||
@ -56,6 +58,8 @@ class Nest extends Model
|
||||
|
||||
/**
|
||||
* Gets all servers associated with this nest.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany<\Pterodactyl\Models\Server, $this>
|
||||
*/
|
||||
public function servers(): HasMany
|
||||
{
|
||||
|
||||
@ -194,6 +194,9 @@ class Node extends Model
|
||||
return $this->maintenance_mode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasManyThrough<\Pterodactyl\Models\Mount, \Pterodactyl\Models\MountNode, $this>
|
||||
*/
|
||||
public function mounts(): HasManyThrough
|
||||
{
|
||||
return $this->hasManyThrough(Mount::class, MountNode::class, 'node_id', 'id', 'id', 'mount_id');
|
||||
@ -201,6 +204,8 @@ class Node extends Model
|
||||
|
||||
/**
|
||||
* Gets the location associated with a node.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo<\Pterodactyl\Models\Location, $this>
|
||||
*/
|
||||
public function location(): BelongsTo
|
||||
{
|
||||
@ -209,6 +214,8 @@ class Node extends Model
|
||||
|
||||
/**
|
||||
* Gets the servers associated with a node.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany<\Pterodactyl\Models\Server, $this>
|
||||
*/
|
||||
public function servers(): HasMany
|
||||
{
|
||||
@ -217,6 +224,8 @@ class Node extends Model
|
||||
|
||||
/**
|
||||
* Gets the allocations associated with a node.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany<\Pterodactyl\Models\Allocation, $this>
|
||||
*/
|
||||
public function allocations(): HasMany
|
||||
{
|
||||
|
||||
@ -26,6 +26,9 @@ class RecoveryToken extends Model
|
||||
'token' => 'required|string',
|
||||
];
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo<\Pterodactyl\Models\User, $this>
|
||||
*/
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
|
||||
@ -133,6 +133,8 @@ class Schedule extends Model
|
||||
|
||||
/**
|
||||
* Return tasks belonging to a schedule.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany<\Pterodactyl\Models\Task, $this>
|
||||
*/
|
||||
public function tasks(): HasMany
|
||||
{
|
||||
@ -141,6 +143,8 @@ class Schedule extends Model
|
||||
|
||||
/**
|
||||
* Return the server model that a schedule belongs to.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo<\Pterodactyl\Models\Server, $this>
|
||||
*/
|
||||
public function server(): BelongsTo
|
||||
{
|
||||
|
||||
@ -219,6 +219,8 @@ class Server extends Model
|
||||
|
||||
/**
|
||||
* Gets the user who owns the server.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo<\Pterodactyl\Models\User, $this>
|
||||
*/
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
@ -227,6 +229,8 @@ class Server extends Model
|
||||
|
||||
/**
|
||||
* Gets the subusers associated with a server.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany<\Pterodactyl\Models\Subuser, $this>
|
||||
*/
|
||||
public function subusers(): HasMany
|
||||
{
|
||||
@ -235,6 +239,8 @@ class Server extends Model
|
||||
|
||||
/**
|
||||
* Gets the default allocation for a server.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasOne<\Pterodactyl\Models\Allocation, $this>
|
||||
*/
|
||||
public function allocation(): HasOne
|
||||
{
|
||||
@ -243,6 +249,8 @@ class Server extends Model
|
||||
|
||||
/**
|
||||
* Gets all allocations associated with this server.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany<\Pterodactyl\Models\Allocation, $this>
|
||||
*/
|
||||
public function allocations(): HasMany
|
||||
{
|
||||
@ -251,6 +259,8 @@ class Server extends Model
|
||||
|
||||
/**
|
||||
* Gets information for the nest associated with this server.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo<\Pterodactyl\Models\Nest, $this>
|
||||
*/
|
||||
public function nest(): BelongsTo
|
||||
{
|
||||
@ -259,6 +269,8 @@ class Server extends Model
|
||||
|
||||
/**
|
||||
* Gets information for the egg associated with this server.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasOne<\Pterodactyl\Models\Egg, $this>
|
||||
*/
|
||||
public function egg(): HasOne
|
||||
{
|
||||
@ -267,6 +279,8 @@ class Server extends Model
|
||||
|
||||
/**
|
||||
* Gets information for the service variables associated with this server.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany<\Pterodactyl\Models\EggVariable, $this>
|
||||
*/
|
||||
public function variables(): HasMany
|
||||
{
|
||||
@ -285,6 +299,8 @@ class Server extends Model
|
||||
|
||||
/**
|
||||
* Gets information for the node associated with this server.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo<\Pterodactyl\Models\Node, $this>
|
||||
*/
|
||||
public function node(): BelongsTo
|
||||
{
|
||||
@ -293,6 +309,8 @@ class Server extends Model
|
||||
|
||||
/**
|
||||
* Gets information for the tasks associated with this server.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany<\Pterodactyl\Models\Schedule, $this>
|
||||
*/
|
||||
public function schedules(): HasMany
|
||||
{
|
||||
@ -301,6 +319,8 @@ class Server extends Model
|
||||
|
||||
/**
|
||||
* Gets all databases associated with a server.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany<\Pterodactyl\Models\Database, $this>
|
||||
*/
|
||||
public function databases(): HasMany
|
||||
{
|
||||
@ -310,21 +330,28 @@ class Server extends Model
|
||||
/**
|
||||
* Returns the location that a server belongs to.
|
||||
*
|
||||
* @return \Znck\Eloquent\Relations\BelongsToThrough<\Pterodactyl\Models\Location, \Pterodactyl\Models\Node>
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function location(): \Znck\Eloquent\Relations\BelongsToThrough
|
||||
{
|
||||
return $this->belongsToThrough(Location::class, Node::class);
|
||||
return $this->belongsToThrough(Location::class, Node::class); // @phpstan-ignore return.type
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the associated server transfer.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasOne<\Pterodactyl\Models\ServerTransfer, $this>
|
||||
*/
|
||||
public function transfer(): HasOne
|
||||
{
|
||||
return $this->hasOne(ServerTransfer::class)->whereNull('successful')->orderByDesc('id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany<\Pterodactyl\Models\Backup, $this>
|
||||
*/
|
||||
public function backups(): HasMany
|
||||
{
|
||||
return $this->hasMany(Backup::class);
|
||||
@ -332,6 +359,8 @@ class Server extends Model
|
||||
|
||||
/**
|
||||
* Returns all mounts that have this server has mounted.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasManyThrough<\Pterodactyl\Models\Mount, \Pterodactyl\Models\MountServer, $this>
|
||||
*/
|
||||
public function mounts(): HasManyThrough
|
||||
{
|
||||
@ -340,6 +369,8 @@ class Server extends Model
|
||||
|
||||
/**
|
||||
* Returns all of the activity log entries where the server is the subject.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\MorphToMany<\Pterodactyl\Models\ActivityLog, $this>
|
||||
*/
|
||||
public function activity(): MorphToMany
|
||||
{
|
||||
|
||||
@ -70,6 +70,8 @@ class ServerTransfer extends Model
|
||||
|
||||
/**
|
||||
* Gets the server associated with a server transfer.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo<\Pterodactyl\Models\Server, $this>
|
||||
*/
|
||||
public function server(): BelongsTo
|
||||
{
|
||||
@ -78,6 +80,8 @@ class ServerTransfer extends Model
|
||||
|
||||
/**
|
||||
* Gets the source node associated with a server transfer.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasOne<\Pterodactyl\Models\Node, $this>
|
||||
*/
|
||||
public function oldNode(): HasOne
|
||||
{
|
||||
@ -86,6 +90,8 @@ class ServerTransfer extends Model
|
||||
|
||||
/**
|
||||
* Gets the target node associated with a server transfer.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasOne<\Pterodactyl\Models\Node, $this>
|
||||
*/
|
||||
public function newNode(): HasOne
|
||||
{
|
||||
|
||||
@ -41,6 +41,8 @@ class ServerVariable extends Model
|
||||
|
||||
/**
|
||||
* Returns the server this variable is associated with.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo<\Pterodactyl\Models\Server, $this>
|
||||
*/
|
||||
public function server(): BelongsTo
|
||||
{
|
||||
@ -49,6 +51,8 @@ class ServerVariable extends Model
|
||||
|
||||
/**
|
||||
* Returns information about a given variables parent.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo<\Pterodactyl\Models\EggVariable, $this>
|
||||
*/
|
||||
public function variable(): BelongsTo
|
||||
{
|
||||
|
||||
@ -65,6 +65,8 @@ class Subuser extends Model
|
||||
|
||||
/**
|
||||
* Gets the server associated with a subuser.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo<\Pterodactyl\Models\Server, $this>
|
||||
*/
|
||||
public function server(): BelongsTo
|
||||
{
|
||||
@ -73,6 +75,8 @@ class Subuser extends Model
|
||||
|
||||
/**
|
||||
* Gets the user associated with a subuser.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo<\Pterodactyl\Models\User, $this>
|
||||
*/
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
@ -81,6 +85,8 @@ class Subuser extends Model
|
||||
|
||||
/**
|
||||
* Gets the permissions associated with a subuser.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany<\Pterodactyl\Models\Permission, $this>
|
||||
*/
|
||||
public function permissions(): HasMany
|
||||
{
|
||||
|
||||
@ -111,6 +111,8 @@ class Task extends Model
|
||||
|
||||
/**
|
||||
* Return the schedule that a task belongs to.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo<\Pterodactyl\Models\Schedule, $this>
|
||||
*/
|
||||
public function schedule(): BelongsTo
|
||||
{
|
||||
@ -119,9 +121,11 @@ class Task extends Model
|
||||
|
||||
/**
|
||||
* Return the server a task is assigned to, acts as a belongsToThrough.
|
||||
*
|
||||
* @return \Znck\Eloquent\Relations\BelongsToThrough<\Pterodactyl\Models\Server, \Pterodactyl\Models\Schedule>
|
||||
*/
|
||||
public function server(): \Znck\Eloquent\Relations\BelongsToThrough
|
||||
{
|
||||
return $this->belongsToThrough(Server::class, Schedule::class);
|
||||
return $this->belongsToThrough(Server::class, Schedule::class); // @phpstan-ignore return.type
|
||||
}
|
||||
}
|
||||
|
||||
@ -228,23 +228,34 @@ class User extends Model implements
|
||||
|
||||
/**
|
||||
* Returns all servers that a user owns.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany<\Pterodactyl\Models\Server, $this>
|
||||
*/
|
||||
public function servers(): HasMany
|
||||
{
|
||||
return $this->hasMany(Server::class, 'owner_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany<\Pterodactyl\Models\ApiKey, $this>
|
||||
*/
|
||||
public function apiKeys(): HasMany
|
||||
{
|
||||
return $this->hasMany(ApiKey::class)
|
||||
->where('key_type', ApiKey::TYPE_ACCOUNT);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany<\Pterodactyl\Models\RecoveryToken, $this>
|
||||
*/
|
||||
public function recoveryTokens(): HasMany
|
||||
{
|
||||
return $this->hasMany(RecoveryToken::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany<\Pterodactyl\Models\UserSSHKey, $this>
|
||||
*/
|
||||
public function sshKeys(): HasMany
|
||||
{
|
||||
return $this->hasMany(UserSSHKey::class);
|
||||
@ -253,6 +264,8 @@ class User extends Model implements
|
||||
/**
|
||||
* Returns all the activity logs where this user is the subject — not to
|
||||
* be confused by activity logs where this user is the _actor_.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\MorphToMany<\Pterodactyl\Models\ActivityLog, $this>
|
||||
*/
|
||||
public function activity(): MorphToMany
|
||||
{
|
||||
@ -262,6 +275,8 @@ class User extends Model implements
|
||||
/**
|
||||
* Returns all the servers that a user can access by way of being the owner of the
|
||||
* server, or because they are assigned as a subuser for that server.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Builder<\Pterodactyl\Models\Server>
|
||||
*/
|
||||
public function accessibleServers(): Builder
|
||||
{
|
||||
|
||||
@ -60,6 +60,9 @@ class UserSSHKey extends Model
|
||||
'public_key' => ['required', 'string'],
|
||||
];
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo<\Pterodactyl\Models\User, $this>
|
||||
*/
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user