nWidart / laravel-modules

Module Management In Laravel
https://docs.laravelmodules.com
MIT License
5.57k stars 970 forks source link

Nwidart\Modules\Module::getExtraPath(): #1974

Closed monte-dev closed 2 weeks ago

monte-dev commented 3 weeks ago

Versions:

Description:

Hi

Im having an issue as on attached picture and code. It occurs when running pretty much any artisan or composer command in the repo. There doesn't seem to be a null passed to the method. image

TypeError Nwidart\Modules\Module::getExtraPath(): Argument #1 ($path) must be of type string, null given, called in /mnt/c/Users/******/***/vendor/nwidart/laravel-modules/src/LaravelModulesServiceProvider.php on line 130 at vendor/nwidart/laravel-modules/src/Module.php:385 381▕ 382▕ /** 383▕ * Get extra path. 384▕ */ ➜ 385▕ public function getExtraPath(string $path): string 386▕ { 387▕ return $this->getPath().'/'.$path; 388▕ } 389 ` 17 vendor frames 18 Modules/Downloads/app/Providers/RouteServiceProvider.php:47

19 Modules/Downloads/app/Providers/RouteServiceProvider.php:25 Modules\Downloads\Providers\RouteServiceProvider::mapApiRoutes() attached also the RouteServiceProviderFile that apparently issue occurs in `<?php namespace Modules\Downloads\Providers; use Illuminate\Support\Facades\Route; use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;

class RouteServiceProvider extends ServiceProvider {

public function boot(): void
{
    parent::boot();
}

public function map(): void
{
    $this->mapApiRoutes();

    // $this->mapWebRoutes();
}

// protected function mapWebRoutes(): void
// {
//     Route::middleware('web')->group(module_path('Downloads', '/Routes/web.php'));
// }

protected function mapApiRoutes(): void
{
    Route::middleware('api')->prefix('api')->name('api.')->group(module_path('Downloads', '/routes/api.php'));
} `

Steps To Reproduce:

Not sure what caused it.

dcblogdev commented 2 weeks ago

thanks for reporting, I've applied a fix for this https://github.com/nWidart/laravel-modules/pull/1980 will be released shortly.