Laravel 5.3 LoginController - Header may not contain more than a single header, new line detected
The method redirectTo should return an url path, not the Redirect response.
...
protected function redirectTo()
{
if(\Auth::user()->hasRole('copy')){
return '/copy/dashboardCopy';
}
}
...
I have just solved it replacing the original code, with
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;
/**
* Where to redirect users after login.
*
* @var string
*/
protected $redirectTo;
protected function redirectTo()
{
if(\Auth::user()->hasRole('copy')){
$this->redirectTo = '/copy/dashboardCopy';
return $this->redirectTo;
}
}
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest', ['except' => 'logout']);
}
}