In this episode, we roll up our sleeves and start building out pages for our subdomain routes—just like any regular route in Laravel, nothing too fancy! First, we'll create a new set of views organized under a subdomain
folder to keep things tidy. We put together a simple home page for the subdomain, passing down user data with root model binding so you can show user-specific info (like their name).
Next up, we set up an About page for the user, again under the subdomain
directory, and show how you'd display information about a user (we just hard code a bio for now, but you could easily make this dynamic from your users table).
To navigate between these pages properly, we organize our routes with name prefixes like subdomain.home
and subdomain.about
. Then we wire up links in the views so you can jump from the home page to the about page, making sure the user context gets included every step of the way.
Throughout, you'll see how important it is to always pass the right user when working with subdomain routes, thanks to Laravel's root model binding. By the end of the episode, you'll have a solid foundation for user-specific pages on subdomains in your Laravel app.