10

I am calling getting_started route after successfully login :

protected $redirectTo = '/getting_started';

Here is my getting_started route code :

Route::get('/getting_started','UserController@getting_started');

And controller code :

public function getting_started()
{
    $id= Auth::id();
    $user = DB::table('user_profiles')->where('user_id', '=', $id)->first();

    if($user->dashboard_access == 0)
    {
        DB::table('user_profiles')
            ->where('user_id', $id)
            ->update(['dashboard_access' => 1]);
        return view('user.getting_started');
    }

    return view('user.dashboard');
}

It works perfectly and show in url :

http://localhost:8080/getting_started

Now I actually want that if user.dashboard view is call it show in url like :

http://localhost:8080/dashboard`

And on getting_started view show :

http://localhost:8080/getting_started

It is possible to call dashboard route instead of :

  return view('user.dashboard');

My dashobard route is :

Route::get('/dashboard',['middleware' => 'auth', function () {
    return view('user.dashboard');
}]);

2 Answers 2

17

What I understand it is that you are looking for is this function

return redirect()->route('dashboard');

It's my understanding of your question which can be wrong. Maybe you are asking something else.

Sign up to request clarification or add additional context in comments.

1 Comment

How to invoke a post route?
1

That called Redirection and especially you want to Returning A Redirect To A Named Route, you route called user.dashboard so you could redirect to it using redirect()->route(route_name) :

return redirect()->route('user.dashboard');

Hope this helps.

1 Comment

How to invoke a post route?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.