Massively simplify API binding logic
Changes the API internals to use normal Laravel binding which automatically supports nested-models and can determine their relationships. This removes a lot of confusingly complex internal logic and replaces it with standard Laravel code. This also removes a deprecated "getModel" method and fully replaces it with a "parameter" method that does stricter type-checking.
This commit is contained in:
parent
f1235c7f88
commit
e313dff674
53 changed files with 290 additions and 604 deletions
|
@ -9,6 +9,8 @@ use Znck\Eloquent\Traits\BelongsToThrough;
|
|||
use Pterodactyl\Exceptions\Http\Server\ServerStateConflictException;
|
||||
|
||||
/**
|
||||
* Pterodactyl\Models\Server.
|
||||
*
|
||||
* @property int $id
|
||||
* @property string|null $external_id
|
||||
* @property string $uuid
|
||||
|
@ -24,33 +26,75 @@ use Pterodactyl\Exceptions\Http\Server\ServerStateConflictException;
|
|||
* @property int $disk
|
||||
* @property int $io
|
||||
* @property int $cpu
|
||||
* @property string $threads
|
||||
* @property string|null $threads
|
||||
* @property bool $oom_disabled
|
||||
* @property int $allocation_id
|
||||
* @property int $nest_id
|
||||
* @property int $egg_id
|
||||
* @property string $startup
|
||||
* @property string $image
|
||||
* @property int $allocation_limit
|
||||
* @property int $database_limit
|
||||
* @property int|null $allocation_limit
|
||||
* @property int|null $database_limit
|
||||
* @property int $backup_limit
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property \Pterodactyl\Models\User $user
|
||||
* @property \Pterodactyl\Models\Subuser[]|\Illuminate\Database\Eloquent\Collection $subusers
|
||||
* @property \Pterodactyl\Models\Allocation $allocation
|
||||
* @property \Pterodactyl\Models\Allocation[]|\Illuminate\Database\Eloquent\Collection $allocations
|
||||
* @property \Pterodactyl\Models\Node $node
|
||||
* @property \Illuminate\Support\Carbon|null $created_at
|
||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||
* @property \Pterodactyl\Models\Allocation|null $allocation
|
||||
* @property \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\Allocation[] $allocations
|
||||
* @property int|null $allocations_count
|
||||
* @property \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\AuditLog[] $audits
|
||||
* @property int|null $audits_count
|
||||
* @property \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\Backup[] $backups
|
||||
* @property int|null $backups_count
|
||||
* @property \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\Database[] $databases
|
||||
* @property int|null $databases_count
|
||||
* @property \Pterodactyl\Models\Egg|null $egg
|
||||
* @property \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\Mount[] $mounts
|
||||
* @property int|null $mounts_count
|
||||
* @property \Pterodactyl\Models\Nest $nest
|
||||
* @property \Pterodactyl\Models\Egg $egg
|
||||
* @property \Pterodactyl\Models\EggVariable[]|\Illuminate\Database\Eloquent\Collection $variables
|
||||
* @property \Pterodactyl\Models\Schedule[]|\Illuminate\Database\Eloquent\Collection $schedule
|
||||
* @property \Pterodactyl\Models\Database[]|\Illuminate\Database\Eloquent\Collection $databases
|
||||
* @property \Pterodactyl\Models\Location $location
|
||||
* @property \Pterodactyl\Models\ServerTransfer $transfer
|
||||
* @property \Pterodactyl\Models\Backup[]|\Illuminate\Database\Eloquent\Collection $backups
|
||||
* @property \Pterodactyl\Models\Mount[]|\Illuminate\Database\Eloquent\Collection $mounts
|
||||
* @property \Pterodactyl\Models\AuditLog[] $audits
|
||||
* @property \Pterodactyl\Models\Node $node
|
||||
* @property \Illuminate\Notifications\DatabaseNotificationCollection|\Illuminate\Notifications\DatabaseNotification[] $notifications
|
||||
* @property int|null $notifications_count
|
||||
* @property \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\Schedule[] $schedules
|
||||
* @property int|null $schedules_count
|
||||
* @property \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\Subuser[] $subusers
|
||||
* @property int|null $subusers_count
|
||||
* @property \Pterodactyl\Models\ServerTransfer|null $transfer
|
||||
* @property \Pterodactyl\Models\User $user
|
||||
* @property \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\EggVariable[] $variables
|
||||
* @property int|null $variables_count
|
||||
*
|
||||
* @method static \Database\Factories\ServerFactory factory(...$parameters)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Server newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Server newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Server query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Server whereAllocationId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Server whereAllocationLimit($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Server whereBackupLimit($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Server whereCpu($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Server whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Server whereDatabaseLimit($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Server whereDescription($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Server whereDisk($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Server whereEggId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Server whereExternalId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Server whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Server whereImage($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Server whereIo($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Server whereMemory($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Server whereName($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Server whereNestId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Server whereNodeId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Server whereOomDisabled($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Server whereOwnerId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Server whereSkipScripts($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Server whereStartup($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Server whereStatus($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Server whereSwap($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Server whereThreads($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Server whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Server whereUuid($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Server whereUuidShort($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class Server extends Model
|
||||
{
|
||||
|
@ -273,7 +317,7 @@ class Server extends Model
|
|||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function schedule()
|
||||
public function schedules()
|
||||
{
|
||||
return $this->hasMany(Schedule::class);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue