After upgrading the laravel 5.8 to laravel 6.x I am getting this error:

Undefined class constant 'App\Providers\RouteServiceProvider::HOME'

Before upgrading the application login system was the custom. After upgrading to laravel 6.x I want to use laravel default authentication. I created authentication through php artisan ui:auth and I copied controllers from fresh laravel app/Http/Controllers/Auth folder with auth related controllers like - LoginController, RegisterController etc.

What should I do to solve the above error? Would someone help me, please?

推荐答案

In Laravel 6 the $redirectTo property in the auth controllers was updated so that it was easier to change across the board. Link to PR.

要修复此错误,您可以向App\Providers\RouteServiceProvider.php类中添加以下内容:

/**
 * The path to the "home" route for your application.
 *
 * @var string
 */
public const HOME = '/home';

or in each of your auth controller update the $redirectTo property to be the route that you want to use:

protected $redirectTo = RouteServiceProvider::HOME;

becomes

protected $redirectTo = '/the-path-you-want-to-redirect-to';

Laravel相关问答推荐

为什么Laravel在API请求时返回BadMethodCallException?

Laravel-如何按第三表关系对数据进行分类

查询Laravel中的图形

Laravel 联合和分页

导出所有客户端不起作用,文件保存时没有名称和扩展名

使用正则表达式 laravel 忘记缓存

前端和管理员分开时未加载laravel 9中间件

Laravel 9:AWS S3 检索要流式传输的视频

laravel 如何验证跨越午夜的两个值之间的时间(15:00 > 时间 > 01:00)

Laravel - 出于某种原因,max 打破了我的查询

Laravel:在失败时处理 findOrFail()

Laravel 表 * 没有名为 * 的列

Laravel 框架类在 PHPUnit 数据提供程序中不可用

在表单中添加一对多 - Backpack laravel

如何在 Eloquent 上设置条件关系

从 Laravel Cashier 获取下一个账单日期

在 Laravel Eloquent 中,limit 与 take 有什么区别?

如何在 laravel eloquent 中保存布尔值

没有Access-Control-Allow-Origin标头 - Laravel

Laravel Mix:更新 Node.js 依赖项