mirror of
				https://github.com/pelican-dev/panel.git
				synced 2025-10-30 18:46:51 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			29 lines
		
	
	
		
			773 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			29 lines
		
	
	
		
			773 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| namespace App\Traits\Filament;
 | |
| 
 | |
| use Filament\Resources\RelationManagers\RelationManager;
 | |
| 
 | |
| trait CanCustomizeRelations
 | |
| {
 | |
|     /** @var array<class-string<RelationManager>> */
 | |
|     protected static array $customRelations = [];
 | |
| 
 | |
|     public static function registerCustomRelations(string ...$customRelations): void
 | |
|     {
 | |
|         static::$customRelations = array_merge(static::$customRelations, $customRelations);
 | |
|     }
 | |
| 
 | |
|     /** @return class-string<RelationManager>[] */
 | |
|     public static function getDefaultRelations(): array
 | |
|     {
 | |
|         return [];
 | |
|     }
 | |
| 
 | |
|     /** @return class-string<RelationManager>[] */
 | |
|     public static function getRelations(): array
 | |
|     {
 | |
|         return array_unique(array_merge(static::getDefaultRelations(), static::$customRelations));
 | |
|     }
 | |
| }
 | 
