diff --git a/src/Illuminate/Foundation/Console/ViewMakeCommand.php b/src/Illuminate/Foundation/Console/ViewMakeCommand.php index 49899312c65d..f35130603ade 100644 --- a/src/Illuminate/Foundation/Console/ViewMakeCommand.php +++ b/src/Illuminate/Foundation/Console/ViewMakeCommand.php @@ -47,11 +47,15 @@ class ViewMakeCommand extends GeneratorCommand protected function buildClass($name) { $contents = parent::buildClass($name); + $layout = $this->option('layout'); + + $replace = [ + '{{ layout }}' => $layout ? "@extends('{$layout}')\n\n" : null, + '{{ quote }}' => Inspiring::quotes()->random() + ]; return str_replace( - '{{ quote }}', - Inspiring::quotes()->random(), - $contents, + array_keys($replace), array_values($replace), $contents ); } @@ -229,6 +233,7 @@ protected function testViewName() protected function getOptions() { return [ + ['layout', null, InputOption::VALUE_OPTIONAL, 'The parent of the generated view', null], ['extension', null, InputOption::VALUE_OPTIONAL, 'The extension of the generated view', 'blade.php'], ['force', 'f', InputOption::VALUE_NONE, 'Create the view even if the view already exists'], ]; diff --git a/src/Illuminate/Foundation/Console/stubs/view.stub b/src/Illuminate/Foundation/Console/stubs/view.stub index 6ecd80c26413..c26f3d58743b 100644 --- a/src/Illuminate/Foundation/Console/stubs/view.stub +++ b/src/Illuminate/Foundation/Console/stubs/view.stub @@ -1,3 +1,3 @@ -