misc_pterodactyl-panel/app/Models/Nest.php
Matthew Penner cbcf62086f
Upgrade to Laravel 9 (#4413)
Co-authored-by: DaneEveritt <dane@daneeveritt.com>
2022-10-14 10:59:20 -06:00

60 lines
1.4 KiB
PHP

<?php
namespace Pterodactyl\Models;
use Illuminate\Database\Eloquent\Relations\HasMany;
/**
* @property int $id
* @property string $uuid
* @property string $author
* @property string $name
* @property string|null $description
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
* @property \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\Server[] $servers
* @property \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\Egg[] $eggs
*/
class Nest extends Model
{
/**
* The resource name for this model when it is transformed into an
* API representation using fractal.
*/
public const RESOURCE_NAME = 'nest';
/**
* The table associated with the model.
*/
protected $table = 'nests';
/**
* Fields that are mass assignable.
*/
protected $fillable = [
'name',
'description',
];
public static array $validationRules = [
'author' => 'required|string|email',
'name' => 'required|string|max:191',
'description' => 'nullable|string',
];
/**
* Gets all eggs associated with this service.
*/
public function eggs(): HasMany
{
return $this->hasMany(Egg::class);
}
/**
* Gets all servers associated with this nest.
*/
public function servers(): HasMany
{
return $this->hasMany(Server::class);
}
}