mirror of
https://github.com/AnimeThemes/animethemes-server.git
synced 2026-07-11 01:24:46 +02:00
32 lines
558 B
PHP
32 lines
558 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Concerns\Filament;
|
|
|
|
use App\Filament\Tabs\BaseTab;
|
|
|
|
/**
|
|
* Trait HasTabs.
|
|
*/
|
|
trait HasTabs
|
|
{
|
|
/**
|
|
* Get the tabs for an array key-mapped.
|
|
*
|
|
* @param class-string<BaseTab>[] $tabClasses
|
|
* @return array
|
|
*/
|
|
public function toArray(array $tabClasses): array
|
|
{
|
|
$tabs = [];
|
|
|
|
foreach ($tabClasses as $class) {
|
|
if ((new $class)->shouldBeHidden()) continue;
|
|
$tabs[$class::getKey()] = $class::make();
|
|
}
|
|
|
|
return $tabs;
|
|
}
|
|
}
|