Search
 
SCRIPT & CODE EXAMPLE
 

PHP

how to redirect to another page after login in laravel

protected function authenticated(Request $request, $user) {
	 if ($user->role_id == 1) {
	 	return redirect('/admin');
	 } else if ($user->role_id == 2) {
	 	return redirect('/author');
	 } else {
	 	return redirect('/blog');
	 }
}
Comment

how to redirect to another page after login in laravel

namespace AppHttpControllersAuth;

use AppHttpControllersController;

use IlluminateFoundationAuthAuthenticatesUsers;

use IlluminateHttpRequest;

class LoginController extends Controller
{
/*
|--------------------------------------------------------------------------
| Login Controller
|--------------------------------------------------------------------------
|
| This controller handles authenticating users for the application and
| redirecting them to your home screen. The controller uses a trait
| to conveniently provide its functionality to your applications.
|
*/

use AuthenticatesUsers;


protected function authenticated(Request $request, $user)
{
if ( $user->isAdmin() ) {// do your magic here
    return redirect()->route('dashboard');
}

 return redirect('/home');
}
/**
 * Where to redirect users after login.
 *
 * @var string
 */
//protected $redirectTo = '/admin';

/**
 * Create a new controller instance.
 *
 * @return void
 */
public function __construct()
{
    $this->middleware('guest', ['except' => 'logout']);
}
}
Comment

how to redirect to another page after login in laravel

$this->redirectTo = route('dashboard');
Comment

PREVIOUS NEXT
Code Example
Php :: php - How do I calculate the percentage of a number? 
Php :: laravel query order by relation 
Php :: how hide empty category woocommerce wordpress 
Php :: where with and and or in a laravel 
Php :: laravel make model along with its controller and migration file 
Php :: delete button laravel 
Php :: laravel migration integer 
Php :: redirect stderr from echo 
Php :: validate contact us page 2021 php coding 
Php :: session not working php 
Php :: how laravel return the old value 
Php :: connect sql server php 
Php :: remove special characters in php 
Php :: calling fucnction in an other function php 
Php :: ubuntu apache php version 
Php :: firebase php 
Php :: laravel @disabled in laravel-9 
Php :: same column in and where laravel query 
Php :: check if date has passed php 
Php :: reset id auto increment after deleting a table row in phpmyadmin 
Php :: acf create post with fields 
Php :: last_insert_id() php 
Php :: convertir datetime a string en php 
Php :: laravel How to capture output in a file from php artisan test 
Php :: php explode end 
Php :: multi theme laravel 
Php :: sql update row in php 
Php :: how to make core controller codeigniter 3 more than 1 
Php :: How to add custom button in wordpress admin section 
Php :: Codeigniter 3 Get future date recocords - upcoming records from database 
ADD CONTENT
Topic
Content
Source link
Name
4+4 =