10
10
use Filament \Support \Assets \Asset ;
11
11
use Filament \Support \Facades \FilamentAsset ;
12
12
use Filament \Support \Facades \FilamentView ;
13
+ use Filament \View \PanelsRenderHook ;
13
14
use Illuminate \Filesystem \Filesystem ;
14
15
use Illuminate \Support \Facades \Blade ;
15
16
use Livewire \Features \SupportTesting \Testable ;
16
17
use Livewire \Livewire ;
18
+ use ReflectionException ;
17
19
use Spatie \LaravelPackageTools \Package ;
18
20
use Spatie \LaravelPackageTools \PackageServiceProvider ;
19
21
@@ -34,35 +36,38 @@ public function configurePackage(Package $package): void
34
36
35
37
public function packageRegistered (): void {}
36
38
39
+ /**
40
+ * @throws ReflectionException
41
+ */
37
42
public function packageBooted (): void
38
43
{
39
- // Asset Registration
40
44
FilamentAsset::register (
41
45
$ this ->getAssets (),
42
46
$ this ->getAssetPackageName ()
43
47
);
44
48
45
- // Handle Stubs
46
49
if (app ()->runningInConsole ()) {
47
- foreach (app (Filesystem::class)->files (__DIR__ . '/../stubs/ ' ) as $ file ) {
50
+ foreach (app (abstract: Filesystem::class)->files (directory: __DIR__ . '/../stubs/ ' ) as $ file ) {
48
51
$ this ->publishes ([
49
- $ file ->getRealPath () => base_path ("stubs/mason/ {$ file ->getFilename ()}" ),
50
- ], 'mason-stubs ' );
52
+ $ file ->getRealPath () => base_path (path: "stubs/mason/ {$ file ->getFilename ()}" ),
53
+ ], groups: 'mason-stubs ' );
51
54
}
52
55
}
53
56
54
- Blade::directive ('mason ' , fn ($ expression ) => "<?php echo (new Awcodes\Mason\Support\Converter( {$ expression }))->toHtml(); ?> " );
57
+ Blade::directive (
58
+ name: 'mason ' ,
59
+ handler: fn ($ expression ) => "<?php echo (new Awcodes\Mason\Support\Converter( {$ expression }))->toHtml(); ?> "
60
+ );
55
61
56
- Livewire::component ('mason.renderer ' , Renderer::class);
62
+ Livewire::component (name: 'mason.renderer ' , class: Renderer::class);
57
63
58
64
if (! Helpers::isAuthRoute ()) {
59
65
FilamentView::registerRenderHook (
60
- name: ' panels::body.end ' ,
61
- hook: fn (): string => Blade::render ('@livewire("mason.renderer") ' )
66
+ name: PanelsRenderHook:: BODY_END ,
67
+ hook: fn (): string => Blade::render (string: '@livewire("mason.renderer") ' )
62
68
);
63
69
}
64
70
65
- // Testing
66
71
Testable::mixin (new TestsMason );
67
72
}
68
73
@@ -77,7 +82,7 @@ protected function getAssetPackageName(): ?string
77
82
protected function getAssets (): array
78
83
{
79
84
return [
80
- AlpineComponent::make ('mason ' , __DIR__ . '/../resources/dist/mason.js ' ),
85
+ AlpineComponent::make (id: 'mason ' , path: __DIR__ . '/../resources/dist/mason.js ' ),
81
86
];
82
87
}
83
88
}
0 commit comments