长话短说,我搞砸了我的身份验证脚手架,想知道如何完全重置为基础脚手架。我试着删除文件,但是当我运行适当的工匠命令时,它没有重建脚手架。
问题是,我如何将脚手架重置到我刚刚运行"php artisan make:auth"命令的位置?
所以,由于您没有使用任何版本控制,那么跟踪更改或返回变得非常困难。但是你可以去/vendor/laravel/framework/src/Illuminate/Auth/Console/MakeAuthCommand.php
文件看看php artisan make:auth
做了什么改变和撤消了什么。
这是该文件的内容。
<?php
namespace Illuminate'Auth'Console;
use Illuminate'Console'Command;
use Illuminate'Console'AppNamespaceDetectorTrait;
class MakeAuthCommand extends Command
{
use AppNamespaceDetectorTrait;
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'make:auth {--views : Only scaffold the authentication views}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Scaffold basic login and registration views and routes';
/**
* The views that need to be exported.
*
* @var array
*/
protected $views = [
'auth/login.stub' => 'auth/login.blade.php',
'auth/register.stub' => 'auth/register.blade.php',
'auth/passwords/email.stub' => 'auth/passwords/email.blade.php',
'auth/passwords/reset.stub' => 'auth/passwords/reset.blade.php',
'layouts/app.stub' => 'layouts/app.blade.php',
'home.stub' => 'home.blade.php',
];
/**
* Execute the console command.
*
* @return void
*/
public function fire()
{
$this->createDirectories();
$this->exportViews();
if (! $this->option('views')) {
file_put_contents(
app_path('Http/Controllers/HomeController.php'),
$this->compileControllerStub()
);
file_put_contents(
base_path('routes/web.php'),
file_get_contents(__DIR__.'/stubs/make/routes.stub'),
FILE_APPEND
);
}
$this->info('Authentication scaffolding generated successfully.');
}
/**
* Create the directories for the files.
*
* @return void
*/
protected function createDirectories()
{
if (! is_dir(base_path('resources/views/layouts'))) {
mkdir(base_path('resources/views/layouts'), 0755, true);
}
if (! is_dir(base_path('resources/views/auth/passwords'))) {
mkdir(base_path('resources/views/auth/passwords'), 0755, true);
}
}
/**
* Export the authentication views.
*
* @return void
*/
protected function exportViews()
{
foreach ($this->views as $key => $value) {
copy(
__DIR__.'/stubs/make/views/'.$key,
base_path('resources/views/'.$value)
);
}
}
/**
* Compiles the HomeController stub.
*
* @return string
*/
protected function compileControllerStub()
{
return str_replace(
'{{namespace}}',
$this->getAppNamespace(),
file_get_contents(__DIR__.'/stubs/make/controllers/HomeController.stub')
);
}
}