2015-12-08 18:33:33 -05:00
|
|
|
<?php
|
2016-12-07 22:46:38 +00:00
|
|
|
|
2015-12-08 18:33:33 -05:00
|
|
|
namespace Pterodactyl\Models;
|
|
|
|
|
2021-01-27 20:52:11 -08: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 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.
|
|
|
|
*/
|
2021-01-23 12:33:34 -08:00
|
|
|
public const RESOURCE_NAME = 'server_variable';
|
2018-01-25 21:26:06 -06:00
|
|
|
|
2021-01-27 20:52:11 -08:00
|
|
|
/** @var bool */
|
|
|
|
protected $immutableDates = true;
|
|
|
|
|
|
|
|
/** @var string */
|
2015-12-08 18:33:33 -05:00
|
|
|
protected $table = 'server_variables';
|
|
|
|
|
2021-01-27 20:52:11 -08:00
|
|
|
/** @var string[] */
|
2015-12-15 15:08:41 -05:00
|
|
|
protected $guarded = ['id', 'created_at', 'updated_at'];
|
|
|
|
|
2021-01-27 20:52:11 -08:00
|
|
|
/** @var string[] */
|
2017-08-12 15:32:34 -05:00
|
|
|
protected $casts = [
|
2019-09-05 21:32:57 -07:00
|
|
|
'server_id' => 'integer',
|
|
|
|
'variable_id' => 'integer',
|
|
|
|
];
|
2017-02-09 17:43:54 -05:00
|
|
|
|
2021-01-27 20:52:11 -08:00
|
|
|
/** @var string[] */
|
|
|
|
public static $validationRules = [
|
|
|
|
'server_id' => 'required|int',
|
|
|
|
'variable_id' => 'required|int',
|
|
|
|
'variable_value' => 'string',
|
|
|
|
];
|
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.
|
2017-08-12 15:32:34 -05:00
|
|
|
*
|
2021-01-27 20:52:11 -08:00
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
2017-08-12 15:32:34 -05:00
|
|
|
*/
|
2021-01-27 20:52:11 -08:00
|
|
|
public function server()
|
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.
|
|
|
|
*
|
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
|
|
*/
|
|
|
|
public function variable()
|
|
|
|
{
|
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
|
|
|
}
|