Support the ongoing development of Laravel.io →
Views Blade Forms
Last updated 2 years ago.
0

Long story short: the AuthController has a bit of logic where it redirects you back to /home

Since you dont have a /home route but a /dashboard it tells you that no route exists for it

Just add the following to AuthController


class AuthController extends Controller
{
   protected $redirectPath = "/dashboard"; // <= this

...

If you really wanna know: the culprit trait is called RedirectsUsers

Last updated 8 years ago.
0

julianSelser said:

Long story short: the AuthController has a bit of logic where it redirects you back to /home

Since you dont have a /home route but a /dashboard it tells you that no route exists for it

Just add the following to AuthController


class AuthController extends Controller
{
  protected $redirectPath = "/dashboard"; // <= this

...

If you really wanna know: the culprit trait is called RedirectsUsers

Julian thanks for your reply. I had this code snippet already in place (but with an apostrophe instead -changed it) . The thing is that now it keeps me on the same place (register) instead of where I want it to be (dashboard).

Here's my code: (snippet from AuthController.php)

class AuthController extends Controller
{
     use AuthenticatesAndRegistersUsers, ThrottlesLogins;
    protected $redirectTo = "/dashboard";

please help me ?

0

So this is what I've done in DashboardController.php (controller of the page that gets the autheticated user):

public function retrieve()
    {
    	$user = Auth::user();
        return $user->name;
    }

I have added this function to get the user name.

Also I have changed the $redirectTo value to this:

 protected $redirectTo = "dashboard";

And now I can view the user name in the dashboard view.

0

Just got to this, I'm glad you got it working. Thanks for sharing.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

osherdo osherdo Joined 26 Apr 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.