Files
pterodactyl-panel/app/Models/ServerVariable.php
T

61 lines
1.4 KiB
PHP
Raw Normal View History

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;
/**
* @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
*/
2026-10-05 18:10:18 -04:00
#[Guarded(['id', 'created_at', 'updated_at'])]
class ServerVariable extends Model
2015-12-08 18:33:33 -05: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';
2026-10-05 18:10:18 -04:00
/**
* @return array<string, string>
*/
protected function casts(): array
{
return [
'server_id' => 'integer',
'variable_id' => 'integer',
];
}
2017-08-12 15:32:34 -05:00
/**
* Returns the server this variable is associated with.
*
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
{
return $this->belongsTo(Server::class);
2017-08-12 15:32:34 -05:00
}
2017-08-12 15:32:34 -05:00
/**
* Returns information about a given variables parent.
*
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
}