orm icon indicating copy to clipboard operation
orm copied to clipboard

Change default Model directory when creating them with the `model` command

Open maicol07 opened this issue 3 years ago • 2 comments

Describe the feature as you'd like to see it Change default Model directory when creating them with the model command to app/Models Laravel docs reference: https://laravel.com/docs/9.x/eloquent#generating-model-classes

What do we currently have to do now? Currently models are generated in the app directory

  • [x] Is this a breaking change?

maicol07 avatar Jul 05 '22 19:07 maicol07

This would have to be done in the 3.x branch. Although not a breaking change it would be a change in behavior people probably wouldn't be expecting

josephmancuso avatar Jul 05 '22 19:07 josephmancuso

Looking at the issue again I'm going to make a way to just add a parameter to the MakeModelCommand.

MakeModelCommand(model_directory="app/models")

This way when people use the command they can set whatever defaults they need for their application. For Masonite we can probably do something like:

MakeModelCommand(model_directory=self.application.make("models.location"))

josephmancuso avatar Jul 20 '22 12:07 josephmancuso

or it can be done with a -d flag on the command line

josephmancuso avatar Sep 30 '23 17:09 josephmancuso