I need your help.
When a user login I need to direct them one multi language router and from what I've read I simply add RedirectTo in my LoginController, but doing so has no effect:
class LoginController extends Controller
{
.
.
//protected $redirectTo ='/Utilisateur';(it's working)
protected $redirectTo = route('displayNew');(it isn't working)
.
.
}
INFO : In fact, on Laravel after the login, the user is redirected to home (redirection by default), to change this behavior, we must give a value to the redirectTo
variable. The function that treats this variable is:
trait RedirectsUsers{
public function redirectPath(){
if (method_exists($this, 'redirectTo')) {
return $this->redirectTo();
}
return property_exists($this, 'redirectTo') ? $this->redirectTo : '/home';
}
}
protected $redirectTo;
is fine, then assign the value in the__construct()
method. – aynber____construct(){ .. self::$redirectTo = route('displayNew') ... }
.I have the same mistake before (Access to undeclared static property:...
) - @aynber – diego