nWidart / laravel-modules

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

How to move the Modules folder under App? #1323

Closed perffy closed 2 years ago

perffy commented 2 years ago

Hi guys,

I am using Laravel 8.49.2 version. My goal is to have all Modules under App folder.

Here it is how my composer.json looks like:

    "autoload": {
        "psr-4": {
            "App\\": "app/",
            "Modules\\": "app/Modules/",
            "Database\\Factories\\": "database/factories/",
            "Database\\Seeders\\": "database/seeders/"
        }
    },

and here is some part of the config/modules.php:

'namespace' => 'App\Modules',
'paths' => [
        'modules' => 'app/Modules',
        ....
]

By calling artisan it works fine, unfortunately, the routes and the views don't work. I have placed the route in the default web.php and then I can open the URL, but then it cannot find the view. It comes to the following error:

No hint path defined for [publication].

What I am doing wrong?

m-mohammadi1 commented 2 years ago

Maybe your problem is with service provider of module add module service provider to the main list maybe it work!

perffy commented 2 years ago

Maybe your problem is with service provider of module add module service provider to the main list maybe it work!

Do you mean to include my module service provider in the config/app.php? I did that, but then i got this error: "Call to a member function getPath() on null"

m-mohammadi1 commented 2 years ago

Actually there is an easy way to do that just public configuration of the package(Laravel-modular) and in my case it is in line 73 modules' => base_path('Modules') as you can see this is the path you can edit and customize it.

perffy commented 2 years ago

Thank you @luckyboy1001 it was the base_path()

I dont know why i have removed it, but that was causing the problem :)

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.