mirror of
				https://github.com/pelican-dev/panel.git
				synced 2025-10-31 20:16:51 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			47 lines
		
	
	
		
			1008 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			47 lines
		
	
	
		
			1008 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| namespace Pterodactyl\Http\Requests\Api\Application\Allocations;
 | |
| 
 | |
| use Pterodactyl\Services\Acl\Api\AdminAcl;
 | |
| use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest;
 | |
| 
 | |
| class StoreAllocationRequest extends ApplicationApiRequest
 | |
| {
 | |
|     /**
 | |
|      * @var string
 | |
|      */
 | |
|     protected $resource = AdminAcl::RESOURCE_ALLOCATIONS;
 | |
| 
 | |
|     /**
 | |
|      * @var int
 | |
|      */
 | |
|     protected $permission = AdminAcl::WRITE;
 | |
| 
 | |
|     /**
 | |
|      * @return array
 | |
|      */
 | |
|     public function rules(): array
 | |
|     {
 | |
|         return [
 | |
|             'ip' => 'required|string',
 | |
|             'alias' => 'sometimes|nullable|string|max:255',
 | |
|             'ports' => 'required|array',
 | |
|             'ports.*' => 'string',
 | |
|         ];
 | |
|     }
 | |
| 
 | |
|     /**
 | |
|      * @return array
 | |
|      */
 | |
|     public function validated()
 | |
|     {
 | |
|         $data = parent::validated();
 | |
| 
 | |
|         return [
 | |
|             'allocation_ip' => $data['ip'],
 | |
|             'allocation_ports' => $data['ports'],
 | |
|             'allocation_alias' => $data['alias'] ?? null,
 | |
|         ];
 | |
|     }
 | |
| }
 | 
