mirror of
				https://github.com/pelican-dev/panel.git
				synced 2025-11-01 00:06:52 +01:00 
			
		
		
		
	 da195fd2fe
			
		
	
	
		da195fd2fe
		
			
		
	
	
	
	
		
			
			* Not found property rule * Make these “better” * Day 1 * Day 2 * Day 3 * Dat 4 * Remove disabled check * Day 4 continued * Run pint * Final changes hopefully * Pint fixes * Fix again * Reset these * Update app/Filament/Admin/Pages/Health.php Co-authored-by: MartinOscar <40749467+rmartinoscar@users.noreply.github.com> * Update app/Traits/CheckMigrationsTrait.php Co-authored-by: MartinOscar <40749467+rmartinoscar@users.noreply.github.com> --------- Co-authored-by: MartinOscar <40749467+rmartinoscar@users.noreply.github.com>
		
			
				
	
	
		
			46 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			46 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| namespace App\Transformers\Api\Application;
 | |
| 
 | |
| use App\Models\Role;
 | |
| use League\Fractal\Resource\Collection;
 | |
| use League\Fractal\Resource\NullResource;
 | |
| 
 | |
| class RoleTransformer extends BaseTransformer
 | |
| {
 | |
|     protected array $availableIncludes = [
 | |
|         'permissions',
 | |
|     ];
 | |
| 
 | |
|     /**
 | |
|      * Return the resource name for the JSONAPI output.
 | |
|      */
 | |
|     public function getResourceName(): string
 | |
|     {
 | |
|         return Role::RESOURCE_NAME;
 | |
|     }
 | |
| 
 | |
|     /**
 | |
|      * @param  Role  $model
 | |
|      */
 | |
|     public function transform($model): array
 | |
|     {
 | |
|         return [
 | |
|             'id' => $model->id,
 | |
|             'name' => $model->name,
 | |
|             'created_at' => $model->created_at->toAtomString(),
 | |
|             'updated_at' => $model->updated_at->toAtomString(),
 | |
|         ];
 | |
|     }
 | |
| 
 | |
|     /**
 | |
|      * Include the permissions associated with this role.
 | |
|      */
 | |
|     public function includePermissions(Role $model): Collection|NullResource
 | |
|     {
 | |
|         $model->loadMissing('permissions');
 | |
| 
 | |
|         return $this->collection($model->getRelation('permissions'), $this->makeTransformer(RolePermissionTransformer::class), 'permissions');
 | |
|     }
 | |
| }
 |