laravel redirect back after login code example
Example 1: redirect after login laravel
class RegisterController extends Controller
{
protected $redirectTo = '/home';
protected function redirectTo()
{
if (auth()->user()->role_id == 1) {
return '/admin';
}
return '/home';
}
}
Example 2: how to redirect to another page after login in laravel
$this->redirectTo = route('dashboard');