-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
/
Tab.php
46 lines (37 loc) · 1.02 KB
/
Tab.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
namespace Filament\Infolists\Components\Tabs;
use Filament\Infolists\Components\Component;
use Filament\Support\Concerns\HasBadge;
use Filament\Support\Concerns\HasIcon;
use Illuminate\Support\Str;
class Tab extends Component
{
use HasBadge;
use HasIcon;
/**
* @var view-string
*/
protected string $view = 'filament-infolists::components.tabs.tab';
final public function __construct(string $label)
{
$this->label($label);
$this->id(Str::slug($label));
}
public static function make(string $label): static
{
$static = app(static::class, ['label' => $label]);
$static->configure();
return $static;
}
public function getId(): string
{
return $this->getContainer()->getParentComponent()->getId() . '-' . parent::getId() . '-tab';
}
/**
* @return array<string, int | null>
*/
public function getColumnsConfig(): array
{
return $this->columns ?? $this->getContainer()->getColumnsConfig();
}
}