@@ -64,7 +64,7 @@ public function handle()
6464
6565 $ this ->infoBlock ("Creating {$ name ->replace ('_ ' , ' ' )->title ()} page " );
6666
67- $ this ->progressBlock ("Creating view <fg=blue>resources/views/ $ {filePath}.php</> " );
67+ $ this ->progressBlock ("Creating view <fg=blue>resources/views/ $ {filePath}.blade. php</> " );
6868
6969 // check if the file already exists
7070 if ((! $ this ->hasOption ('force ' ) || ! $ this ->option ('force ' )) && $ this ->alreadyExists ($ filePath )) {
@@ -78,11 +78,14 @@ public function handle()
7878 // create page view
7979 $ stub = $ this ->buildClass ($ filePath );
8080 $ stub = str_replace ('layout ' , $ layout , $ stub );
81- $ stub = str_replace ('DummyName ' , $ name ->studly (), $ stub );
81+ $ stub = str_replace ('Dummy Name ' , $ name ->replace ( ' _ ' , ' ' )-> title (), $ stub );
8282 $ this ->files ->put ($ fullpath , $ stub );
8383
8484 $ this ->closeProgressBlock ();
8585
86+ // Clean up name
87+ $ name = $ name ->replace ('_ ' , ' ' )->replace ('- ' , ' ' )->title ();
88+
8689 // create controller
8790 $ this ->call ('backpack:page-controller ' , [
8891 'name ' => $ name ,
@@ -96,13 +99,13 @@ public function handle()
9699
97100 // create the sidebar item
98101 $ this ->call ('backpack:add-sidebar-content ' , [
99- 'code ' => "<li class= \"nav-item \"><a class= \"nav-link \" href= \"{{ backpack_url(' {$ name ->kebab ()}') }} \"><i class= \"nav-icon la la-question \"></i> {$ name-> title () }</a></li> " ,
102+ 'code ' => "<li class= \"nav-item \"><a class= \"nav-link \" href= \"{{ backpack_url(' {$ name ->kebab ()}') }} \"><i class= \"nav-icon la la-question \"></i> {$ name }</a></li> " ,
100103 ]);
101104
102105 $ url = Str::of (config ('app.url ' ))->finish ('/ ' )->append ("admin/ {$ name ->kebab ()}" );
103106
104107 $ this ->newLine ();
105- $ this ->note ("Page {$ name-> title () } created. " );
108+ $ this ->note ("Page {$ name } created. " );
106109 $ this ->note ("Go to <fg=blue> $ url</> to access your new page. " );
107110 $ this ->newLine ();
108111 }
0 commit comments