misc_pterodactyl-panel/app/Models/ServerVariable.php

58 lines
1.4 KiB
PHP
Raw Permalink Normal View History

2015-12-08 23:33:33 +00:00
<?php
2016-12-07 22:46:38 +00:00
2015-12-08 23:33:33 +00:00
namespace Pterodactyl\Models;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* @property int $id
* @property int $server_id
* @property int $variable_id
* @property string $variable_value
* @property \Carbon\CarbonImmutable|null $created_at
* @property \Carbon\CarbonImmutable|null $updated_at
* @property \Pterodactyl\Models\EggVariable $variable
* @property \Pterodactyl\Models\Server $server
*/
class ServerVariable extends Model
2015-12-08 23:33:33 +00:00
{
/**
* The resource name for this model when it is transformed into an
* API representation using fractal.
*/
2021-01-23 20:33:34 +00:00
public const RESOURCE_NAME = 'server_variable';
protected bool $immutableDates = true;
2015-12-08 23:33:33 +00:00
protected $table = 'server_variables';
protected $guarded = ['id', 'created_at', 'updated_at'];
2017-08-12 20:32:34 +00:00
protected $casts = [
2019-09-06 04:32:57 +00:00
'server_id' => 'integer',
'variable_id' => 'integer',
];
public static array $validationRules = [
'server_id' => 'required|int',
'variable_id' => 'required|int',
'variable_value' => 'string',
];
2017-08-12 20:32:34 +00:00
/**
* Returns the server this variable is associated with.
2017-08-12 20:32:34 +00:00
*/
public function server(): BelongsTo
2017-08-12 20:32:34 +00:00
{
return $this->belongsTo(Server::class);
2017-08-12 20:32:34 +00:00
}
2017-08-12 20:32:34 +00:00
/**
* Returns information about a given variables parent.
*/
public function variable(): BelongsTo
2017-08-12 20:32:34 +00:00
{
return $this->belongsTo(EggVariable::class, 'variable_id');
2017-08-12 20:32:34 +00:00
}
2015-12-08 23:33:33 +00:00
}