Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pterodactyl
GitHub Repository: pterodactyl/panel
Path: blob/1.0-develop/app/Models/Nest.php
7432 views
1
<?php
2
3
namespace Pterodactyl\Models;
4
5
use Illuminate\Database\Eloquent\Relations\HasMany;
6
use Illuminate\Database\Eloquent\Factories\HasFactory;
7
8
/**
9
* @property int $id
10
* @property string $uuid
11
* @property string $author
12
* @property string $name
13
* @property string|null $description
14
* @property \Carbon\Carbon $created_at
15
* @property \Carbon\Carbon $updated_at
16
* @property \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\Server[] $servers
17
* @property \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\Egg[] $eggs
18
*/
19
class Nest extends Model
20
{
21
/** @use HasFactory<\Database\Factories\NestFactory> */
22
use HasFactory;
23
24
/**
25
* The resource name for this model when it is transformed into an
26
* API representation using fractal.
27
*/
28
public const RESOURCE_NAME = 'nest';
29
30
/**
31
* The table associated with the model.
32
*/
33
protected $table = 'nests';
34
35
/**
36
* Fields that are mass assignable.
37
*/
38
protected $fillable = [
39
'name',
40
'description',
41
];
42
43
public static array $validationRules = [
44
'author' => 'required|string|email',
45
'name' => 'required|string|max:191',
46
'description' => 'nullable|string',
47
];
48
49
/**
50
* Gets all eggs associated with this service.
51
*/
52
public function eggs(): HasMany
53
{
54
return $this->hasMany(Egg::class);
55
}
56
57
/**
58
* Gets all servers associated with this nest.
59
*/
60
public function servers(): HasMany
61
{
62
return $this->hasMany(Server::class);
63
}
64
}
65
66