首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >重置Laravel 5身份验证支架

问重置Laravel 5身份验证支架
EN

Stack Overflow用户
提问于 2016-10-08 05:07:08
回答 1查看 928关注 0票数 0

长话短说,我搞砸了我的身份验证脚手架,我想知道如何将它完全重置为基础脚手架。我尝试删除文件,但是当我运行适当的artisan命令时,它没有重新构建脚手架。

问题是,我如何将脚手架重置到我刚刚运行"php artisan make:auth“命令的位置?

EN

回答 1

Stack Overflow用户

发布于 2016-10-08 17:18:36

因此,由于您没有使用任何版本控制,因此跟踪更改或返回变得非常困难。但是,您可以转到/vendor/laravel/framework/src/Illuminate/Auth/Console/MakeAuthCommand.php文件,查看php artisan make:auth做了哪些更改以及撤消了哪些操作。

下面是该文件的内容。

代码语言:javascript
复制
<?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')
    );
}
}
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/39925809

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档