@@ -47,25 +47,25 @@ class PageControllerBackpackCommand extends GeneratorCommand
4747 public function handle ()
4848 {
4949 $ name = $ this ->getNameInput ();
50- $ this ->progressBlock ("Creating controller <fg=blue> $ {name}Controller</> " );
50+ $ class = $ this ->qualifyClass ($ name );
51+ $ fullPath = $ this ->getPath ($ class );
52+ $ path = Str::of ($ fullPath )->after (base_path ())->trim ('\\/ ' );
5153
52- if ($ this ->isReservedName ($ this ->getNameInput ())) {
54+ $ this ->progressBlock ("Creating controller <fg=blue> {$ path }</> " );
55+
56+ if ($ this ->isReservedName ($ name )) {
5357 $ this ->errorProgressBlock ();
5458 $ this ->note ("The name ' $ name' is reserved by PHP. " , 'red ' );
5559
5660 return false ;
5761 }
5862
59- $ name = $ this ->qualifyClass ($ this ->getNameInput ());
60-
61- $ path = $ this ->getPath ($ name );
62-
6363 // Next, We will check to see if the class already exists. If it does, we don't want
6464 // to create the class and overwrite the user's code. So, we will bail out so the
6565 // code is untouched. Otherwise, we will continue generating this class' files.
6666 if ((! $ this ->hasOption ('force ' ) ||
6767 ! $ this ->option ('force ' )) &&
68- $ this ->alreadyExists ($ this -> getNameInput () )) {
68+ $ this ->alreadyExists ($ class )) {
6969 $ this ->closeProgressBlock ('Already existed ' , 'yellow ' );
7070
7171 return false ;
@@ -74,9 +74,9 @@ public function handle()
7474 // Next, we will generate the path to the location where this class' file should get
7575 // written. Then, we will build the class and make the proper replacements on the
7676 // stub files so that it gets the correctly formatted namespace and class name.
77- $ this ->makeDirectory ($ path );
77+ $ this ->makeDirectory ($ fullPath );
7878
79- $ this ->files ->put ($ path , $ this ->sortImports ($ this ->buildClass ($ name )));
79+ $ this ->files ->put ($ fullPath , $ this ->sortImports ($ this ->buildClass ($ class )));
8080
8181 $ this ->closeProgressBlock ();
8282 }
0 commit comments