Skip to content

Commit cab2a69

Browse files
committed
fix: set plugin attributes in constructor
1 parent 53c8021 commit cab2a69

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

src/Foundation/Plugins/Plugin.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,23 @@ abstract class Plugin implements \Filament\Contracts\Plugin
2323
*/
2424
protected string $id;
2525

26-
/**
27-
* Register any plugin services.
28-
*
29-
* @throws \Exception
30-
*/
31-
public function register(Panel $panel): void
26+
public function __construct()
3227
{
3328
$reflection = new ReflectionClass(static::class);
3429

3530
// Auto-detect plugin attributes
3631
$this->basePath = dirname($reflection->getFileName(), 2);
3732
$this->pluginNamespace = $reflection->getNamespaceName();
3833
$this->id = Str::of($this->pluginNamespace)->replace('\\', '-')->lower();
34+
}
3935

36+
/**
37+
* Register any plugin services.
38+
*
39+
* @throws \Exception
40+
*/
41+
public function register(Panel $panel): void
42+
{
4043
$panelName = ucfirst($panel->getId());
4144

4245
// Discover all classes, even if directories do not exists — Filament already checks and skips those

0 commit comments

Comments
 (0)