Skip to content

Livewire Component wrong view path #85

@Filefabrik

Description

@Filefabrik

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('.');
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions