mirror of
				https://github.com/pelican-dev/panel.git
				synced 2025-11-04 09:16:51 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			30 lines
		
	
	
		
			720 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			30 lines
		
	
	
		
			720 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
 | 
						|
namespace App\Transformers\Api\Client;
 | 
						|
 | 
						|
use App\Models\Subuser;
 | 
						|
 | 
						|
class SubuserTransformer extends BaseClientTransformer
 | 
						|
{
 | 
						|
    /**
 | 
						|
     * Return the resource name for the JSONAPI output.
 | 
						|
     */
 | 
						|
    public function getResourceName(): string
 | 
						|
    {
 | 
						|
        return Subuser::RESOURCE_NAME;
 | 
						|
    }
 | 
						|
 | 
						|
    /**
 | 
						|
     * Transforms a subuser into a model that can be shown to a front-end user.
 | 
						|
     *
 | 
						|
     * @throws \App\Exceptions\Transformer\InvalidTransformerLevelException
 | 
						|
     */
 | 
						|
    public function transform(Subuser $model): array
 | 
						|
    {
 | 
						|
        return array_merge(
 | 
						|
            $this->makeTransformer(UserTransformer::class)->transform($model->user),
 | 
						|
            ['permissions' => $model->permissions]
 | 
						|
        );
 | 
						|
    }
 | 
						|
}
 |