Skip to content

Commit 90a7566

Browse files
committed
prevent overwrite existing views running make:auth #18309
1 parent b5e8c73 commit 90a7566

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/Illuminate/Auth/Console/MakeAuthCommand.php

+10-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ class MakeAuthCommand extends Command
1414
*
1515
* @var string
1616
*/
17-
protected $signature = 'make:auth {--views : Only scaffold the authentication views}';
17+
protected $signature = 'make:auth
18+
{--views : Only scaffold the authentication views}
19+
{--force : Overwrite existing views by default}';
1820

1921
/**
2022
* The console command description.
@@ -88,6 +90,13 @@ protected function createDirectories()
8890
protected function exportViews()
8991
{
9092
foreach ($this->views as $key => $value) {
93+
94+
if (!$this->option('force') && file_exists(resource_path('views/'.$value))) {
95+
if (!$this->confirm('The view '.$value.' already exists, Do you wish overwrite it?')) {
96+
continue;
97+
}
98+
}
99+
91100
copy(
92101
__DIR__.'/stubs/make/views/'.$key,
93102
resource_path('views/'.$value)

0 commit comments

Comments
 (0)