Skip to content

Commit

Permalink
Use paths from object property, not local variable (#95)
Browse files Browse the repository at this point in the history
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' );
        } );
    }
}
```
  • Loading branch information
bookwyrm authored Mar 6, 2024
1 parent 8f4bbbd commit e5316b4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/MountedDirectories.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

/**
Expand Down

0 comments on commit e5316b4

Please sign in to comment.