File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -403,8 +403,10 @@ protected static function createController(...$args)
403403 {
404404 $ module = $ args [0 ];
405405 $ controllerName = '' ;
406+ $ location = "Controllers " ;
407+ $ lastArg = $ args [2 ];
406408
407- $ nonModuleController = str_contains ($ args [ 0 ] , '--name ' );
409+ $ nonModuleController = str_contains ($ module , '--name ' );
408410
409411 if ($ nonModuleController ) {
410412 $ args [2 ] = $ args [1 ];
@@ -431,8 +433,13 @@ protected static function createController(...$args)
431433 $ addController = $ args [2 ];
432434 }
433435
436+ if ($ args [2 ] == '--dir ' ) {
437+ $ location = $ lastArg ;
438+ }
439+
434440 if ($ nonModuleController ) {
435- $ command = Console::phpCommand () . 'create/createnonmodulecontroller/ ' . $ controllerName . '/ ' . $ addController ;
441+ $ location = str_replace ('/ ' ,'_ ' , $ location );
442+ $ command = Console::phpCommand () . 'create/createnonmodulecontroller/ ' . $ controllerName . '/ ' . $ addController . '/ ' . $ location ;
436443 static ::runSystemCommand ($ command );
437444 return ;
438445 }
Original file line number Diff line number Diff line change @@ -217,6 +217,17 @@ public function locate($segments)
217217 /* application sub-directory controller exists? */
218218 if ($ directory )
219219 {
220+
221+ /* controller exists in App/Controllers sub-sub-directory? */
222+ if ($ controller )
223+ {
224+ if (is_file (APPROOT .'Controllers/ ' .ucfirst ($ module ).'/ ' .ucfirst ($ directory ).'/ ' .ucfirst ($ controller ).$ ext ))
225+ {
226+ $ this ->directory = ucfirst ($ module ).'/ ' .ucfirst ($ directory ).'/ ' ;
227+ return array_slice ($ segments , 2 );
228+ }
229+ }
230+
220231 if (is_file (APPPATH .'controllers/ ' .$ module .'/ ' .ucfirst ($ directory ).$ ext ))
221232 {
222233 $ this ->directory = $ module .'/ ' ;
@@ -237,15 +248,16 @@ public function locate($segments)
237248 return array_slice ($ segments , 2 );
238249 }
239250 }
251+
240252 }
241253
242- /* app/Controllers controllers sub-directory exists? */
243- if (is_dir (APPROOT .'Controllers/ ' .ucfirst ($ module ).'/ ' ))
244- {
254+ /* controller exists in App/Controllers sub-directory? */
255+ if (is_dir (APPROOT . 'Controllers/ ' . ucfirst ($ module ) .'/ ' )) {
245256 $ this ->directory = ucfirst ($ module ).'/ ' ;
246257 return array_slice ($ segments , 1 );
247258 }
248259
260+ /* controller exists in App/Controllers exists? */
249261 if (is_file (APPROOT . 'Controllers/ ' . ucfirst ($ module ) . $ ext )) {
250262 return $ segments ;
251263 }
You can’t perform that action at this time.
0 commit comments