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

Module "Admin" not found in this path #17

Closed fakharak closed 2 years ago

fakharak commented 3 years ago

Please, also see the image attached.

My project root folder is "g-modules", inside "g-modules" i have (nWidart) "Modules" folder, and inside that i have "Admin" module where i want to create /work Live-wire Search. So, path is g-modules/Modules/Admin. However, as per instructions, i am installing the package from root of project "g-modules/" and also publish config which publishes configuration file in the root's /config/ folder.

Now when i try to create module using given command (as shown in image), i get Module "Admin" not found in this path.

live_wire_issue

mhmiton commented 3 years ago

Can you share your modules-livewire.php config file, please?

fakharak commented 3 years ago

Can you share your modules-livewire.php config file, please?

I made it work by configuring custom_modules array in modules-livewire.php like this

    'custom_modules' => [
         'Admin' => [
             'path' => base_path('../Modules'),
             'module_namespace' => 'Modules\\Admin',
             'namespace' => 'Admin\\Http\\Livewire',
             'view' => 'Admin/Resources/views/livewire',
             'name_lower' => 'admin',
         ],
     ],
 Then used the command which worked like charm

 `php artisan module:make-livewire [MainFunctionName/LiveWireComponentName] [ModuleName] --force`

 May be that can be helpful for someone who visits here, so please elaborate this procedure on main ReadMe, if possible. Great thanks for taking time to help.
mhmiton commented 3 years ago

Maybe the base path should be changed to base_path('Modules/Admin') and in composer.json file should be configured autoload for the Modules\\Admin namespace.

Please check this example project - https://github.com/mhmiton/laravel-modules-livewire-example. I added a custom Chat module. Hope it will be helpful for you.