No time? No problem... We provide expert level Laravel development and consulting. We also help customers scaling their projects. If you think we could fit together, drop us a message or give us a call. We are here to help.
How to disable user registration in Laravel
The Problem
During one of our projects, we developed a backend for a customer. As you can imagine, we had a situation where users should not be able to register themselves to the backend. Ok, what can we do?
The first thing that came to mind was, to go through all the standard template files and remove everything where registration was involved.
Sounds ok, right? But, what if at some point the users need to be able to register? You would have to undo all the work you did earlier, which is inefficient and labor intensive!
No worries, we found a pretty neat solution we want to show you!
The Solution
1
2Auth::routes(['register' => false]);
3
If you have used Laravel's awesome php artisan make:auth command before, then you probably know that you have to place the Auth::routes() call in the web.php file in order to register all the routes.
What we are doing here is, telling Laravel that we don't want the registration part of the Auth routes.
After passing this little array as a parameter to the routes call, the Register link in the top bar should disappear, and even when you access /register manually, you should get a 404.
This is a pretty cool solution to a common problem and if our customer now wants registration in his backend again, it is just a simple one-liner we have to remove.
Have fun and try it out yourself!
Expert Level Laravel Web Development & Consulting Agency
We love Laravel, and so should you. Let us show you why.
Find out about Laravel
About Us
Founded in 2014, Black Bits helps customers to reach their goals and to expand their market positions. We work with a wide range of companies, from startups that have a vision and first funding to get to market faster, to big industry leaders that want to profit from modern technologies. If you want to start on your project without building an internal dev-team first, or if you need extra expertise or resources, Black Bits - the Laravel Web Development Agency is here to help.
Laravel
Laravel is one of the most popular PHP Frameworks. Perfect for Sites and API's of all sizes. Clean, fast and reliable.
Lumen
Lumen is the perfect solution for building Laravel based micro-services and blazing fast APIs.
Vue.js
Live-Updating Dashboards, Components and Reactivity. Your project needs a modern user-interface? Vue.js is the right choice.
React
Live-Updating Dashboards, Components and Reactivity. Your project needs a modern user-interface? React is the right choice.
Bootstrap
Bootstrap is the second most-starred project on GitHub and the leading framework for designing modern front-ends.
TailwindCSS
Tailwind is a utility-first CSS framework for rapidly building custom user interfaces.
Amazon Web Services
Amazon Web Services (AWS) leads the worldwide cloud computing market. With a wide range of services, AWS is a perfect option for fast development.
Digital Ocean
Leave complex pricing structures behind. Always know what you'll pay per month. Service customers around the world from eight different locations.
Contact Us
You have the vision, we have the development expertise. We would love to hear about your project.
Send us a message or give us a call and see how Black Bits can help you!