Undefined Class Constant 'App\Providers\RouteServiceProvider::HOME'
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?
Answer
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.
To fix the error you can either add the following to your App\Providers\RouteServiceProvider.php
class:
/**
* 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';
Related Questions
- → "failed to open stream" error when executing "migrate:make"
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS - Conditionally Load a Different Page
- → Make a Laravel collection into angular array (octobercms)
- → In OctoberCMS how do you find the hint path?
- → How to register middlewares in OctoberCMS plugin?
- → Validating fileupload(image Dimensions) in Backend Octobercms
- → OctoberCMS Fileupload completely destroys my backend
- → How do I call the value from another backed page form and use it on a component in OctoberCms