public function setup()
 {
     parent::setUp();
     if ($flags = \AlfredNutileInc\LaravelFeatureFlags\FeatureFlag::all()) {
         foreach ($flags as $flag) {
             $flag->delete();
         }
     }
 }
 public function destroy($id)
 {
     try {
         $flag = FeatureFlag::findOrFail($id);
         $flag->delete();
         return redirect()->route('laravel-feature-flag.index')->withMessage(sprintf("Feature Flag Updated %d", $id));
     } catch (\Exception $e) {
         return redirect()->route('laravel-feature-flag.index')->withMessage("Could not find feature flag");
     }
 }
 public function registerFeatureFlags()
 {
     try {
         $features = FeatureFlag::all()->toArray();
         foreach ($features as $key => $value) {
             $features = $this->transformFeatures($features, $value, $key);
             unset($features[$key]);
         }
         $world = new World();
         \Feature\Feature::create($world, $features);
     } catch (\Exception $e) {
         Log::info(sprintf("Silent Failure of Feature Flag %s", $e->getMessage()));
     }
 }
 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     Schema::table('users', function (Blueprint $table) {
         if (Schema::hasColumn('users', 'twitter')) {
             $table->dropColumn('twitter');
         }
         if ($gate = \AlfredNutileInc\LaravelFeatureFlags\FeatureFlag::where('key', 'see-twitter-field')->first()) {
             $gate->delete();
         }
         if ($gate = \AlfredNutileInc\LaravelFeatureFlags\FeatureFlag::where('key', 'add-twitter-field')->first()) {
             $gate->delete();
         }
     });
 }