I am using Laravel 5.5 and I want to redirect the uses when they register on different route depending on whether it has custom session or not I managed to do that in the LoginController like so:
protected $redirectTo = '/';
protected function redirectTo()
{
if (Session::has('userRequest')) {
return route('request');
}
if (Auth::user()->role->name == 'admin') {
return route('admin-dashboard');
}
if (Auth::user()->role->name == 'dealer') {
return route('my-requests');
}
}
But when I try this in the RegisterController:
protected $redirectTo = '/';
protected function redirectTo()
{
if (Session::has('userRequest')) {
return route('request');
}
}
It throws Object of class Illuminate\Routing\Redirector could not be converted to string exception
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2hutV6i
via IFTTT
Aucun commentaire:
Enregistrer un commentaire