Feature Flags ¶
The core system incorporates “laravel feature” package from https://github.com/francescomalatesta/laravel-feature
Visiting /features (also linked from tools page currently) brings up option to globally enable or disable defined flags. If globally disabled, the option to enable for specific users is provided.
Create a new flag ¶
Add constant to App\Options\Features.php
class Features
{
...
const ENABLE_VET_PORTAL_TIME_INFO = 'enable-vet-portal-time-info';
}
Add a migration, but do not modify database
class AddVetPortalTimeFlag extends Migration
{
/**
*/
public function up()
{
Feature::add(\App\Options\Features::ENABLE_VET_PORTAL_TIME_INFO, false);
}
}
Run the migration
$ docker-compose exec app artisan migrate
In javascript, window.app.features is a collection of feature names.
In Vue2, you can make this a part of your data block
data() {
return {
features: window.app.features,
}
},
then use it in a component.
<span
v-if="features.indexOf('enable-vet-portal-time-info')>-1"
>
Some code...
</span>
<span v-else>
Other code...
</span>
A custom Vue directive would be nice to implement at some point, but this works at the moment.
In blade files, the link above has more info. You can either use
@feature('my.feature')
// example code
@endfeature
@featurefor('my.feature', $user)
// example code
@endfeaturefor
The ‘featurefor’ may be more useful, because you can assign features to specific users (by email) vs having a feature be globally ‘on’ or ‘off’.
feature-email-upcoming-shifts
¶
Enable to run the command core:email-upcoming-shifts
at 4pm every Thursday.
feature-email-open-shifts
¶
Enable to run the command core:email-open-shifts
at noon every Sunday.
feature-relocate-site-shifts
¶
Enable to have the PullSites
job update shifts when a site’s location changes.