Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pterodactyl
GitHub Repository: pterodactyl/panel
Path: blob/1.0-develop/app/Models/ServerVariable.php
7432 views
1
<?php
2
3
namespace Pterodactyl\Models;
4
5
use Illuminate\Database\Eloquent\Relations\BelongsTo;
6
7
/**
8
* @property int $id
9
* @property int $server_id
10
* @property int $variable_id
11
* @property string $variable_value
12
* @property \Carbon\CarbonImmutable|null $created_at
13
* @property \Carbon\CarbonImmutable|null $updated_at
14
* @property EggVariable $variable
15
* @property Server $server
16
*/
17
class ServerVariable extends Model
18
{
19
/**
20
* The resource name for this model when it is transformed into an
21
* API representation using fractal.
22
*/
23
public const RESOURCE_NAME = 'server_variable';
24
25
protected bool $immutableDates = true;
26
27
protected $table = 'server_variables';
28
29
protected $guarded = ['id', 'created_at', 'updated_at'];
30
31
protected $casts = [
32
'server_id' => 'integer',
33
'variable_id' => 'integer',
34
];
35
36
public static array $validationRules = [
37
'server_id' => 'required|int',
38
'variable_id' => 'required|int',
39
'variable_value' => 'string',
40
];
41
42
/**
43
* Returns the server this variable is associated with.
44
*/
45
public function server(): BelongsTo
46
{
47
return $this->belongsTo(Server::class);
48
}
49
50
/**
51
* Returns information about a given variables parent.
52
*/
53
public function variable(): BelongsTo
54
{
55
return $this->belongsTo(EggVariable::class, 'variable_id');
56
}
57
}
58
59