Skip to content

Commit

Permalink
feat: Added experiments page
Browse files Browse the repository at this point in the history
  • Loading branch information
lewislarsen committed Aug 17, 2024
1 parent d5f155a commit 9b49d80
Show file tree
Hide file tree
Showing 12 changed files with 484 additions and 1 deletion.
23 changes: 23 additions & 0 deletions app/Livewire/Profile/ExperimentsPage.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

declare(strict_types=1);

namespace App\Livewire\Profile;

use Illuminate\View\View;
use Livewire\Component;

/**
* Handles the experiments page in the user's profile section.
*/
class ExperimentsPage extends Component
{
/**
* Render the experiments page view.
*/
public function render(): View
{
return view('livewire.profile.experiments-page')
->layout('components.layouts.account-app');
}
}
2 changes: 2 additions & 0 deletions app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Illuminate\Notifications\Notifiable;
use Laragear\TwoFactor\Contracts\TwoFactorAuthenticatable;
use Laragear\TwoFactor\TwoFactorAuthentication;
use Laravel\Pennant\Concerns\HasFeatures;
use Laravel\Sanctum\HasApiTokens;
use Laravel\Sanctum\NewAccessToken;

Expand All @@ -30,6 +31,7 @@ class User extends Authenticatable implements TwoFactorAuthenticatable

/** @use HasFactory<UserFactory> */
use HasFactory;
use HasFeatures;
use Notifiable;
use TwoFactorAuthentication;

Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"laravel/framework": "^11.9",
"laravel/horizon": "^5.24",
"laravel/pail": "^1.1",
"laravel/pennant": "^1.10",
"laravel/pulse": "^1.2",
"laravel/reverb": "@beta",
"laravel/sanctum": "^4.0",
Expand Down
79 changes: 78 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 44 additions & 0 deletions config/pennant.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php

return [

/*
|--------------------------------------------------------------------------
| Default Pennant Store
|--------------------------------------------------------------------------
|
| Here you will specify the default store that Pennant should use when
| storing and resolving feature flag values. Pennant ships with the
| ability to store flag values in an in-memory array or database.
|
| Supported: "array", "database"
|
*/

'default' => env('PENNANT_STORE', 'database'),

/*
|--------------------------------------------------------------------------
| Pennant Stores
|--------------------------------------------------------------------------
|
| Here you may configure each of the stores that should be available to
| Pennant. These stores shall be used to store resolved feature flag
| values - you may configure as many as your application requires.
|
*/

'stores' => [

'array' => [
'driver' => 'array',
],

'database' => [
'driver' => 'database',
'connection' => null,
'table' => 'features',
],

],
];
28 changes: 28 additions & 0 deletions database/migrations/2024_08_17_201439_create_features_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
public function up()
{
Schema::create('features', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('scope');
$table->text('value');
$table->string('title')->nullable();
$table->text('description')->nullable();
$table->timestamps();

$table->unique(['name', 'scope']);
});
}

public function down()
{
Schema::dropIfExists('features');
}
};
8 changes: 8 additions & 0 deletions resources/views/account/partials/sidebar.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@
</x-sidebar-nav-link>
</li>
@endif
<li class="flex-1 lg:flex-initial">
<x-sidebar-nav-link :href="route('profile.experiments')" :active="request()->routeIs('profile.experiments*')" wire:navigate>
<span class="flex flex-col lg:flex-row items-center justify-center lg:justify-start py-2 lg:py-1.5">
@svg('heroicon-o-beaker', 'h-6 w-6 lg:h-5 lg:w-5 lg:mr-2')
<span class="text-xs mt-1 lg:mt-0 lg:text-sm">{{ __('Manage Experiments') }}</span>
</span>
</x-sidebar-nav-link>
</li>
<li class="flex-1 lg:flex-initial">
<x-sidebar-nav-link :href="route('account.remove-account')" :active="request()->routeIs('account.remove-account')" wire:navigate>
<span class="flex flex-col lg:flex-row items-center justify-center lg:justify-start py-2 lg:py-1.5">
Expand Down
Loading

0 comments on commit 9b49d80

Please sign in to comment.