@@ -26,32 +26,28 @@ public function __construct(ScaffoldMakeCommand $scaffoldCommand, Filesystem $fi
2626
2727 protected function start ()
2828 {
29-
30- if ($ this ->files ->exists ($ path_resource = $ this ->getPathResource ())) {
31- if ($ this ->scaffoldCommandObj ->confirm ($ path_resource . ' already exists! Do you wish to overwrite? [yes|no] ' )) {
32- $ this ->putViewLayout ($ path_resource );
33-
34- $ this ->scaffoldCommandObj ->info ('Layout created successfully. ' );
35- } else {
36- $ this ->scaffoldCommandObj ->comment ('Skip Layout, because already exists. ' );
37- }
38- } else {
39- $ this ->putViewLayout ($ path_resource );
40- }
41-
42-
29+ $ this ->putViewLayout ('Layout ' , 'stubs/html_assets/layout.stub ' , 'layout.blade.php ' );
30+ $ this ->putViewLayout ('Error ' , 'stubs/html_assets/error.stub ' , 'error.blade.php ' );
4331 }
4432
4533
4634 /**
4735 * @param $path_resource
4836 * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
4937 */
50- protected function putViewLayout ($ path_resource )
38+ protected function putViewLayout ($ name , $ stub , $ file )
5139 {
52- // Copy layout blade bootstrap 3 to resoures
53- $ layout_html = $ this ->files ->get (__DIR__ . '/../stubs/html_assets/layout.stub ' );
54- $ this ->files ->put ($ path_resource , $ layout_html );
40+ $ path_file = $ this ->getPathResource ().$ file ;
41+ $ path_stub = __DIR__ .'/../ ' .$ stub ;
42+
43+ if (!$ this ->files ->exists ($ path_file )){
44+ $ html = $ this ->files ->get ($ path_stub );
45+ $ this ->files ->put ($ path_file , $ html );
46+
47+ $ this ->scaffoldCommandObj ->info ("$ name created successfully. " );
48+ }else {
49+ $ this ->scaffoldCommandObj ->comment ("Skip $ name, because already exists. " );
50+ }
5551 }
5652
5753
@@ -63,8 +59,6 @@ protected function putViewLayout($path_resource)
6359 */
6460 protected function getPathResource ()
6561 {
66-
67- return './resources/views/layout.blade.php ' ;
68-
62+ return './resources/views/ ' ;
6963 }
7064}
0 commit comments