Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Livewire Component wrong view path #85

Open
Filefabrik opened this issue Mar 29, 2024 · 1 comment
Open

Livewire Component wrong view path #85

Filefabrik opened this issue Mar 29, 2024 · 1 comment

Comments

@Filefabrik
Copy link

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
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant