From e5316b4f3508f759d0da6dc736331720ba14b8bb Mon Sep 17 00:00:00 2001 From: Matt Vanderpol Date: Wed, 6 Mar 2024 12:38:22 -0800 Subject: [PATCH] Use paths from object property, not local variable (#95) Volt is already doing the work to save multiple component paths, we just need to use those saved paths when setting up the namespace. This provides support for easily adding paths to components in custom packages like: ```php use Illuminate\Support\ServiceProvider; use Livewire\Volt\Volt; class PackageServiceProvider extends ServiceProvider { /** * Bootstrap the application services. */ public function boot() { $this->app->booted( function() { Volt::mount( __DIR__.'/../resources/views/livewire' ); } ); } } ``` --- src/MountedDirectories.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MountedDirectories.php b/src/MountedDirectories.php index 58d33d9..5b5f0c9 100644 --- a/src/MountedDirectories.php +++ b/src/MountedDirectories.php @@ -29,7 +29,7 @@ public function mount(array|string $paths, array|string $uses = []): void $this->paths = array_merge($this->paths, $paths->all()); - View::replaceNamespace('volt-livewire', $paths->pluck('path')->all()); + View::replaceNamespace('volt-livewire', collect($this->paths)->pluck('path')->all()); } /**