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;
|
|
|
|
|
2022-10-14 16:59:20 +00:00
|
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
|
2021-01-28 04:52:11 +00:00
|
|
|
/**
|
|
|
|
* @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
|
|
|
|
*/
|
2017-02-12 21:03:17 +00:00
|
|
|
class ServerVariable extends Model
|
2015-12-08 23:33:33 +00:00
|
|
|
{
|
2018-01-26 03:26:06 +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';
|
2018-01-26 03:26:06 +00:00
|
|
|
|
2022-10-14 16:59:20 +00:00
|
|
|
protected bool $immutableDates = true;
|
2021-01-28 04:52:11 +00:00
|
|
|
|
2015-12-08 23:33:33 +00:00
|
|
|
protected $table = 'server_variables';
|
|
|
|
|
2015-12-15 20:08:41 +00:00
|
|
|
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',
|
|
|
|
];
|
2017-02-09 22:43:54 +00:00
|
|
|
|
2022-10-14 16:59:20 +00:00
|
|
|
public static array $validationRules = [
|
2021-01-28 04:52:11 +00:00
|
|
|
'server_id' => 'required|int',
|
|
|
|
'variable_id' => 'required|int',
|
|
|
|
'variable_value' => 'string',
|
|
|
|
];
|
2017-03-12 23:34:06 +00:00
|
|
|
|
2017-08-12 20:32:34 +00:00
|
|
|
/**
|
2021-01-28 04:52:11 +00:00
|
|
|
* Returns the server this variable is associated with.
|
2017-08-12 20:32:34 +00:00
|
|
|
*/
|
2022-10-14 16:59:20 +00:00
|
|
|
public function server(): BelongsTo
|
2017-08-12 20:32:34 +00:00
|
|
|
{
|
2021-01-28 04:52:11 +00:00
|
|
|
return $this->belongsTo(Server::class);
|
2017-08-12 20:32:34 +00:00
|
|
|
}
|
2017-03-12 23:34:06 +00:00
|
|
|
|
2017-08-12 20:32:34 +00:00
|
|
|
/**
|
|
|
|
* Returns information about a given variables parent.
|
|
|
|
*/
|
2022-10-14 16:59:20 +00:00
|
|
|
public function variable(): BelongsTo
|
2017-08-12 20:32:34 +00:00
|
|
|
{
|
2017-10-07 04:57:53 +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
|
|
|
}
|