after successful login user redirected this
route::get('/', 'homecontroller@index');
but redirect user
route::get('home',['middleware' => 'auth', 'uses' => 'welcomecontroller@index']);
how can ??
thanks
in authenticatesandregistersusers trait, when login succeed, there call method called redirectpath(). method checks existence of properties redirectpath , redirectto in order, in controller, can define 1 of them.
so, in auth controller, 1 of these:
public $redirectpath = 'path/to/go'; or
public $redirectto = 'path/to/go'; if want path using function, such route() named route or action() route controller method, can't use 1 of previous properties because in php wrong:
class authcontroller extends controller { ... public $redirectpath = route('name.of.the.route'); ... } in such case, can override redirectpath() method:
class authcontroller extends controller { ... public function redirectpath() { return route('name.of.the.route'); } ... }
Comments
Post a Comment