misc_pterodactyl-panel/app/Models/ServerVariable.php

60 lines
1.5 KiB
PHP
Raw 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;
/**
* @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';
2015-12-08 23:33:33 +00:00
protected $table = 'server_variables';
2021-07-17 21:18:05 +00:00
protected bool $immutableDates = true;
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',
];
2021-07-17 21:18:05 +00:00
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
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
2017-08-12 20:32:34 +00:00
*/
public function server()
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.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function variable()
{
return $this->belongsTo(EggVariable::class, 'variable_id');
2017-08-12 20:32:34 +00:00
}
2015-12-08 23:33:33 +00:00
}