Hi,

I would like to ask how to redirect to another page, like for example dashboard page (because normally after successful login it will redirect the user to home page) ?
I am new at laravel environment and I will highly appreciate all your comments and looking forward to learn a lot from you.

Currently I am using Laravel 6 version.

Thanks

So sorry for the delay in responding.

With native PHP, you can always redirect to a different page by setting an HTTP 301 redirect header as so:

<?php
header('Location: http://www.example.com/', true, 301);
exit;
?>

Note you cannot echo any HTML to the web browser before the header call. A 301 redirect means that the URL of the page trying to be retrieved has permanently moved to a new location. Alternatively, to redirct the user this time but not pass the signal that the URL has permanently changed, use a 302 redirect.

I have no experience with Laravel but here's a link for more information if you want to bypass PHP's built-in functionality and use Laravel's wrapper: https://laravel.com/docs/8.x/redirects

Keep in mind Laravel's wrapper functions will just implement the above code under the hood anyways.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.