This episode is for members only

Sign up to access "Custom User Subdomains in Laravel" right now.

Get started
Already a member? Sign in to continue
Playing
08. Nullable subdomains

Transcript

00:00
There's a slight issue with the way that we set up our validation rules earlier. And that is, if we wanted to get rid of the subdomain and not have one anymore, when we save this out,
00:08
you can see that the subdomain must be a string and the subdomain must only contain letters. That's not great. So we're going to head back over to the profile controller,
00:18
open back up the profile update request, and then come down and we're going to make this nullable. What that will allow us to do is go ahead and ignore all of these other rules if this thing
00:30
that we have submitted and attempted to store and validate is null. So now I can go ahead and get rid of the subdomain, save that out, and I now no longer have a subdomain.
00:41
If we try and access alex.laravel, use the subdomains.test, sure enough, we get a 404. Let's bring this back because I want to go ahead and save my subdomain, and we have fixed that up.
9 episodes 31 mins

Overview

Allow users to choose their own subdomain, and give them their own area of your application where only their details are shown. You'll be able to register multiple routes for user areas.

Everything in this short course can be easily applied to your own applications where you need this functionality. We'll cover every step of the way, and some things to watch out for.

Finally, we'll learn how to deploy this and configure nginx and DNS records so you're ready to go.

Alex Garrett-Smith
Alex Garrett-Smith
Hey, I'm the founder of Codecourse!

Comments

No comments, yet. Be the first to leave a comment.