Skip to content

Commit fd590a1

Browse files
committed
Add feature flag
1 parent 5d68b28 commit fd590a1

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

app/Features/ShowAuthButtons.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
namespace App\Features;
4+
5+
use Laravel\Pennant\Feature;
6+
7+
class ShowAuthButtons
8+
{
9+
/**
10+
* Resolve the feature's initial value.
11+
*/
12+
public function resolve(mixed $scope): bool
13+
{
14+
if ($scope) {
15+
return Feature::for(null)->active(static::class);
16+
}
17+
18+
return false;
19+
}
20+
}

app/Providers/AppServiceProvider.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22

33
namespace App\Providers;
44

5+
use App\Features\ShowAuthButtons;
56
use App\Support\GitHub;
67
use Illuminate\Cache\RateLimiting\Limit;
78
use Illuminate\Queue\Events\JobFailed;
89
use Illuminate\Support\Facades\Queue;
910
use Illuminate\Support\Facades\RateLimiter;
1011
use Illuminate\Support\Facades\View;
1112
use Illuminate\Support\ServiceProvider;
13+
use Laravel\Pennant\Feature;
1214
use Sentry\State\Scope;
1315

1416
use function Sentry\captureException;
@@ -33,6 +35,8 @@ public function boot(): void
3335

3436
$this->sendFailingJobsToSentry();
3537

38+
$this->registerFeatureFlags();
39+
3640
RateLimiter::for('anystack', function () {
3741
return Limit::perMinute(30);
3842
});
@@ -67,4 +71,9 @@ private function sendFailingJobsToSentry(): void
6771
}
6872
});
6973
}
74+
75+
private function registerFeatureFlags(): void
76+
{
77+
Feature::define(ShowAuthButtons::class);
78+
}
7079
}

0 commit comments

Comments
 (0)