Don't allow allocations to be deleted by users if no limit is defined; closes

This commit is contained in:
DaneEveritt 2022-05-07 15:05:28 -04:00
parent c751ce7f44
commit e88d24e0db
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
7 changed files with 68 additions and 19 deletions
database/Factories

View file

@ -2,6 +2,7 @@
namespace Database\Factories;
use Pterodactyl\Models\Server;
use Pterodactyl\Models\Allocation;
use Illuminate\Database\Eloquent\Factories\Factory;
@ -24,4 +25,12 @@ class AllocationFactory extends Factory
'port' => $this->faker->unique()->randomNumber(5),
];
}
/**
* Attaches the allocation to a specific server model.
*/
public function forServer(Server $server): self
{
return $this->for($server)->for($server->node);
}
}