Skip to content

Commit 6a12e3e

Browse files
committed
Use feature flag
1 parent fd590a1 commit 6a12e3e

File tree

4 files changed

+53
-43
lines changed

4 files changed

+53
-43
lines changed

resources/views/components/footer.blade.php

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -223,14 +223,16 @@ class="inline-block px-px py-1.5 transition duration-300 will-change-transform h
223223
Partners
224224
</a>
225225
</li>
226-
<li>
227-
<a
228-
href="{{ route('customer.login') }}"
229-
class="inline-block px-px py-1.5 transition duration-300 will-change-transform hover:translate-x-1 hover:text-gray-700 dark:hover:text-gray-300"
230-
>
231-
License Management
232-
</a>
233-
</li>
226+
@feature(App\Features\ShowAuthButtons::class)
227+
<li>
228+
<a
229+
href="{{ route('customer.login') }}"
230+
class="inline-block px-px py-1.5 transition duration-300 will-change-transform hover:translate-x-1 hover:text-gray-700 dark:hover:text-gray-300"
231+
>
232+
License Management
233+
</a>
234+
</li>
235+
@endfeature
234236
<li>
235237
<a
236238
href="{{ route('brand') }}"

resources/views/components/navbar/mobile-menu.blade.php

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -196,23 +196,25 @@ class="h-0.5 w-full rounded-full bg-current opacity-5"
196196
></div>
197197

198198
{{-- Login/Logout --}}
199-
<div class="w-full">
200-
@auth
201-
<form method="POST" action="{{ route('customer.logout') }}" class="w-full">
202-
@csrf
203-
<button type="submit" class="flex w-full items-center justify-between py-3 opacity-50 transition duration-200 hover:translate-x-1 hover:opacity-100">
204-
<div>Log out</div>
205-
</button>
206-
</form>
207-
@else
208-
<a
209-
href="{{ route('customer.login') }}"
210-
class="flex items-center justify-between py-3 opacity-50 transition duration-200 hover:translate-x-1 hover:opacity-100"
211-
>
212-
<div>Log in</div>
213-
</a>
214-
@endauth
215-
</div>
199+
@feature(App\Features\ShowAuthButtons::class)
200+
<div class="w-full">
201+
@auth
202+
<form method="POST" action="{{ route('customer.logout') }}" class="w-full">
203+
@csrf
204+
<button type="submit" class="flex w-full items-center justify-between py-3 opacity-50 transition duration-200 hover:translate-x-1 hover:opacity-100">
205+
<div>Log out</div>
206+
</button>
207+
</form>
208+
@else
209+
<a
210+
href="{{ route('customer.login') }}"
211+
class="flex items-center justify-between py-3 opacity-50 transition duration-200 hover:translate-x-1 hover:opacity-100"
212+
>
213+
<div>Log in</div>
214+
</a>
215+
@endauth
216+
</div>
217+
@endfeature
216218
</nav>
217219

218220
<div

resources/views/components/navigation-bar.blade.php

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -151,21 +151,23 @@ class="size-[3px] rotate-45 rounded-xs bg-gray-400 transition duration-200 dark:
151151
></div>
152152

153153
{{-- Login/Logout --}}
154-
@auth
155-
<form method="POST" action="{{ route('customer.logout') }}" class="inline">
156-
@csrf
157-
<button type="submit" class="opacity-60 transition duration-200 hover:opacity-100">
158-
Log out
159-
</button>
160-
</form>
161-
@else
162-
<a
163-
href="{{ route('customer.login') }}"
164-
class="opacity-60 transition duration-200 hover:opacity-100"
165-
>
166-
Log in
167-
</a>
168-
@endauth
154+
@feature(App\Features\ShowAuthButtons::class)
155+
@auth
156+
<form method="POST" action="{{ route('customer.logout') }}" class="inline">
157+
@csrf
158+
<button type="submit" class="opacity-60 transition duration-200 hover:opacity-100">
159+
Log out
160+
</button>
161+
</form>
162+
@else
163+
<a
164+
href="{{ route('customer.login') }}"
165+
class="opacity-60 transition duration-200 hover:opacity-100"
166+
>
167+
Log in
168+
</a>
169+
@endauth
170+
@endfeature
169171

170172
{{-- Theme toggle --}}
171173
<x-navbar.theme-toggle />

routes/web.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
<?php
22

3+
use App\Features\ShowAuthButtons;
34
use App\Http\Controllers\Auth\CustomerAuthController;
45
use App\Http\Controllers\CustomerLicenseController;
56
use App\Http\Controllers\CustomerSubLicenseController;
67
use App\Http\Controllers\ShowBlogController;
78
use App\Http\Controllers\ShowDocumentationController;
89
use Illuminate\Support\Facades\Route;
910
use Illuminate\Support\Str;
11+
use Laravel\Pennant\Middleware\EnsureFeaturesAreActive;
1012

1113
/*
1214
|--------------------------------------------------------------------------
@@ -92,7 +94,7 @@
9294
Route::post('license/{license}/renewal/checkout', [App\Http\Controllers\LicenseRenewalController::class, 'createCheckoutSession'])->name('license.renewal.checkout');
9395

9496
// Customer authentication routes
95-
Route::middleware('guest')->group(function () {
97+
Route::middleware(['guest', EnsureFeaturesAreActive::using(ShowAuthButtons::class)])->group(function () {
9698
Route::get('login', [CustomerAuthController::class, 'showLogin'])->name('customer.login');
9799
Route::post('login', [CustomerAuthController::class, 'login']);
98100

@@ -103,10 +105,12 @@
103105
Route::post('reset-password', [CustomerAuthController::class, 'resetPassword'])->name('password.update');
104106
});
105107

106-
Route::post('logout', [CustomerAuthController::class, 'logout'])->name('customer.logout');
108+
Route::post('logout', [CustomerAuthController::class, 'logout'])
109+
->middleware(EnsureFeaturesAreActive::using(ShowAuthButtons::class))
110+
->name('customer.logout');
107111

108112
// Customer license management routes
109-
Route::middleware('auth')->prefix('customer')->name('customer.')->group(function () {
113+
Route::middleware(['auth', EnsureFeaturesAreActive::using(ShowAuthButtons::class)])->prefix('customer')->name('customer.')->group(function () {
110114
Route::get('licenses', [CustomerLicenseController::class, 'index'])->name('licenses');
111115
Route::get('licenses/{licenseKey}', [CustomerLicenseController::class, 'show'])->name('licenses.show');
112116
Route::patch('licenses/{licenseKey}', [CustomerLicenseController::class, 'update'])->name('licenses.update');

0 commit comments

Comments
 (0)