@@ -941,7 +941,7 @@ public function createCommand($location = '', $commandName = '', $defaultCommand
941941 return ;
942942 }
943943 }
944-
944+
945945 /**
946946 * Create A Non Module Command
947947 *
@@ -1098,7 +1098,7 @@ public function createNonModuleController($controllerName = '', $addController =
10981098 * @param string $location
10991099 * @return void
11001100 */
1101- public function createNonModuleModel ($ modelName = '' , $ modelType = '--easy ' , $ removeModel = '' , $ location = 'App/ Models ' )
1101+ public function createNonModuleModel ($ modelName = '' , $ modelType = '--easy ' , $ removeModel = '' , $ location = 'Models ' )
11021102 {
11031103
11041104 $ created = '' ;
@@ -1107,6 +1107,17 @@ public function createNonModuleModel($modelName = '', $modelType = '--easy', $re
11071107
11081108 $ this ->model = 'Models ' ;
11091109 $ this ->namespace = $ namespace ;
1110+
1111+ if ($ removeModel == '--dir ' && $ location != 'Models ' ) {
1112+ $ location = str_replace ('_ ' , ' ' , $ location );
1113+ $ location = ucwords ($ location );
1114+ $ location = str_replace (' ' , '/ ' , $ location );
1115+
1116+ $ this ->model = 'Models ' .DS . $ location ;
1117+ $ this ->namespace = 'App \\' . str_replace ('/ ' , '\\' , $ this ->model );
1118+ $ location = $ this ->model ;
1119+ }
1120+
11101121 $ modelDirectory = $ this ->createAppRootDirectory ($ this ->model );
11111122
11121123 if ($ removeModel == '--remove-model ' ) {
@@ -1115,11 +1126,15 @@ public function createNonModuleModel($modelName = '', $modelType = '--easy', $re
11151126 $ modelName = Inflector::singularize ($ modelName ) . 'Model ' ;
11161127 }
11171128
1129+ $ location = 'App/ ' . ucwords ($ location );
1130+
11181131 if (file_exists ($ modelDirectory . DS . $ modelName . $ this ->fileExtention )) {
11191132 $ this ->failureOutput (ucfirst ($ modelName ) . " exists already in the " . $ location . " directory " );
11201133 return ;
11211134 }
11221135
1136+ $ this ->model = 'Models ' ;
1137+
11231138 if ($ modelDirectory && is_dir ($ modelDirectory )) {
11241139 $ filePath = $ modelDirectory . DS . $ modelName ;
11251140 $ modelType = str_replace ('- ' , '' , $ modelType );
0 commit comments