Adding feature flags to hide features from users

Now that we did gate, let's use a library with gate Laravel feature flag, so we can show and hide features based on the user who logs in!

This can really be a big deal. Say, I am not ready to show any user, but myself, a feature, then when I login, I can see it working. But when I am ready for another user to see it, I can then add features to the list of people who can see it.

Getting ready

I am going to use the install from the start of this recipe book, but you can just jump in as we just need two users to try this out.

How to do it…

  1. First, I will make sure I have two users.
  2. Then, I will install the library per it's instructions:
    > composer require alfred-nutile-inc/laravel-feature-flag
    
  3. Now, let's ...

Get Laravel 5.x Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.