dongrunying7537 2015-03-21 13:37
浏览 188
已采纳

如何在Laravel 5中禁用注册新用户

I'm trying to make single-user admin panel (which has only one user) in Laravel 5 and I registered that user, so now I want to disable registration for new users, of course the login form must work but no new register from now on. how can I do that?

I use the default user login and register in version 5.

  • 写回答

26条回答 默认 最新

  • duanjiani6826 2015-03-21 13:46
    关注

    Laravel 5.7 introduced the following functionality:

    Auth::routes(['register' => false]);
    

    The currently possible options here are:

    Auth::routes([
      'register' => false, // Registration Routes...
      'reset' => false, // Password Reset Routes...
      'verify' => false, // Email Verification Routes...
    ]);
    

    For older Laravel versions just override showRegistrationForm() and register() methods in

    • AuthController for Laravel 5.0 - 5.4
    • Auth/RegisterController.php for Laravel 5.5
    public function showRegistrationForm()
    {
        return redirect('login');
    }
    
    public function register()
    {
    
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(25条)

报告相同问题?

悬赏问题

  • ¥15 flink cdc无法实时同步mysql数据
  • ¥100 有人会搭建GPT-J-6B框架吗?有偿
  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决