Skip to content

Commit b3343ee

Browse files
committed
feat: add service provider and plugin class
1 parent 962fe4a commit b3343ee

File tree

4 files changed

+70
-1
lines changed

4 files changed

+70
-1
lines changed

composer.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
"pestphp/pest-plugin": true
2323
}
2424
},
25-
"minimum-stability": "stable",
25+
"minimum-stability": "dev",
26+
"prefer-stable": true,
2627
"autoload": {
2728
"psr-4": {
2829
"Eclipse\\PluginTemplate\\": "src/",
@@ -48,7 +49,15 @@
4849
"pestphp/pest-plugin-livewire": "^3.0"
4950
},
5051
"scripts": {
52+
"post-autoload-dump": "@php ./vendor/bin/testbench package:discover --ansi",
5153
"format": "vendor/bin/pint",
5254
"test": "vendor/bin/testbench package:test"
55+
},
56+
"extra": {
57+
"laravel": {
58+
"providers": [
59+
"Eclipse\\PluginTemplate\\PluginTemplateServiceProvider"
60+
]
61+
}
5362
}
5463
}

src/PluginTemplate.php

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
3+
namespace Eclipse\PluginTemplate;
4+
5+
use Filament\Contracts\Plugin;
6+
use Filament\Panel;
7+
8+
class PluginTemplate implements Plugin
9+
{
10+
public function getId(): string
11+
{
12+
return 'plugin-template';
13+
}
14+
15+
public function register(Panel $panel): void
16+
{
17+
//
18+
}
19+
20+
public function boot(Panel $panel): void
21+
{
22+
//
23+
}
24+
25+
public static function make(): static
26+
{
27+
return app(static::class);
28+
}
29+
30+
public static function get(): static
31+
{
32+
/** @var static $plugin */
33+
$plugin = filament(app(static::class)->getId());
34+
35+
return $plugin;
36+
}
37+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
namespace Eclipse\PluginTemplate;
4+
5+
use Spatie\LaravelPackageTools\Package;
6+
use Spatie\LaravelPackageTools\PackageServiceProvider;
7+
8+
class PluginTemplateServiceProvider extends PackageServiceProvider
9+
{
10+
public static string $name = 'plugin-template';
11+
12+
public function configurePackage(Package $package): void
13+
{
14+
$package->name(static::$name)
15+
->hasConfigFile()
16+
->hasTranslations();
17+
}
18+
}

testbench.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
workbench:
2+
# Do not run database migrations from the default skeleton
3+
install: false
4+
providers:
5+
- Eclipse\PluginTemplate\PluginTemplateServiceProvider

0 commit comments

Comments
 (0)