mirror of
				https://github.com/pelican-dev/panel.git
				synced 2025-10-26 07:26:51 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			29 lines
		
	
	
		
			649 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			29 lines
		
	
	
		
			649 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| namespace App\Transformers\Api\Client;
 | |
| 
 | |
| use App\Models\Allocation;
 | |
| 
 | |
| class AllocationTransformer extends BaseClientTransformer
 | |
| {
 | |
|     /**
 | |
|      * Return the resource name for the JSONAPI output.
 | |
|      */
 | |
|     public function getResourceName(): string
 | |
|     {
 | |
|         return 'allocation';
 | |
|     }
 | |
| 
 | |
|     public function transform(Allocation $model): array
 | |
|     {
 | |
|         return [
 | |
|             'id' => $model->id,
 | |
|             'ip' => $model->ip,
 | |
|             'ip_alias' => $model->ip_alias,
 | |
|             'port' => $model->port,
 | |
|             'notes' => $model->notes,
 | |
|             'is_default' => $model->server->allocation_id === $model->id,
 | |
|         ];
 | |
|     }
 | |
| }
 | 
