Laravel-modules: when making the module there is no folder for models

Created on 28 Dec 2016  路  12Comments  路  Source: nWidart/laravel-modules

when making the module there is no folder for models

where models put on this item?

I put the model to make a new directory in
Module/Auth/Models/Auth.php

maybe next update so you generate a model automatically when running the command

php artisan module: make modname

Most helpful comment

The model directory is called Entities by default. This can be changed in the configuration.

All 12 comments

Default path for models is Modules/ModuleName/Entities

You can generate models by using php artisan module:make-model [model] [module] command

@ridwanskaterock check wiki docs and artisan commands before create issues!!

@ercanertan you need to chill. he was asking a question.

Hi, How can I use a model ? For example I have a module : Gallery and a model ( Modules/Gallery/Entities/GalleryCategories When I can type Use Modules/Gallery/Entities/GalleryCategories => Class 'Modules\Gallery\Entities\GalleryCategories' not found

@macikgoz25 have you added modules directory to composer.json and executed dump-autoload?
```{
"autoload": {
"psr-4": {
"App\": "app/",
"Modules\": "Modules/"
}
}
}

The model directory is called Entities by default. This can be changed in the configuration.

when I run php artisan module:make-model Panel
I have this error
Nwidart\Modules\Exceptions\ModuleNotFoundException : Module [] does not exist!

at C:\Users\ASUS\Desktop\laravel\blog\vendor\nwidart\laravel-modules\src\FileRepository.php:396

could u help me please

Use php artisan module:make-model --help, you will see there are 2 arguments, module name and model name.

Wooow...thank u very much..it is working

Awesome :)

php artisan module:make-model CategoryModel Category

If you have a Module called Category and if you want to create a model named CategoryModel

N.B: I just used Model to show the difference. You can use

php artisan module:make-model Category Category

You will find your Model in Entities folder.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

n4p4 picture n4p4  路  17Comments

cristiangervasi picture cristiangervasi  路  12Comments

themodernpk picture themodernpk  路  10Comments

FoksVHox picture FoksVHox  路  11Comments

uncodable picture uncodable  路  21Comments