2015-12-08 18:33:33 -05:00
|
|
|
<?php
|
2016-12-07 22:46:38 +00:00
|
|
|
|
2026-10-05 18:10:18 -04:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
2015-12-08 18:33:33 -05:00
|
|
|
namespace Pterodactyl\Models;
|
|
|
|
|
|
2026-10-05 18:10:18 -04:00
|
|
|
use Carbon\CarbonImmutable;
|
|
|
|
|
use Illuminate\Database\Eloquent\Attributes\Guarded;
|
2022-10-14 10:59:20 -06:00
|
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
|
|
2021-01-27 20:52:11 -08:00
|
|
|
/**
|
|
|
|
|
* @property int $id
|
|
|
|
|
* @property int $server_id
|
|
|
|
|
* @property int $variable_id
|
|
|
|
|
* @property string $variable_value
|
2026-10-05 18:10:18 -04:00
|
|
|
* @property CarbonImmutable|null $created_at
|
|
|
|
|
* @property CarbonImmutable|null $updated_at
|
2024-10-21 19:18:20 -06:00
|
|
|
* @property EggVariable $variable
|
|
|
|
|
* @property Server $server
|
2021-01-27 20:52:11 -08:00
|
|
|
*/
|
2026-10-05 18:10:18 -04:00
|
|
|
#[Guarded(['id', 'created_at', 'updated_at'])]
|
2017-02-12 16:03:17 -05:00
|
|
|
class ServerVariable extends Model
|
2015-12-08 18:33:33 -05:00
|
|
|
{
|
2018-01-25 21:26:06 -06:00
|
|
|
/**
|
|
|
|
|
* The resource name for this model when it is transformed into an
|
|
|
|
|
* API representation using fractal.
|
|
|
|
|
*/
|
2026-10-05 18:10:18 -04:00
|
|
|
public const string RESOURCE_NAME = 'server_variable';
|
2017-02-09 17:43:54 -05:00
|
|
|
|
2026-10-05 18:10:18 -04:00
|
|
|
/**
|
|
|
|
|
* @return array<string, string>
|
|
|
|
|
*/
|
|
|
|
|
protected function casts(): array
|
|
|
|
|
{
|
|
|
|
|
return [
|
|
|
|
|
'server_id' => 'integer',
|
|
|
|
|
'variable_id' => 'integer',
|
|
|
|
|
];
|
|
|
|
|
}
|
2017-03-12 19:34:06 -04:00
|
|
|
|
2017-08-12 15:32:34 -05:00
|
|
|
/**
|
2021-01-27 20:52:11 -08:00
|
|
|
* Returns the server this variable is associated with.
|
2025-12-20 15:55:13 -08:00
|
|
|
*
|
2026-10-05 18:10:18 -04:00
|
|
|
* @return BelongsTo<Server, $this>
|
2017-08-12 15:32:34 -05:00
|
|
|
*/
|
2022-10-14 10:59:20 -06:00
|
|
|
public function server(): BelongsTo
|
2017-08-12 15:32:34 -05:00
|
|
|
{
|
2021-01-27 20:52:11 -08:00
|
|
|
return $this->belongsTo(Server::class);
|
2017-08-12 15:32:34 -05:00
|
|
|
}
|
2017-03-12 19:34:06 -04:00
|
|
|
|
2017-08-12 15:32:34 -05:00
|
|
|
/**
|
|
|
|
|
* Returns information about a given variables parent.
|
2025-12-20 15:55:13 -08:00
|
|
|
*
|
2026-10-05 18:10:18 -04:00
|
|
|
* @return BelongsTo<EggVariable, $this>
|
2017-08-12 15:32:34 -05:00
|
|
|
*/
|
2022-10-14 10:59:20 -06:00
|
|
|
public function variable(): BelongsTo
|
2017-08-12 15:32:34 -05:00
|
|
|
{
|
2017-10-06 23:57:53 -05:00
|
|
|
return $this->belongsTo(EggVariable::class, 'variable_id');
|
2017-08-12 15:32:34 -05:00
|
|
|
}
|
2015-12-08 18:33:33 -05:00
|
|
|
}
|