Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/Illuminate/Foundation/Console/ViewMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
}

Expand Down Expand Up @@ -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'],
];
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Foundation/Console/stubs/view.stub
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<div>
{{ layout }}<div>
<!-- {{ quote }} -->
</div>