misc_pterodactyl-panel/app/Models/Nest.php
Dane Everitt 08bdc9705f
[L6] Update composer dependencies to support L6
Drops all of the eloquence requirements, this is going to break a shit load of code, needs to happen tired of this package always holding us back.

Quite confident in my ability to write custom code to do the basic validation we need.

Searching should be a fun nightmare to deal with later...
2019-09-04 21:00:34 -07:00

77 lines
1.6 KiB
PHP

<?php
namespace Pterodactyl\Models;
class Nest extends Validable
{
/**
* The resource name for this model when it is transformed into an
* API representation using fractal.
*/
const RESOURCE_NAME = 'nest';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'nests';
/**
* Fields that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name',
'description',
];
/**
* @var array
*/
protected static $applicationRules = [
'author' => 'required',
'name' => 'required',
'description' => 'sometimes',
];
/**
* @var array
*/
protected static $dataIntegrityRules = [
'author' => 'string|email',
'name' => 'string|max:255',
'description' => 'nullable|string',
];
/**
* Gets all eggs associated with this service.
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function eggs()
{
return $this->hasMany(Egg::class);
}
/**
* Returns all of the packs associated with a nest, regardless of the egg.
*
* @return \Illuminate\Database\Eloquent\Relations\HasManyThrough
*/
public function packs()
{
return $this->hasManyThrough(Pack::class, Egg::class, 'nest_id', 'egg_id');
}
/**
* Gets all servers associated with this nest.
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function servers()
{
return $this->hasMany(Server::class);
}
}