mhmiton / laravel-modules-livewire

Using Laravel Livewire in Laravel Modules package with automatically registered livewire components for every modules.
MIT License
187 stars 34 forks source link

Routing Issue #2

Closed Uceef94 closed 3 years ago

Uceef94 commented 3 years ago

Hello, There is another issue when using the module's web route, included is a screenshot where I marked the path in yellow that should be removed in case livewire is used instead of a controller Route

mhmiton commented 3 years ago

Maybe this is a route namespace issue. Laravel 8 natively removed the route namespace. But in the modules package using route namespace. You should remove the route namespace from every module RouteServiceProvider. Try using this. Hope it will work.

RouteServiceProvider Path: Modules/Bank/Providers/RouteServiceProvider.php

protected function mapWebRoutes()
{
    Route::middleware('web')
        // ->namespace($this->moduleNamespace) // Removed For Livewire Route
        ->group(module_path('Bank', '/Routes/web.php'));
}

Also, I created a example repository with the Livewire route. You can check it.

Example Source Code: https://github.com/mhmiton/laravel-modules-livewire-example

Example Live Demo: https://dev.mhmiton.com/laravel-modules-livewire-example

Uceef94 commented 3 years ago

Thank you it did work!