In this episode, we dive into feature management within Laravel Fortify. We start by talking about how features can be toggled in the Fortify config file—like the ability to register an account—but notice that just toggling it in the config doesn't automatically update our app's UI. For example, even if registration is disabled, the 'Create Account' modal still shows up on the client side.
We do a bit of source diving into the Fortify routes to see how these checks actually work. Fortify uses a features object to determine if a feature (like registration) is enabled, and only registers the corresponding route if it is. That's why trying to hit the registration endpoint returns a 404 if the feature is disabled.
After exploring how Fortify handles this on the back end, we replicate this feature check in our own routes—disabling things like the registration modal if the feature is turned off. Now, when registration is disabled, not only is the route unavailable, but the corresponding page in our app is too.
We wrap up by noting that while we've got the back end sorted, there's still some cleanup to do on the client side—like hiding UI elements when features are off. We'll tackle that in the next episode!