@@ -26,40 +26,45 @@ public function initPaths(CodeStructure $codeStructure, string $path, bool $isGe
2626 {
2727 $ genPath = $ isGenerationDir ? base_path ($ path ) : '' ;
2828
29+ $ namespace = implode ('/ ' , array_map (
30+ fn ($ dir ) => str ($ dir )->camel ()->ucfirst ()->value (),
31+ explode ("/ " , $ path )
32+ ));
33+
2934 $ this
3035 ->setPath (
3136 new ModelPath (
3237 $ codeStructure ->entity ()->ucFirstSingular () . '.php ' ,
3338 $ genPath ? $ genPath . "/Models " : app_path ('Models ' ),
34- $ genPath ? ' App \\' . str_replace ('/ ' , '\\' , $ path ) . '\\Models ' : 'App \\Models '
39+ $ genPath ? str_replace ('/ ' , '\\' , $ namespace ) . '\\Models ' : 'App \\Models '
3540 )
3641 )
3742 ->setPath (
3843 new AddActionPath (
3944 'Add ' . $ codeStructure ->entity ()->ucFirstSingular () . 'Action.php ' ,
4045 $ genPath ? $ genPath . "/Actions " : app_path ('Actions ' ),
41- $ genPath ? ' App \\' . str_replace ('/ ' , '\\' , $ path ) . '\\Actions ' : 'App \\Actions '
46+ $ genPath ? str_replace ('/ ' , '\\' , $ namespace ) . '\\Actions ' : 'App \\Actions '
4247 )
4348 )
4449 ->setPath (
4550 new EditActionPath (
4651 'Edit ' . $ codeStructure ->entity ()->ucFirstSingular () . 'Action.php ' ,
4752 $ genPath ? $ genPath . "/Actions " : app_path ('Actions ' ),
48- $ genPath ? ' App \\' . str_replace ('/ ' , '\\' , $ path ) . '\\Actions ' : 'App \\Actions '
53+ $ genPath ? str_replace ('/ ' , '\\' , $ namespace ) . '\\Actions ' : 'App \\Actions '
4954 )
5055 )
5156 ->setPath (
5257 new RequestPath (
5358 $ codeStructure ->entity ()->ucFirstSingular () . 'Request.php ' ,
5459 $ genPath ? $ genPath . "/Http/Requests " : app_path ('Http/Requests ' ),
55- $ genPath ? ' App \\' . str_replace ('/ ' , '\\' , $ path ) . '\\Http \\Requests ' : 'App \\Http \\Requests '
60+ $ genPath ? str_replace ('/ ' , '\\' , $ namespace ) . '\\Http \\Requests ' : 'App \\Http \\Requests '
5661 )
5762 )
5863 ->setPath (
5964 new ControllerPath (
6065 $ codeStructure ->entity ()->ucFirstSingular () . 'Controller.php ' ,
6166 $ genPath ? $ genPath . "/Http/Controllers " : app_path ('Http/Controllers ' ),
62- $ genPath ? ' App \\' . str_replace ('/ ' , '\\' , $ path ) . '\\Http \\Controllers ' : 'App \\Http \\Controllers '
67+ $ genPath ? str_replace ('/ ' , '\\' , $ namespace ) . '\\Http \\Controllers ' : 'App \\Http \\Controllers '
6368 )
6469 )
6570 ->setPath (
@@ -80,7 +85,7 @@ public function initPaths(CodeStructure $codeStructure, string $path, bool $isGe
8085 new DTOPath (
8186 $ codeStructure ->entity ()->ucFirstSingular () . 'DTO.php ' ,
8287 $ genPath ? $ genPath . "/DTO " : app_path ('DTO ' ),
83- $ genPath ? ' App \\' . str_replace ('/ ' , '\\' , $ path ) . '\\DTOs ' : 'App \\DTOs '
88+ $ genPath ? str_replace ('/ ' , '\\' , $ namespace ) . '\\DTO ' : 'App \\DTO '
8489 )
8590 )
8691 ;
0 commit comments