FIXED AFTER I REPORTED THE BUG - laravel new project --auth doesn't create HomeController.php

偶尔善良 提交于 2020-05-08 20:02:12

问题


I have created a new laravel project with --auth, but HomeController hasn't been created. I have tried with composer require laravel/ui and php artisan ui vue --auth in an existing project and I encounter the same problem. Any solutions? I know I coould create it manually, but it is annoying. Thanks


回答1:


The HomeController is not being created at the time of writing 29-Apr-2020 a quick workaround is to create it manually:

php artisan make:controller HomeController

and then fill it with the following code:

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class HomeController extends Controller
{
    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        $this->middleware('auth');
    }

    /**
     * Show the application dashboard.
     *
     * @return \Illuminate\Contracts\Support\Renderable
     */
    public function index()
    {
        return view('home');
    }
}



回答2:


It was a bug that was fixed by the Laravel staff in Laravel UI version 2.0.3.

bug fixed by official staff



来源:https://stackoverflow.com/questions/61502742/fixed-after-i-reported-the-bug-laravel-new-project-auth-doesnt-create-homec

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!