mirror of
https://github.com/pelican-dev/panel.git
synced 2025-06-12 16:38:59 +02:00
34 lines
864 B
PHP
34 lines
864 B
PHP
<?php
|
|
|
|
namespace App\Traits\Filament;
|
|
|
|
use Filament\Resources\RelationManagers\RelationManager;
|
|
|
|
trait CanCustomizeRelations
|
|
{
|
|
/** @var array<class-string<RelationManager>> */
|
|
protected static array $customRelations = [];
|
|
|
|
/** @param class-string<RelationManager>[] $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));
|
|
}
|
|
}
|