Don't allow allocations to be deleted by users if no limit is defined; closes #3703
This commit is contained in:
parent
c751ce7f44
commit
e88d24e0db
7 changed files with 68 additions and 19 deletions
database/Factories
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue