InterNACHI / modular

Modularize your Laravel application
MIT License
764 stars 64 forks source link

Livewire Component wrong view path #85

Open Filefabrik opened 6 months ago

Filefabrik commented 6 months ago

module called counter livewire component inside the module called klicker

<?php

namespace MyNamespace\Counter\Livewire;

use Livewire\Component;

class Klicker3 extends Component
{
    public function render()
    {
# wrong, came from livewire 
# vendor/livewire/livewire/src/Features/SupportConsoleCommands/Commands/ComponentParser.php:132
# replace the following....
        return view('var.www.html.app-modules.counter.resources.views.livewire.klicker3');

#....with view('your-module-name::livewire.klicker'); 
        return view('counter::livewire.klicker');
    }
}

to solve for now the

vendor/livewire/livewire/src/Features/SupportConsoleCommands/Commands/ComponentParser.php:132

 public function viewName()
    {
        return collect()
            ->when(config('livewire.view_path') !== resource_path(), function ($collection) {
                return $collection->concat(explode('/',str($this->baseViewPath)->after(resource_path('views'))));
            })
            ->filter()
            ->concat($this->directories)
            ->map([Str::class, 'kebab'])
            ->push($this->component)
            ->implode('.');
    }
Filefabrik commented 6 months ago

Fixed in https://github.com/Filefabrik/modular/tree/3.0.4