0

I am facing this error when I tried to redirect my page from main dashboard to the view profile page. I'm using Laravel 5.8 and below is my code:

<div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdownMenuLink">
  <a class="dropdown-item" href="{{Route::redirect('/admin.dashboard', '/view profile')}}">View profile</a>
  <a class="dropdown-item" href="#">Setting</a>
</div>

Can anyone tell me where I'm going wrong?

4
  • 4
    Your route makes no sense. What are you trying to do? Where do you want your href to go? Route::redirect() is not the correct thing to use there, should be url() or route(), but I'm not sure where you want to go. Commented Jan 28, 2020 at 17:38
  • i want to redirect to view profile page when user click on it Commented Jan 28, 2020 at 17:46
  • Route::get('/view profile', function () { return view('view profile'); }); here is my route Commented Jan 28, 2020 at 17:47
  • 1
    Route::get('/view profile', ...); is not valid... You can't have spaces in a URL. Route::get('/view-profile, ...);` is valid, in which case you'd use {{ url('/view-profile') }} Commented Jan 28, 2020 at 17:47

1 Answer 1

4

In your web.php file define a route like this:

Route::get('/view-profile', function () { return view('view profile'); });

and then in your link just use this:

<a class="dropdown-item" href="{{url('/view-profile')}}">View profile</a>
Sign up to request clarification or add additional context in comments.

1 Comment

The above question does not require redirection at all. He is already on current dashboard and just need a href="/view-profile" to go to instead. Your code will not let him open dashboard at all.

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.