Skip to content

Commit

Permalink
feat: Updated experiments
Browse files Browse the repository at this point in the history
  • Loading branch information
lewislarsen committed Aug 18, 2024
1 parent de5ba4e commit 66680bd
Show file tree
Hide file tree
Showing 3 changed files with 420 additions and 153 deletions.
31 changes: 26 additions & 5 deletions app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

/**
* Core application service provider.
* Handles service registration and authorization setup.
* Handles service registration, authorization setup, and feature flags.
*/
class AppServiceProvider extends ServiceProvider
{
Expand All @@ -34,10 +34,7 @@ public function boot(): void
Sanctum::usePersonalAccessTokenModel(PersonalAccessToken::class);

$this->defineGates();

/* Feature::define('example-experiment', function () {
return false;
});*/
$this->defineFeatures();
}

/**
Expand All @@ -56,4 +53,28 @@ private function defineGates(): void
{
Gate::define('viewPulse', fn (User $user): bool => $user->isAdmin());
}

/**
* Define feature flags with additional metadata.
*/
private function defineFeatures(): void
{
$features = [
'navigation-redesign' => [
'title' => 'Navigation Redesign',
'description' => 'A new, more intuitive navigation structure for improved user experience.',
'group' => 'UI/UX',
'icon' => 'heroicon-o-bars-3',
],
];

foreach ($features as $key => $metadata) {
Feature::define($key, function (): false {
return false;
});

// Store the metadata for later use
config(["features.{$key}" => $metadata]);
}
}
}
Loading

0 comments on commit 66680bd

Please sign in to comment.