<?php12namespace Pterodactyl\Models;34use Illuminate\Database\Eloquent\Relations\HasMany;5use Illuminate\Database\Eloquent\Factories\HasFactory;6use Illuminate\Database\Eloquent\Relations\HasManyThrough;78/**9* @property int $id10* @property string $short11* @property string $long12* @property \Carbon\Carbon $created_at13* @property \Carbon\Carbon $updated_at14* @property \Pterodactyl\Models\Node[] $nodes15* @property \Pterodactyl\Models\Server[] $servers16*/17class Location extends Model18{19/** @use HasFactory<\Database\Factories\LocationFactory> */20use HasFactory;2122/**23* The resource name for this model when it is transformed into an24* API representation using fractal.25*/26public const RESOURCE_NAME = 'location';2728/**29* The table associated with the model.30*/31protected $table = 'locations';3233/**34* Fields that are not mass assignable.35*/36protected $guarded = ['id', 'created_at', 'updated_at'];3738/**39* Rules ensuring that the raw data stored in the database meets expectations.40*/41public static array $validationRules = [42'short' => 'required|string|between:1,60|unique:locations,short',43'long' => 'string|nullable|between:1,191',44];4546public function getRouteKeyName(): string47{48return $this->getKeyName();49}5051/**52* Gets the nodes in a specified location.53*/54public function nodes(): HasMany55{56return $this->hasMany(Node::class);57}5859/**60* Gets the servers within a given location.61*/62public function servers(): HasManyThrough63{64return $this->hasManyThrough(Server::class, Node::class);65}66}676869