Closed devhus closed 3 years ago
this package not work with php artisan module:make Store\Product
Please use php artisan module:make Product
if You want create package Product inside folder Store, please config
'paths' => [
/*
|--------------------------------------------------------------------------
| Modules path
|--------------------------------------------------------------------------
|
| This path used for save the generated module. This path also will be added
| automatically to list of scanned folders.
|
*/
'modules' => base_path('Modules'), // change to base_path('Modules/Store')
or change scan config
'scan' => [
'enabled' => false,
'paths' => [
base_path('vendor/*/*'),
],
],
or register autoload to Modules/Store
this package not work with
php artisan module:make Store\Product
Please usephp artisan module:make Product
if You want create package Product inside folder Store, please config'paths' => [ /* |-------------------------------------------------------------------------- | Modules path |-------------------------------------------------------------------------- | | This path used for save the generated module. This path also will be added | automatically to list of scanned folders. | */ 'modules' => base_path('Modules'), // change to base_path('Modules/Store')
i don't want to change the Modules path, I just want to add some modules in system-based folders and namespace
or change scan config
'scan' => [ 'enabled' => false, 'paths' => [ base_path('vendor/*/*'), ], ],
or register autoload to Modules/Store
will that allow me to add \Store
in the namespace or it will just look for Modules\Product
instead of having \Modules\Store\Product
?
or change scan config
'scan' => [ 'enabled' => false, 'paths' => [ base_path('vendor/*/*'), ], ],
or register autoload to Modules/Store
will that allow me to add
\Store
in the namespace or it will just look forModules\Product
instead of having\Modules\Store\Product
?
You can try,
'scan' => [
'enabled' => true,
'paths' => [
base_path('Modules/*/*'),
],
],
It will scan package insilde Modules/Store/Product
Default laravel-packages only scan package inside Modules folder
You can try,
'scan' => [ 'enabled' => true, 'paths' => [ base_path('Modules/*/*'), ], ],
It will scan package insilde Modules/Store/Product
Default laravel-packages only scan package inside Modules folder
I have tried adding it to the scan config, but still not able to use php artisan module:make Store/Product
I only can create php artisan module:make Product
and move it into the Store folder but this not just enough since the Product module's classes namespace will remain as Modules\Product\Http\Controllers\ProductController
instead of having Modules\Store\Product\Http\Controllers\ProductController
which is what is needed to be. Renaming the namespace in the module's files manually should not be an option at a 2021 package.
Adding a module in the folder without having the folder name in the classes namespace is not a good code structure
why you not rename Modules to Store and put Prodcut inside Store
why you not rename Modules to Store and put Prodcut inside Store
Renaming the namespace in the module's files manually should not be an option at a 2021 package.
No no, rename folder Modules to Store and config namespace and Modules path
<?php
use Nwidart\Modules\Activators\FileActivator;
use Nwidart\Modules\Commands;
return [
/*
|--------------------------------------------------------------------------
| Module Namespace
|--------------------------------------------------------------------------
|
| Default module namespace.
|
*/
'namespace' => 'Store',
'paths' => [
/*
|--------------------------------------------------------------------------
| Modules path
|--------------------------------------------------------------------------
|
| This path used for save the generated module. This path also will be added
| automatically to list of scanned folders.
|
*/
'modules' => base_path('Store'),
when you run php artisan module:make Product
, It will create Package Product with namespace is Store/Product inside folder Store
No no, rename folder Modules to Store and config namespace and Modules path
<?php use Nwidart\Modules\Activators\FileActivator; use Nwidart\Modules\Commands; return [ /* |-------------------------------------------------------------------------- | Module Namespace |-------------------------------------------------------------------------- | | Default module namespace. | */ 'namespace' => 'Store', 'paths' => [ /* |-------------------------------------------------------------------------- | Modules path |-------------------------------------------------------------------------- | | This path used for save the generated module. This path also will be added | automatically to list of scanned folders. | */ 'modules' => base_path('Store'),
when you run
php artisan module:make Product
, It will create Package Product with namespace is Store/Product inside folder Store
as i said i don't want to change the modules base path, since there will be other system-based folders this is not a good idea
--- Modules
----- User
----- Account
----- Comment
----- Store
------- Category
------- Product
------- Option
----- Courses
------- Course
------- Registration
your solution doesn't work with the example of the paths above since your solution is just replacing Modules
with Store
but nothing has really changed
First of all this method does not exist php artisan module:make Store\Product
One solution is to create a command and do the necessary logic required to implement it.
The second solution is to create all files manually and register them in the service provider of the created module.
the third one is to pass it subfolder I don't know if it is what you need example:
php artisan module:make-controller Product/ProductController Store will result in the main module Store subfolder Product inside will be your controller, php artisan module:make-model Product/Product Store
will have result Main module Store subfolder Product inside will be your Model, check the documentation of the web or pass helper help in your terminal to see the commands and how they work. What you want to do can not be done you must do well first step or second step reviewing its structure as you want to have it would be something like this. https://nwidart.com/laravel-modules/v6/advanced-tools/artisan-commands --- Modules ----- User ----- Account ----- Comment ----- Store Main Module ------- Category don't create subfolder the correct thing would be model and controller I will attach image ------- Product ------- Option ----- Courses ------- Course ------- Registration
First of all this method does not exist php artisan module:make Store\Product
One solution is to create a command and do the necessary logic required to implement it.
The second solution is to create all files manually and register them in the service provider of the created module.
the third one is to pass it subfolder I don't know if it is what you need example:
php artisan module:make-controller Product/ProductController Store will result in the main module Store subfolder Product inside will be your controller, php artisan module:make-model Product/Product Store
will have result Main module Store subfolder Product inside will be your Model, check the documentation of the web or pass helper help in your terminal to see the commands and how they work. What you want to do can not be done you must do well first step or second step reviewing its structure as you want to have it would be something like this. https://nwidart.com/laravel-modules/v6/advanced-tools/artisan-commands --- Modules ----- User ----- Account ----- Comment ----- Store Main Module ------- Category don't create subfolder the correct thing would be model and controller I will attach image ------- Product ------- Option ----- Courses ------- Course ------- Registration
I think the method should be created and give the ability to create submodules inside a module, it will be much better than having a whole project(e-commerce) logic inside one module. It can't be called a modular app if each module includes 50% of the website logic. So if it is not a bug could be a feature request?
I would recommend you to make Pull requests, and that you add that functionality to the package, but as I said before you must make a function to create sub folders and the necessary command for terminal.
I recommend you to see asgard https://github.com/AsgardCms/Platform
I would recommend you to make Pull requests, and that you add that functionality to the package, but as I said before you must make a function to create sub folders and the necessary command for terminal.
I recommend you to see asgard https://github.com/AsgardCms/Platform
might do it after i finish up my current project, thx for the tips
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.
Hello, I don't know if this is a bug or that's how it should be. I want to have my modules to be created in subfolders with the folder names in the module's classes namespace. But when trying to create a module within a subfolder
php artisan module:make Store\Product
it will throw this error: