mirror of
				https://github.com/pelican-dev/panel.git
				synced 2025-10-31 00:26:51 +01:00 
			
		
		
		
	 b3501be6ec
			
		
	
	
		b3501be6ec
		
			
		
	
	
	
	
		
			
			* use RESOURCE_NAME for requests * use RESOURCE_NAME for transformers * add permissions field to api key * add migration for new permissions field * update tests * remove debug log * set column type to "json" * remove default attribute to fix tests * fix default value for permissions * fix after merge * fix after merge * allow to "register" custom permissions * add "role" to default resource names * fix after merge * fix phpstan * fix migrations
		
			
				
	
	
		
			36 lines
		
	
	
		
			912 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			36 lines
		
	
	
		
			912 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| namespace App\Http\Requests\Api\Application\Allocations;
 | |
| 
 | |
| use App\Services\Acl\Api\AdminAcl;
 | |
| use App\Http\Requests\Api\Application\ApplicationApiRequest;
 | |
| use App\Models\Allocation;
 | |
| 
 | |
| class StoreAllocationRequest extends ApplicationApiRequest
 | |
| {
 | |
|     protected ?string $resource = Allocation::RESOURCE_NAME;
 | |
| 
 | |
|     protected int $permission = AdminAcl::WRITE;
 | |
| 
 | |
|     public function rules(): array
 | |
|     {
 | |
|         return [
 | |
|             'ip' => 'required|string',
 | |
|             'alias' => 'sometimes|nullable|string|max:255',
 | |
|             'ports' => 'required|array',
 | |
|             'ports.*' => 'string',
 | |
|         ];
 | |
|     }
 | |
| 
 | |
|     public function validated($key = null, $default = null): array
 | |
|     {
 | |
|         $data = parent::validated();
 | |
| 
 | |
|         return [
 | |
|             'allocation_ip' => $data['ip'],
 | |
|             'allocation_ports' => $data['ports'],
 | |
|             'allocation_alias' => $data['alias'] ?? null,
 | |
|         ];
 | |
|     }
 | |
| }
 |