2015-12-07 00:47:19 -05:00
|
|
|
<?php
|
2016-12-07 22:46:38 +00:00
|
|
|
|
2026-10-05 18:10:18 -04:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
2015-12-07 00:47:19 -05:00
|
|
|
namespace Pterodactyl\Models;
|
|
|
|
|
|
2026-10-05 18:10:18 -04:00
|
|
|
use Database\Factories\LocationFactory;
|
|
|
|
|
use Illuminate\Database\Eloquent\Attributes\Guarded;
|
2024-10-21 19:18:20 -06:00
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
2026-10-05 18:10:18 -04:00
|
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
2022-10-14 10:59:20 -06:00
|
|
|
use Illuminate\Database\Eloquent\Relations\HasManyThrough;
|
|
|
|
|
|
2026-10-05 18:10:18 -04:00
|
|
|
#[Guarded(['id', 'created_at', 'updated_at'])]
|
2020-04-03 23:22:35 -07:00
|
|
|
class Location extends Model
|
2015-12-07 00:47:19 -05:00
|
|
|
{
|
2026-10-05 18:10:18 -04:00
|
|
|
/** @use HasFactory<LocationFactory> */
|
2024-10-21 19:18:20 -06:00
|
|
|
use HasFactory;
|
|
|
|
|
|
2026-10-05 18:10:18 -04:00
|
|
|
public const string RESOURCE_NAME = 'location';
|
2017-06-14 23:53:24 -05:00
|
|
|
|
2022-05-22 14:10:01 -04:00
|
|
|
public function getRouteKeyName(): string
|
|
|
|
|
{
|
|
|
|
|
return $this->getKeyName();
|
|
|
|
|
}
|
|
|
|
|
|
2017-02-10 17:09:56 -05:00
|
|
|
/**
|
2026-10-05 18:10:18 -04:00
|
|
|
* @return HasMany<Node, $this>
|
2017-02-10 17:09:56 -05:00
|
|
|
*/
|
2022-10-14 10:59:20 -06:00
|
|
|
public function nodes(): HasMany
|
2017-02-10 17:09:56 -05:00
|
|
|
{
|
|
|
|
|
return $this->hasMany(Node::class);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2026-10-05 18:10:18 -04:00
|
|
|
* @return HasManyThrough<Server, Node, $this>
|
2017-02-10 17:09:56 -05:00
|
|
|
*/
|
2022-10-14 10:59:20 -06:00
|
|
|
public function servers(): HasManyThrough
|
2017-02-10 17:09:56 -05:00
|
|
|
{
|
|
|
|
|
return $this->hasManyThrough(Server::class, Node::class);
|
|
|
|
|
}
|
2015-12-07 00:47:19 -05:00
|
|
|
}
|