douzhu1188
2016-08-01 14:48
浏览 66
已采纳

在Laravel 5.2中为登录用户启用/注册页面

I need to enable /register page to logged in users and restrict for non logged in users in laravel 5.2. I tried changing \app\Http\Controllers\Auth\AuthController.php page constructer to view /register page to logged in users but it didn't work...

public function __construct() {
     $this->middleware($this->guestMiddleware(), ['except' => ['logout', 'getRegister', 'postRegister']]);
}

It would be great help if someone can look into this.

图片转代码服务由CSDN问答提供 功能建议

我需要启用/注册页面以登录用户并限制laravel 5.2中未登录的用户。 我尝试更改\ app \ Http \ Controllers \ Auth \ AuthController.php页面构造器来查看/注册页面以登录用户但它不起作用...

  public  function __construct(){
 $ this-> middleware($ this-> guestMiddleware(),['except'=> ['logout','getRegister','postRegister']]); 
} \  n   
 
 

如果有人可以调查一下这将会很有帮助。

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dtmm0148603 2016-08-01 15:05
    已采纳

    You can add inside auth group middleware all your routes that redirect to views visible to the logged in users.

     Route::group(['middleware' => ['auth']], function () {
           Route::get('/register','your_controller@your_method');
        });
    
    点赞 打赏 评论

相关推荐 更多相似问题