Success. Updated the following files:
M /Users/fabianwesner/Herd/shop/app/Services/CustomerPasswordResetService.php
M /Users/fabianwesner/Herd/shop/app/Notifications/CustomerResetPassword.php
M /Users/fabianwesner/Herd/shop/app/Livewire/Storefront/Account/Auth/ForgotPassword.php
M /Users/fabianwesner/Herd/shop/app/Livewire/Storefront/Account/Auth/ResetPassword.php

@@ -4,4 +4,4 @@

+use App\Models\Store;
 use Illuminate\Bus\Queueable;
-use Illuminate\Contracts\Queue\ShouldQueue;
 use Illuminate\Notifications\Messages\MailMessage;
@@ -13,8 +13,6 @@

-    /**
-     * Create a new notification instance.
-     */
-    public function __construct()
-    {
-        //
+    public function __construct(
+        public string $token,
+        public Store $store,
+    ) {
     }
@@ -36,6 +34,15 @@
     {
+        $resetUrl = route('account.password.reset', [
+            'token' => $this->token,
+            'email' => $notifiable->email,
+        ]);
+
         return (new MailMessage)
-            ->line('The introduction to the notification.')
-            ->action('Notification Action', url('/'))
-            ->line('Thank you for using our application!');
+            ->subject(__('Reset your :store password', ['store' => $this->store->name]))
+            ->line(__('You are receiving this email because we received a password reset request for your account.'))
+            ->action(__('Reset password'), $resetUrl)
+            ->line(__('This password reset link will expire in :count minutes.', [
+                'count' => config('auth.passwords.customers.expire', 60),
+            ]))
+            ->line(__('If you did not request a password reset, no further action is required.'));
     }

@@ -4,10 +4,125 @@

+use App\Models\Customer;
+use App\Models\Store;
+use App\Notifications\CustomerResetPassword;
+use Illuminate\Support\Facades\DB;
+use Illuminate\Support\Facades\Hash;
+use Illuminate\Support\Facades\RateLimiter;
+use Illuminate\Support\Str;
+
 class CustomerPasswordResetService
 {
-    /**
-     * Create a new class instance.
-     */
-    public function __construct()
+    public function sendResetLink(Store $store, string $email): void
     {
-        //
+        $email = $this->normalizeEmail($email);
+        $rateLimitKey = $this->rateLimitKey($store, $email);
+
+        if (RateLimiter::tooManyAttempts($rateLimitKey, 1)) {
+            return;
+        }
+
+        RateLimiter::hit($rateLimitKey, $this->throttleSeconds());
+
+        $customer = $this->findCustomer($store, $email);
+
+        if (! $customer instanceof Customer) {
+            return;
+        }
+
+        $token = Str::random(64);
+
+        DB::table($this->table())->updateOrInsert(
+            [
+                'store_id' => $store->getKey(),
+                'email' => $customer->email,
+            ],
+            [
+                'token' => Hash::make($token),
+                'created_at' => now(),
+            ],
+        );
+
+        $customer->notify(new CustomerResetPassword($token, $store));
+    }
+
+    public function reset(Store $store, string $email, string $token, string $password): bool
+    {
+        $email = $this->normalizeEmail($email);
+
+        $tokenRecord = DB::table($this->table())
+            ->where('store_id', $store->getKey())
+            ->whereRaw('lower(email) = ?', [$email])
+            ->first();
+
+        if (! $tokenRecord || $this->tokenExpired($tokenRecord->created_at) || ! Hash::check($token, $tokenRecord->token)) {
+            return false;
+        }
+
+        $customer = $this->findCustomer($store, $tokenRecord->email);
+
+        if (! $customer instanceof Customer) {
+            $this->deleteToken($store, $tokenRecord->email);
+
+            return false;
+        }
+
+        $customer->forceFill([
+            'password' => $password,
+        ])->save();
+
+        $this->deleteToken($store, $tokenRecord->email);
+
+        event(new \Illuminate\Auth\Events\PasswordReset($customer));
+
+        return true;
+    }
+
+    private function findCustomer(Store $store, string $email): ?Customer
+    {
+        return Customer::withoutGlobalScopes()
+            ->where('store_id', $store->getKey())
+            ->whereRaw('lower(email) = ?', [$this->normalizeEmail($email)])
+            ->first();
+    }
+
+    private function deleteToken(Store $store, string $email): void
+    {
+        DB::table($this->table())
+            ->where('store_id', $store->getKey())
+            ->whereRaw('lower(email) = ?', [$this->normalizeEmail($email)])
+            ->delete();
+    }
+
+    private function normalizeEmail(string $email): string
+    {
+        return Str::lower(trim($email));
+    }
+
+    private function tokenExpired(?string $createdAt): bool
+    {
+        if (! $createdAt) {
+            return true;
+        }
+
+        return now()->parse($createdAt)->addMinutes($this->expireMinutes())->isPast();
+    }
+
+    private function rateLimitKey(Store $store, string $email): string
+    {
+        return 'customer-password-reset:'.$store->getKey().':'.sha1($email);
+    }
+
+    private function table(): string
+    {
+        return config('auth.passwords.customers.table', 'customer_password_reset_tokens');
+    }
+
+    private function expireMinutes(): int
+    {
+        return (int) config('auth.passwords.customers.expire', 60);
+    }
+
+    private function throttleSeconds(): int
+    {
+        return (int) config('auth.passwords.customers.throttle', 60);
     }

@@ -4,2 +4,5 @@

+use App\Models\Store;
+use App\Services\CustomerPasswordResetService;
+use Livewire\Attributes\Locked;
 use Livewire\Component;
@@ -8,5 +11,34 @@
 {
-    public function render()
+    #[Locked]
+    public int $storeId;
+
+    public string $email = '';
+
+    public function mount(): void
+    {
+        $store = app('current_store');
+
+        abort_unless($store instanceof Store, 404);
+
+        $this->storeId = $store->getKey();
+    }
+
+    public function send(CustomerPasswordResetService $passwords): void
+    {
+        $validated = $this->validate([
+            'email' => ['required', 'email', 'max:255'],
+        ]);
+
+        $passwords->sendResetLink(
+            Store::query()->findOrFail($this->storeId),
+            $validated['email'],
+        );
+
+        session()->flash('status', __('If an account matches that email, a reset link has been sent.'));
+    }
+
+    public function render(): mixed
     {
-        return view('livewire.storefront.account.auth.forgot-password');
+        return view('livewire.storefront.account.auth.forgot-password')
+            ->layout('layouts.auth');
     }

@@ -4,2 +4,5 @@

+use App\Models\Store;
+use App\Services\CustomerPasswordResetService;
+use Livewire\Attributes\Locked;
 use Livewire\Component;
@@ -8,5 +11,54 @@
 {
-    public function render()
+    #[Locked]
+    public int $storeId;
+
+    #[Locked]
+    public string $token = '';
+
+    public string $email = '';
+
+    public string $password = '';
+
+    public string $password_confirmation = '';
+
+    public function mount(string $token): void
+    {
+        $store = app('current_store');
+
+        abort_unless($store instanceof Store, 404);
+
+        $this->storeId = $store->getKey();
+        $this->token = $token;
+        $this->email = (string) request('email', '');
+    }
+
+    public function resetPassword(CustomerPasswordResetService $passwords): void
+    {
+        $validated = $this->validate([
+            'email' => ['required', 'email', 'max:255'],
+            'password' => ['required', 'string', 'min:8', 'confirmed'],
+        ]);
+
+        $reset = $passwords->reset(
+            Store::query()->findOrFail($this->storeId),
+            $validated['email'],
+            $this->token,
+            $validated['password'],
+        );
+
+        if (! $reset) {
+            $this->addError('email', __('This password reset link is invalid or has expired.'));
+
+            return;
+        }
+
+        session()->flash('status', __('Your password has been reset. You may log in with your new password.'));
+
+        $this->redirectRoute('account.login', navigate: true);
+    }
+
+    public function render(): mixed
     {
-        return view('livewire.storefront.account.auth.reset-password');
+        return view('livewire.storefront.account.auth.reset-password')
+            ->layout('layouts.auth');
     }


Output: {"output":"Success. Updated the following files:\nM /Users/fabianwesner/Herd/shop/app/Services/CustomerPasswordResetService.php\nM /Users/fabianwesner/Herd/shop/app/Notifications/CustomerResetPassword.php\nM /Users/fabianwesner/Herd/shop/app/Livewire/Storefront/Account/Auth/ForgotPassword.php\nM /Users/fabianwesner/Herd/shop/app/Livewire/Storefront/Account/Auth/ResetPassword.php\n","metadata":{"exit_code":0,"duration_seconds":0.0}}


Input:
*** Begin Patch
*** Update File: /Users/fabianwesner/Herd/shop/app/Services/CustomerPasswordResetService.php
@@
 use Illuminate\Support\Facades\Hash;
 use Illuminate\Support\Facades\RateLimiter;
+use Illuminate\Support\Carbon;
 use Illuminate\Support\Str;
@@
-        return now()->parse($createdAt)->addMinutes($this->expireMinutes())->isPast();
+        return Carbon::parse($createdAt)->addMinutes($this->expireMinutes())->isPast();
*** Update File: /Users/fabianwesner/Herd/shop/routes/web.php
@@
 use App\Livewire\Admin\Themes\Index as AdminThemesIndex;
+use App\Livewire\Storefront\Account\Auth\ForgotPassword as CustomerForgotPassword;
 use App\Livewire\Storefront\Account\Auth\Login as CustomerLogin;
 use App\Livewire\Storefront\Account\Auth\Register as CustomerRegister;
+use App\Livewire\Storefront\Account\Auth\ResetPassword as CustomerResetPassword;
 use App\Livewire\Storefront\Account\Orders\Index as CustomerOrdersIndex;
@@
     Route::livewire('account/register', CustomerRegister::class)
         ->middleware('guest:customer')
         ->name('account.register');

+    Route::livewire('account/forgot-password', CustomerForgotPassword::class)
+        ->middleware('guest:customer')
+        ->name('account.password.request');
+
+    Route::livewire('account/reset-password/{token}', CustomerResetPassword::class)
+        ->middleware('guest:customer')
+        ->name('account.password.reset');
+
     Route::livewire('account', CustomerOrdersIndex::class)
         ->middleware('auth:customer')
         ->name('account.dashboard');
*** Update File: /Users/fabianwesner/Herd/shop/resources/views/livewire/storefront/account/auth/login.blade.php
@@
         <flux:input
             wire:model="password"
             :label="__('Password')"
             type="password"
             required
@@
             viewable
         />
+
+

+            <flux:link :href="route('account.password.request')" wire:navigate>{{ __('Forgot your password?') }}</flux:link>
+

         <flux:checkbox wire:model="remember" :label="__('Remember me')" />
*** Update File: /Users/fabianwesner/Herd/shop/resources/views/livewire/storefront/account/auth/forgot-password.blade.php
@@
-

-    {{-- Smile, breathe, and go slowly. - Thich Nhat Hanh --}}
+

+    <x-auth-header :title="__('Reset password')" :description="__('Enter your email and we will send a reset link')" />
+
+    @if (session('status'))
+        <flux:callout variant="success" icon="check-circle">
+            {{ session('status') }}
+        </flux:callout>
+    @endif
+
+    <form wire:submit="send" class="flex flex-col gap-6">
+        <flux:input
+            wire:model="email"
+            :label="__('Email address')"
+            type="email"
+            required
+            autofocus
+            autocomplete="email"
+            placeholder="customer@acme.test"
+        />
+
+        <flux:button variant="primary" type="submit" class="w-full" data-test="customer-forgot-password-button">
+            {{ __('Send reset link') }}
+        </flux:button>
+    </form>
+
+

+        <flux:link :href="route('account.login')" wire:navigate>{{ __('Back to log in') }}</flux:link>
+

*** Update File: /Users/fabianwesner/Herd/shop/resources/views/livewire/storefront/account/auth/reset-password.blade.php
@@
-

-    {{-- Live as if you were to die tomorrow. Learn as if you were to live forever. - Mahatma Gandhi --}}
+

+    <x-auth-header :title="__('Set a new password')" :description="__('Choose a new password for your account')" />
+
+    <form wire:submit="resetPassword" class="flex flex-col gap-6">
+        <flux:input
+            wire:model="email"
+            :label="__('Email address')"
+            type="email"
+            required
+            autofocus
+            autocomplete="email"
+            placeholder="customer@acme.test"
+        />
+
+        <flux:input
+            wire:model="password"
+            :label="__('New password')"
+            type="password"
+            required
+            autocomplete="new-password"
+            viewable
+        />
+
+        <flux:input
+            wire:model="password_confirmation"
+            :label="__('Confirm password')"
+            type="password"
+            required
+            autocomplete="new-password"
+            viewable
+        />
+
+        <flux:button variant="primary" type="submit" class="w-full" data-test="customer-reset-password-button">
+            {{ __('Reset password') }}
+        </flux:button>
+    </form>
+
+

+        <flux:link :href="route('account.login')" wire:navigate>{{ __('Back to log in') }}</flux:link>
+

*** End Patch


Success. Updated the following files:
M /Users/fabianwesner/Herd/shop/app/Services/CustomerPasswordResetService.php
M /Users/fabianwesner/Herd/shop/routes/web.php
M /Users/fabianwesner/Herd/shop/resources/views/livewire/storefront/account/auth/login.blade.php
M /Users/fabianwesner/Herd/shop/resources/views/livewire/storefront/account/auth/forgot-password.blade.php
M /Users/fabianwesner/Herd/shop/resources/views/livewire/storefront/account/auth/reset-password.blade.php

@@ -1,3 +1,29 @@
-

-    {{-- Smile, breathe, and go slowly. - Thich Nhat Hanh --}}
+

+    <x-auth-header :title="__('Reset password')" :description="__('Enter your email and we will send a reset link')" />
+
+    @if (session('status'))
+        <flux:callout variant="success" icon="check-circle">
+            {{ session('status') }}
+        </flux:callout>
+    @endif
+
+    <form wire:submit="send" class="flex flex-col gap-6">
+        <flux:input
+            wire:model="email"
+            :label="__('Email address')"
+            type="email"
+            required
+            autofocus
+            autocomplete="email"
+            placeholder="customer@acme.test"
+        />
+
+        <flux:button variant="primary" type="submit" class="w-full" data-test="customer-forgot-password-button">
+            {{ __('Send reset link') }}
+        </flux:button>
+    </form>
+
+

+        <flux:link :href="route('account.login')" wire:navigate>{{ __('Back to log in') }}</flux:link>
+

@@ -24,2 +24,6 @@

+        <div class="-mt-4 text-right text-sm">
+            <flux:link :href="route('account.password.request')" wire:navigate>{{ __('Forgot your password?') }}</flux:link>
+        </div>
+
         <flux:checkbox wire:model="remember" :label="__('Remember me')" />

@@ -29,4 +29,6 @@
 use App\Livewire\Admin\Themes\Index as AdminThemesIndex;
+use App\Livewire\Storefront\Account\Auth\ForgotPassword as CustomerForgotPassword;
 use App\Livewire\Storefront\Account\Auth\Login as CustomerLogin;
 use App\Livewire\Storefront\Account\Auth\Register as CustomerRegister;
+use App\Livewire\Storefront\Account\Auth\ResetPassword as CustomerResetPassword;
 use App\Livewire\Storefront\Account\Orders\Index as CustomerOrdersIndex;
@@ -111,2 +113,10 @@

+    Route::livewire('account/forgot-password', CustomerForgotPassword::class)
+        ->middleware('guest:customer')
+        ->name('account.password.request');
+
+    Route::livewire('account/reset-password/{token}', CustomerResetPassword::class)
+        ->middleware('guest:customer')
+        ->name('account.password.reset');
+
     Route::livewire('account', CustomerOrdersIndex::class)

@@ -10,2 +10,3 @@
 use Illuminate\Support\Facades\RateLimiter;
+use Illuminate\Support\Carbon;
 use Illuminate\Support\Str;
@@ -106,3 +107,3 @@

-        return now()->parse($createdAt)->addMinutes($this->expireMinutes())->isPast();
+        return Carbon::parse($createdAt)->addMinutes($this->expireMinutes())->isPast();
     }

@@ -1,3 +1,41 @@
-

-    {{-- Live as if you were to die tomorrow. Learn as if you were to live forever. - Mahatma Gandhi --}}
+

+    <x-auth-header :title="__('Set a new password')" :description="__('Choose a new password for your account')" />
+
+    <form wire:submit="resetPassword" class="flex flex-col gap-6">
+        <flux:input
+            wire:model="email"
+            :label="__('Email address')"
+            type="email"
+            required
+            autofocus
+            autocomplete="email"
+            placeholder="customer@acme.test"
+        />
+
+        <flux:input
+            wire:model="password"
+            :label="__('New password')"
+            type="password"
+            required
+            autocomplete="new-password"
+            viewable
+        />
+
+        <flux:input
+            wire:model="password_confirmation"
+            :label="__('Confirm password')"
+            type="password"
+            required
+            autocomplete="new-password"
+            viewable
+        />
+
+        <flux:button variant="primary" type="submit" class="w-full" data-test="customer-reset-password-button">
+            {{ __('Reset password') }}
+        </flux:button>
+    </form>
+
+

+        <flux:link :href="route('account.login')" wire:navigate>{{ __('Back to log in') }}</flux:link>
+


The UI routes are now under `/account/forgot-password` and `/account/reset-password/{token}` to avoid colliding with the existing Fortify admin/starter `/forgot-password` route. I’m adding focused tests for generic responses, store scoping, token expiry, and successful password updates.


Input:
*** Begin Patch
*** Update File: /Users/fabianwesner/Herd/shop/tests/Feature/Auth/CustomerPasswordResetTest.php
@@
 <?php

-test('example', function () {
-    $response = $this->get('/');
+use App\Livewire\Storefront\Account\Auth\ForgotPassword as CustomerForgotPassword;
+use App\Livewire\Storefront\Account\Auth\ResetPassword as CustomerResetPassword;
+use App\Models\Customer;
+use App\Models\Store;
+use App\Models\StoreDomain;
+use App\Notifications\CustomerResetPassword as CustomerResetPasswordNotification;
+use App\Services\CustomerPasswordResetService;
+use Illuminate\Foundation\Testing\RefreshDatabase;
+use Illuminate\Support\Facades\Auth;
+use Illuminate\Support\Facades\DB;
+use Illuminate\Support\Facades\Hash;
+use Illuminate\Support\Facades\Notification;
+use Livewire\Livewire;

-    $response->assertStatus(200);
+uses(RefreshDatabase::class);
+
+beforeEach(function (): void {
+    $this->withoutVite();
+});
+
+test('customer password reset pages render for the resolved storefront store', function (): void {
+    $store = Store::factory()->create();
+    StoreDomain::factory()->create([
+        'store_id' => $store->getKey(),
+        'hostname' => 'customer-reset.test',
+    ]);
+
+    $this->withHeader('Host', 'customer-reset.test')
+        ->get('/account/forgot-password')
+        ->assertSuccessful()
+        ->assertSee('Reset password')
+        ->assertSee('Send reset link');
+
+    $this->withHeader('Host', 'customer-reset.test')
+        ->get('/account/reset-password/test-token?email=customer@example.test')
+        ->assertSuccessful()
+        ->assertSee('Set a new password')
+        ->assertSee('Reset password');
+});
+
+test('customer reset links are sent generically and scoped to the current store', function (): void {
+    Notification::fake();
+
+    $store = Store::factory()->create();
+    $otherStore = Store::factory()->create();
+
+    $customer = Customer::factory()->create([
+        'store_id' => $store->getKey(),
+        'email' => 'customer@example.test',
+    ]);
+
+    $otherCustomer = Customer::factory()->create([
+        'store_id' => $otherStore->getKey(),
+        'email' => 'customer@example.test',
+    ]);
+
+    app()->instance('current_store', $store);
+
+    Livewire::test(CustomerForgotPassword::class)
+        ->set('email', 'CUSTOMER@example.test')
+        ->call('send')
+        ->assertHasNoErrors()
+        ->assertSee('If an account matches that email, a reset link has been sent.');
+
+    Notification::assertSentTo(
+        $customer,
+        CustomerResetPasswordNotification::class,
+        fn (CustomerResetPasswordNotification $notification): bool => strlen($notification->token) === 64
+            && $notification->store->is($store),
+    );
+
+    Notification::assertNotSentTo($otherCustomer, CustomerResetPasswordNotification::class);
+
+    $this->assertDatabaseHas('customer_password_reset_tokens', [
+        'store_id' => $store->getKey(),
+        'email' => $customer->email,
+    ]);
+
+    $this->assertDatabaseMissing('customer_password_reset_tokens', [
+        'store_id' => $otherStore->getKey(),
+        'email' => $otherCustomer->email,
+    ]);
+});
+
+test('unknown customer reset requests keep the generic response', function (): void {
+    Notification::fake();
+
+    $store = Store::factory()->create();
+
+    app()->instance('current_store', $store);
+
+    Livewire::test(CustomerForgotPassword::class)
+        ->set('email', 'missing@example.test')
+        ->call('send')
+        ->assertHasNoErrors()
+        ->assertSee('If an account matches that email, a reset link has been sent.');
+
+    Notification::assertNothingSent();
+
+    expect(DB::table('customer_password_reset_tokens')->count())->toBe(0);
+});
+
+test('customer password reset updates the password and deletes the token', function (): void {
+    Notification::fake();
+
+    $store = Store::factory()->create();
+    $customer = Customer::factory()->create([
+        'store_id' => $store->getKey(),
+        'email' => 'customer@example.test',
+        'password' => 'old-password',
+    ]);
+
+    app()->instance('current_store', $store);
+
+    app(CustomerPasswordResetService::class)->sendResetLink($store, $customer->email);
+
+    $token = null;
+
+    Notification::assertSentTo(
+        $customer,
+        CustomerResetPasswordNotification::class,
+        function (CustomerResetPasswordNotification $notification) use (&$token): bool {
+            $token = $notification->token;
+
+            return true;
+        },
+    );
+
+    Livewire::test(CustomerResetPassword::class, ['token' => $token])
+        ->set('email', $customer->email)
+        ->set('password', 'new-password')
+        ->set('password_confirmation', 'new-password')
+        ->call('resetPassword')
+        ->assertHasNoErrors()
+        ->assertRedirect(route('account.login', absolute: false));
+
+    expect(Hash::check('new-password', $customer->refresh()->password_hash))->toBeTrue();
+
+    $this->assertDatabaseMissing('customer_password_reset_tokens', [
+        'store_id' => $store->getKey(),
+        'email' => $customer->email,
+    ]);
+
+    app()->instance('current_store', $store);
+
+    expect(Auth::guard('customer')->attempt([
+        'email' => $customer->email,
+        'password' => 'new-password',
+    ]))->toBeTrue();
+});
+
+test('customer reset tokens cannot be reused across stores or after expiry', function (): void {
+    $store = Store::factory()->create();
+    $otherStore = Store::factory()->create();
+
+    $customer = Customer::factory()->create([
+        'store_id' => $store->getKey(),
+        'email' => 'shared@example.test',
+        'password' => 'old-password',
+    ]);
+
+    $otherCustomer = Customer::factory()->create([
+        'store_id' => $otherStore->getKey(),
+        'email' => 'shared@example.test',
+        'password' => 'other-password',
+    ]);
+
+    DB::table('customer_password_reset_tokens')->insert([
+        'store_id' => $store->getKey(),
+        'email' => $customer->email,
+        'token' => Hash::make('valid-token'),
+        'created_at' => now(),
+    ]);
+
+    app()->instance('current_store', $otherStore);
+
+    Livewire::test(CustomerResetPassword::class, ['token' => 'valid-token'])
+        ->set('email', $otherCustomer->email)
+        ->set('password', 'new-password')
+        ->set('password_confirmation', 'new-password')
+        ->call('resetPassword')
+        ->assertHasErrors(['email']);
+
+    expect(Hash::check('other-password', $otherCustomer->refresh()->password_hash))->toBeTrue();
+
+    DB::table('customer_password_reset_tokens')
+        ->where('store_id', $store->getKey())
+        ->where('email', $customer->email)
+        ->update(['created_at' => now()->subMinutes(61)]);
+
+    app()->instance('current_store', $store);
+
+    Livewire::test(CustomerResetPassword::class, ['token' => 'valid-token'])
+        ->set('email', $customer->email)
+        ->set('password', 'new-password')
+        ->set('password_confirmation', 'new-password')
+        ->call('resetPassword')
+        ->assertHasErrors(['email']);
+
+    expect(Hash::check('old-password', $customer->refresh()->password_hash))->toBeTrue();
 });
*** End Patch


Success. Updated the following files:
M /Users/fabianwesner/Herd/shop/tests/Feature/Auth/CustomerPasswordResetTest.php

@@ -2,6 +2,202 @@

-test('example', function () {
-    $response = $this->get('/');
+use App\Livewire\Storefront\Account\Auth\ForgotPassword as CustomerForgotPassword;
+use App\Livewire\Storefront\Account\Auth\ResetPassword as CustomerResetPassword;
+use App\Models\Customer;
+use App\Models\Store;
+use App\Models\StoreDomain;
+use App\Notifications\CustomerResetPassword as CustomerResetPasswordNotification;
+use App\Services\CustomerPasswordResetService;
+use Illuminate\Foundation\Testing\RefreshDatabase;
+use Illuminate\Support\Facades\Auth;
+use Illuminate\Support\Facades\DB;
+use Illuminate\Support\Facades\Hash;
+use Illuminate\Support\Facades\Notification;
+use Livewire\Livewire;
+
+uses(RefreshDatabase::class);
+
+beforeEach(function (): void {
+    $this->withoutVite();
+});
+
+test('customer password reset pages render for the resolved storefront store', function (): void {
+    $store = Store::factory()->create();
+    StoreDomain::factory()->create([
+        'store_id' => $store->getKey(),
+        'hostname' => 'customer-reset.test',
+    ]);
+
+    $this->withHeader('Host', 'customer-reset.test')
+        ->get('/account/forgot-password')
+        ->assertSuccessful()
+        ->assertSee('Reset password')
+        ->assertSee('Send reset link');
+
+    $this->withHeader('Host', 'customer-reset.test')
+        ->get('/account/reset-password/test-token?email=customer@example.test')
+        ->assertSuccessful()
+        ->assertSee('Set a new password')
+        ->assertSee('Reset password');
+});
+
+test('customer reset links are sent generically and scoped to the current store', function (): void {
+    Notification::fake();
+
+    $store = Store::factory()->create();
+    $otherStore = Store::factory()->create();
+
+    $customer = Customer::factory()->create([
+        'store_id' => $store->getKey(),
+        'email' => 'customer@example.test',
+    ]);
+
+    $otherCustomer = Customer::factory()->create([
+        'store_id' => $otherStore->getKey(),
+        'email' => 'customer@example.test',
+    ]);
+
+    app()->instance('current_store', $store);
+
+    Livewire::test(CustomerForgotPassword::class)
+        ->set('email', 'CUSTOMER@example.test')
+        ->call('send')
+        ->assertHasNoErrors()
+        ->assertSee('If an account matches that email, a reset link has been sent.');
+
+    Notification::assertSentTo(
+        $customer,
+        CustomerResetPasswordNotification::class,
+        fn (CustomerResetPasswordNotification $notification): bool => strlen($notification->token) === 64
+            && $notification->store->is($store),
+    );
+
+    Notification::assertNotSentTo($otherCustomer, CustomerResetPasswordNotification::class);
+
+    $this->assertDatabaseHas('customer_password_reset_tokens', [
+        'store_id' => $store->getKey(),
+        'email' => $customer->email,
+    ]);
+
+    $this->assertDatabaseMissing('customer_password_reset_tokens', [
+        'store_id' => $otherStore->getKey(),
+        'email' => $otherCustomer->email,
+    ]);
+});
+
+test('unknown customer reset requests keep the generic response', function (): void {
+    Notification::fake();
+
+    $store = Store::factory()->create();
+
+    app()->instance('current_store', $store);
+
+    Livewire::test(CustomerForgotPassword::class)
+        ->set('email', 'missing@example.test')
+        ->call('send')
+        ->assertHasNoErrors()
+        ->assertSee('If an account matches that email, a reset link has been sent.');
+
+    Notification::assertNothingSent();
+
+    expect(DB::table('customer_password_reset_tokens')->count())->toBe(0);
+});
+
+test('customer password reset updates the password and deletes the token', function (): void {
+    Notification::fake();
+
+    $store = Store::factory()->create();
+    $customer = Customer::factory()->create([
+        'store_id' => $store->getKey(),
+        'email' => 'customer@example.test',
+        'password' => 'old-password',
+    ]);
+
+    app()->instance('current_store', $store);
+
+    app(CustomerPasswordResetService::class)->sendResetLink($store, $customer->email);

-    $response->assertStatus(200);
+    $token = null;
+
+    Notification::assertSentTo(
+        $customer,
+        CustomerResetPasswordNotification::class,
+        function (CustomerResetPasswordNotification $notification) use (&$token): bool {
+            $token = $notification->token;
+
+            return true;
+        },
+    );
+
+    Livewire::test(CustomerResetPassword::class, ['token' => $token])
+        ->set('email', $customer->email)
+        ->set('password', 'new-password')
+        ->set('password_confirmation', 'new-password')
+        ->call('resetPassword')
+        ->assertHasNoErrors()
+        ->assertRedirect(route('account.login', absolute: false));
+
+    expect(Hash::check('new-password', $customer->refresh()->password_hash))->toBeTrue();
+
+    $this->assertDatabaseMissing('customer_password_reset_tokens', [
+        'store_id' => $store->getKey(),
+        'email' => $customer->email,
+    ]);
+
+    app()->instance('current_store', $store);
+
+    expect(Auth::guard('customer')->attempt([
+        'email' => $customer->email,
+        'password' => 'new-password',
+    ]))->toBeTrue();
+});
+
+test('customer reset tokens cannot be reused across stores or after expiry', function (): void {
+    $store = Store::factory()->create();
+    $otherStore = Store::factory()->create();
+
+    $customer = Customer::factory()->create([
+        'store_id' => $store->getKey(),
+        'email' => 'shared@example.test',
+        'password' => 'old-password',
+    ]);
+
+    $otherCustomer = Customer::factory()->create([
+        'store_id' => $otherStore->getKey(),
+        'email' => 'shared@example.test',
+        'password' => 'other-password',
+    ]);
+
+    DB::table('customer_password_reset_tokens')->insert([
+        'store_id' => $store->getKey(),
+        'email' => $customer->email,
+        'token' => Hash::make('valid-token'),
+        'created_at' => now(),
+    ]);
+
+    app()->instance('current_store', $otherStore);
+
+    Livewire::test(CustomerResetPassword::class, ['token' => 'valid-token'])
+        ->set('email', $otherCustomer->email)
+        ->set('password', 'new-password')
+        ->set('password_confirmation', 'new-password')
+        ->call('resetPassword')
+        ->assertHasErrors(['email']);
+
+    expect(Hash::check('other-password', $otherCustomer->refresh()->password_hash))->toBeTrue();
+
+    DB::table('customer_password_reset_tokens')
+        ->where('store_id', $store->getKey())
+        ->where('email', $customer->email)
+        ->update(['created_at' => now()->subMinutes(61)]);
+
+    app()->instance('current_store', $store);
+
+    Livewire::test(CustomerResetPassword::class, ['token' => 'valid-token'])
+        ->set('email', $customer->email)
+        ->set('password', 'new-password')
+        ->set('password_confirmation', 'new-password')
+        ->call('resetPassword')
+        ->assertHasErrors(['email']);
+
+    expect(Hash::check('old-password', $customer->refresh()->password_hash))->toBeTrue();
 });


Output: {"output":"Success. Updated the following files:\nM /Users/fabianwesner/Herd/shop/tests/Feature/Auth/CustomerPasswordResetTest.php\n","metadata":{"exit_code":0,"duration_seconds":0.0}}


Input:
*** Begin Patch
*** Update File: /Users/fabianwesner/Herd/shop/tests/Feature/Auth/CustomerPasswordResetTest.php
@@
 use App\Services\CustomerPasswordResetService;
 use Illuminate\Foundation\Testing\RefreshDatabase;
 use Illuminate\Support\Facades\Auth;
+use Illuminate\Support\Facades\Cache;
 use Illuminate\Support\Facades\DB;
@@
 beforeEach(function (): void {
     $this->withoutVite();
+    Cache::flush();
 });
*** End Patch


@@ -11,2 +11,3 @@
 use Illuminate\Support\Facades\Auth;
+use Illuminate\Support\Facades\Cache;
 use Illuminate\Support\Facades\DB;
@@ -20,2 +21,3 @@
     $this->withoutVite();
+    Cache::flush();
 });


Output: {"output":"Success. Updated the following files:\nM /Users/fabianwesner/Herd/shop/tests/Feature/Auth/CustomerPasswordResetTest.php\n","metadata":{"exit_code":0,"duration_seconds":0.0}}


Inspect scaffolded auth files, routes, and customer model conventions

Implement store-scoped customer reset service, notification, routes, and Livewire UI

Add focused Pest coverage for reset links and token validation

Run formatter, affected tests, build/smoke checks

Update progress log and commit the slice


Output: Plan updated


The focused test file now covers route rendering, generic reset-link responses, same-email different-store behavior, successful reset, cross-store rejection, and 60-minute expiry. I’m formatting the PHP edits and then I’ll run the smallest affected test set.


Output:
Chunk ID: 775210
Wall time: 0.3639 seconds
Process exited with code 0
Original token count: 68
Output:
{"result":"fixed","files":[{"path":"app\/Notifications\/CustomerResetPassword.php","fixers":["single_line_empty_body"]},{"path":"app\/Services\/CustomerPasswordResetService.php","fixers":["unary_operator_spaces","not_operator_with_successor_space","ordered_imports"]}]}


/bin/zsh
-lc
vendor/bin/pint --dirty --format agent


php artisan test --compact tests/Feature/Auth/CustomerPasswordResetTest.php


Output:
Chunk ID: d13bdc
Wall time: 0.8080 seconds
Process exited with code 1
Original token count: 230
Output:

  ⨯....
  ────────────────────────────────────────────────────────────────────────────
   FAILED  Tests\Feature\Auth\CustomerPasswordResetTest > customer password…
  Expected response status code [>=200, <300] but received 404.
Failed asserting that false is true.

  at tests/Feature/Auth/CustomerPasswordResetTest.php:34
     30▕     ]);
     31▕
     32▕     $this->withHeader('Host', 'customer-reset.test')
     33▕         ->get('/account/forgot-password')
  ➜  34▕         ->assertSuccessful()
     35▕         ->assertSee('Reset password')
     36▕         ->assertSee('Send reset link');
     37▕
     38▕     $this->withHeader('Host', 'customer-reset.test')

  Tests:    1 failed, 4 passed (26 assertions)
  Duration: 0.54s


php artisan test --compact tests/Feature/Auth/CustomerPasswordResetTest.php

  ⨯....
  ────────────────────────────────────────────────────────────────────────────
   FAILED  Tests\Feature\Auth\CustomerPasswordResetTest > customer password…
  Expected response status code [>=200, <300] but received 404.
Failed asserting that false is true.

  at tests/Feature/Auth/CustomerPasswordResetTest.php:34
     30▕     ]);
     31▕
     32▕     $this->withHeader('Host', 'customer-reset.test')
     33▕         ->get('/account/forgot-password')
  ➜  34▕         ->assertSuccessful()
     35▕         ->assertSee('Reset password')
     36▕         ->assertSee('Send reset link');
     37▕
     38▕     $this->withHeader('Host', 'customer-reset.test')

  Tests:    1 failed, 4 passed (26 assertions)
  Duration: 0.54s


One route-rendering assertion failed with a 404, while the Livewire/service behavior tests passed. I’m checking whether the failure is route order, host resolution, or the test setup before changing production code.


sed -n '1,160p' app/Models/StoreDomain.php


php artisan route:list --path=account --except-vendor


php artisan test --compact tests/Feature/Foundation/TenancyTest.php --filter='storefront requests resolve a store by hostname'


sed -n '1,160p' app/Models/StoreDomain.php

<?php

namespace App\Models;

use App\Enums\StoreDomainType;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class StoreDomain extends Model
{
    /** @use HasFactory<\Database\Factories\StoreDomainFactory> */
    use HasFactory;

    public const UPDATED_AT = null;

    /**
     * @var list<string>
     */
    protected $fillable = [
        'store_id',
        'hostname',
        'type',
        'is_primary',
        'tls_mode',
    ];

    /**
     * @return BelongsTo<Store, $this>
     */
    public function store(): BelongsTo
    {
        return $this->belongsTo(Store::class);
    }

    /**
     * @return array<string, string>
     */
    protected function casts(): array
    {
        return [
            'type' => StoreDomainType::class,
            'is_primary' => 'bool',
        ];
    }
}


Output:
Chunk ID: 3aee9c
Wall time: 0.0000 seconds
Process exited with code 0
Original token count: 229
Output:
<?php

namespace App\Models;

use App\Enums\StoreDomainType;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class StoreDomain extends Model
{
    /** @use HasFactory<\Database\Factories\StoreDomainFactory> */
    use HasFactory;

    public const UPDATED_AT = null;

    /**
     * @var list<string>
     */
    protected $fillable = [
        'store_id',
        'hostname',
        'type',
        'is_primary',
        'tls_mode',
    ];

    /**
     * @return BelongsTo<Store, $this>
     */
    public function store(): BelongsTo
    {
        return $this->belongsTo(Store::class);
    }

    /**
     * @return array<string, string>
     */
    protected function casts(): array
    {
        return [
            'type' => StoreDomainType::class,
            'is_primary' => 'bool',
        ];
    }
}


Output:
Chunk ID: 6af3d9
Wall time: 0.0415 seconds
Process exited with code 0
Original token count: 21
Output:

   ERROR  Your application doesn't have any routes matching the given criteria.


php artisan route:list --path=account --except-vendor

ERROR  Your application doesn't have any routes matching the given criteria.


Output:
Chunk ID: f7cd7b
Wall time: 0.6270 seconds
Process exited with code 0
Original token count: 16
Output:

  .

  Tests:    1 passed (1 assertions)
  Duration: 0.56s


php artisan test --compact tests/Feature/Foundation/TenancyTest.php --filter='storefront requests resolve a store by hostname'

  .

  Tests:    1 passed (1 assertions)
  Duration: 0.56s


php artisan route:list --except-vendor | rg "account|forgot|reset"


Output:
Chunk ID: 0be08a
Wall time: 0.0425 seconds
Process exited with code 1
Original token count: 0
Output:


Output:
Chunk ID: 00d01e
Wall time: 0.0459 seconds
Process exited with code 0
Original token count: 509
Output:

  POST      admin/logout ........................................ admin.logout
  GET|HEAD  api/admin/v1/stores/{store}/orders api.admin.v1.orders.index › Ap…
  GET|HEAD  api/admin/v1/stores/{store}/orders/{order} api.admin.v1.orders.sh…
  POST      api/admin/v1/stores/{store}/orders/{order}/fulfillments api.admin…
  POST      api/admin/v1/stores/{store}/orders/{order}/refunds api.admin.v1.o…
  POST      api/storefront/v1/analytics/events api.storefront.v1.analytics.ev…
  POST      api/storefront/v1/carts api.storefront.v1.carts.store › Api\Store…
  GET|HEAD  api/storefront/v1/carts/{cart} api.storefront.v1.carts.show › Api…
  POST      api/storefront/v1/carts/{cart}/lines api.storefront.v1.carts.line…
  PUT       api/storefront/v1/carts/{cart}/lines/{cartLine} api.storefront.v1…
  DELETE    api/storefront/v1/carts/{cart}/lines/{cartLine} api.storefront.v1…
  POST      api/storefront/v1/checkouts api.storefront.v1.checkouts.store › A…
  GET|HEAD  api/storefront/v1/checkouts/{checkout} api.storefront.v1.checkout…
  PUT       api/storefront/v1/checkouts/{checkout}/address api.storefront.v1.…
  POST      api/storefront/v1/checkouts/{checkout}/apply-discount api.storefr…
  DELETE    api/storefront/v1/checkouts/{checkout}/discount api.storefront.v1…
  POST      api/storefront/v1/checkouts/{checkout}/pay api.storefront.v1.chec…
  PUT       api/storefront/v1/checkouts/{checkout}/payment-method api.storefr…
  PUT       api/storefront/v1/checkouts/{checkout}/shipping-method api.storef…
  GET|HEAD  api/storefront/v1/orders/{orderNumber} api.storefront.v1.orders.s…
  GET|HEAD  api/storefront/v1/search api.storefront.v1.search.index › Api\Sto…
  GET|HEAD  api/storefront/v1/search/suggest api.storefront.v1.search.suggest…
  ANY       dashboard .... dashboard › Illuminate\Routing › RedirectController
  ANY       settings ................. Illuminate\Routing › RedirectController

                                                           Showing [24] routes


/bin/zsh
-lc
php artisan route:list --except-vendor

  POST      admin/logout ........................................ admin.logout
  GET|HEAD  api/admin/v1/stores/{store}/orders api.admin.v1.orders.index › Ap…
  GET|HEAD  api/admin/v1/stores/{store}/orders/{order} api.admin.v1.orders.sh…
  POST      api/admin/v1/stores/{store}/orders/{order}/fulfillments api.admin…
  POST      api/admin/v1/stores/{store}/orders/{order}/refunds api.admin.v1.o…
  POST      api/storefront/v1/analytics/events api.storefront.v1.analytics.ev…
  POST      api/storefront/v1/carts api.storefront.v1.carts.store › Api\Store…
  GET|HEAD  api/storefront/v1/carts/{cart} api.storefront.v1.carts.show › Api…
  POST      api/storefront/v1/carts/{cart}/lines api.storefront.v1.carts.line…
  PUT       api/storefront/v1/carts/{cart}/lines/{cartLine} api.storefront.v1…
  DELETE    api/storefront/v1/carts/{cart}/lines/{cartLine} api.storefront.v1…
  POST      api/storefront/v1/checkouts api.storefront.v1.checkouts.store › A…
  GET|HEAD  api/storefront/v1/checkouts/{checkout} api.storefront.v1.checkout…
  PUT       api/storefront/v1/checkouts/{checkout}/address api.storefront.v1.…
  POST      api/storefront/v1/checkouts/{checkout}/apply-discount api.storefr…
  DELETE    api/storefront/v1/checkouts/{checkout}/discount api.storefront.v1…
  POST      api/storefront/v1/checkouts/{checkout}/pay api.storefront.v1.chec…
  PUT       api/storefront/v1/checkouts/{checkout}/payment-method api.storefr…
  PUT       api/storefront/v1/checkouts/{checkout}/shipping-method api.storef…
  GET|HEAD  api/storefront/v1/orders/{orderNumber} api.storefront.v1.orders.s…
  GET|HEAD  api/storefront/v1/search api.storefront.v1.search.index › Api\Sto…
  GET|HEAD  api/storefront/v1/search/suggest api.storefront.v1.search.suggest…
  ANY       dashboard .... dashboard › Illuminate\Routing › RedirectController
  ANY       settings ................. Illuminate\Routing › RedirectController

                                                           Showing [24] routes


php artisan route:list | rg "account|forgot|reset|GET\|HEAD  /|collections"


Output:
Chunk ID: b19ec7
Wall time: 0.0607 seconds
Process exited with code 0
Original token count: 337
Output:
  GET|HEAD  / ............ home › Livewire\Mechanisms › LivewirePageController
  GET|HEAD  account account.dashboard › Livewire\Mechanisms › LivewirePageCon…
  GET|HEAD  account/forgot-password account.password.request › Livewire\Mecha…
  GET|HEAD  account/login account.login › Livewire\Mechanisms › LivewirePageC…
  GET|HEAD  account/orders/{order} account.orders.show › Livewire\Mechanisms …
  GET|HEAD  account/register account.register › Livewire\Mechanisms › Livewir…
  GET|HEAD  account/reset-password/{token} account.password.reset › Livewire\…
  GET|HEAD  admin/collections admin.collections.index › Livewire\Mechanisms  …
  GET|HEAD  admin/collections/create admin.collections.create › Livewire\Mech…
  GET|HEAD  admin/collections/{collection}/edit admin.collections.edit › Live…
  GET|HEAD  collections collections.index › Livewire\Mechanisms › LivewirePag…
  GET|HEAD  collections/{handle} collections.show › Livewire\Mechanisms › Liv…
  GET|HEAD  forgot-password password.request › Laravel\Fortify › PasswordRese…
  POST      forgot-password password.email › Laravel\Fortify › PasswordResetL…
  POST      reset-password password.update › Laravel\Fortify › NewPasswordCon…
  GET|HEAD  reset-password/{token} password.reset › Laravel\Fortify › NewPass…


php artisan route:list | rg "account|forgot|reset|GET\|HEAD  /|collections"

  GET|HEAD  / ............ home › Livewire\Mechanisms › LivewirePageController
  GET|HEAD  account account.dashboard › Livewire\Mechanisms › LivewirePageCon…
  GET|HEAD  account/forgot-password account.password.request › Livewire\Mecha…
  GET|HEAD  account/login account.login › Livewire\Mechanisms › LivewirePageC…
  GET|HEAD  account/orders/{order} account.orders.show › Livewire\Mechanisms …
  GET|HEAD  account/register account.register › Livewire\Mechanisms › Livewir…
  GET|HEAD  account/reset-password/{token} account.password.reset › Livewire\…
  GET|HEAD  admin/collections admin.collections.index › Livewire\Mechanisms  …
  GET|HEAD  admin/collections/create admin.collections.create › Livewire\Mech…
  GET|HEAD  admin/collections/{collection}/edit admin.collections.edit › Live…
  GET|HEAD  collections collections.index › Livewire\Mechanisms › LivewirePag…
  GET|HEAD  collections/{handle} collections.show › Livewire\Mechanisms › Liv…
  GET|HEAD  forgot-password password.request › Laravel\Fortify › PasswordRese…
  POST      forgot-password password.email › Laravel\Fortify › PasswordResetL…
  POST      reset-password password.update › Laravel\Fortify › NewPasswordCon…
  GET|HEAD  reset-password/{token} password.reset › Laravel\Fortify › NewPass…


sed -n '1,95p' tests/Feature/Foundation/TenancyTest.php


sed -n '1,95p' tests/Feature/Foundation/TenancyTest.php

<?php

use App\Livewire\Admin\Auth\Login as AdminLogin;
use App\Models\Store;
use App\Models\StoreDomain;
use App\Models\User;
use Database\Seeders\DatabaseSeeder;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Schema;
use Livewire\Livewire;

uses(RefreshDatabase::class);

test('phase one tables and seeded tenant records exist', function () {
    $this->seed(DatabaseSeeder::class);

    expect(Schema::hasColumns('organizations', ['name', 'billing_email']))->toBeTrue()
        ->and(Schema::hasColumns('stores', ['organization_id', 'handle', 'status', 'default_currency']))->toBeTrue()
        ->and(Schema::hasColumns('store_domains', ['store_id', 'hostname', 'type', 'is_primary']))->toBeTrue()
        ->and(Schema::hasColumns('store_users', ['store_id', 'user_id', 'role']))->toBeTrue()
        ->and(Schema::hasColumns('store_settings', ['store_id', 'settings_json']))->toBeTrue()
        ->and(StoreDomain::query()->where('hostname', 'shop.test')->exists())->toBeTrue()
        ->and(User::query()->where('email', 'admin@acme.test')->exists())->toBeTrue();
});

test('storefront requests resolve a store by hostname', function () {
    $this->seed(DatabaseSeeder::class);

    $this->get('http://shop.test/')
        ->assertOk();
});

test('storefront requests reject unknown or suspended stores', function () {
    $this->seed(DatabaseSeeder::class);

    $this->get('http://unknown-shop.test/')
        ->assertNotFound();

    $store = Store::factory()->suspended()->create();
    StoreDomain::factory()->create([
        'store_id' => $store->getKey(),
        'hostname' => 'suspended-shop.test',
    ]);

    $this->get('http://suspended-shop.test/')
        ->assertServiceUnavailable();
});

test('admin requests resolve the selected session store for authorized staff', function () {
    $this->seed(DatabaseSeeder::class);

    $user = User::query()->where('email', 'admin@acme.test')->firstOrFail();
    $store = Store::query()->where('handle', 'acme-fashion')->firstOrFail();

    $this->actingAs($user)
        ->withSession(['current_store_id' => $store->getKey()])
        ->get('/admin')
        ->assertOk();
});

test('admin login component authenticates active staff with a generic failure message', function () {
    $this->seed(DatabaseSeeder::class);

    Livewire::test(AdminLogin::class)
        ->set('email', 'admin@acme.test')
        ->set('password', 'wrong-password')
        ->call('login')
        ->assertHasErrors(['email']);

    Livewire::test(AdminLogin::class)
        ->set('email', 'admin@acme.test')
        ->set('password', 'password')
        ->call('login')
        ->assertHasNoErrors()
        ->assertRedirect(route('admin.dashboard', absolute: false));

    $this->assertAuthenticated();
});


Output:
Chunk ID: c46f50
Wall time: 0.0000 seconds
Process exited with code 0
Original token count: 697
Output:
<?php

use App\Livewire\Admin\Auth\Login as AdminLogin;
use App\Models\Store;
use App\Models\StoreDomain;
use App\Models\User;
use Database\Seeders\DatabaseSeeder;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Schema;
use Livewire\Livewire;

uses(RefreshDatabase::class);

test('phase one tables and seeded tenant records exist', function () {
    $this->seed(DatabaseSeeder::class);

    expect(Schema::hasColumns('organizations', ['name', 'billing_email']))->toBeTrue()
        ->and(Schema::hasColumns('stores', ['organization_id', 'handle', 'status', 'default_currency']))->toBeTrue()
        ->and(Schema::hasColumns('store_domains', ['store_id', 'hostname', 'type', 'is_primary']))->toBeTrue()
        ->and(Schema::hasColumns('store_users', ['store_id', 'user_id', 'role']))->toBeTrue()
        ->and(Schema::hasColumns('store_settings', ['store_id', 'settings_json']))->toBeTrue()
        ->and(StoreDomain::query()->where('hostname', 'shop.test')->exists())->toBeTrue()
        ->and(User::query()->where('email', 'admin@acme.test')->exists())->toBeTrue();
});

test('storefront requests resolve a store by hostname', function () {
    $this->seed(DatabaseSeeder::class);

    $this->get('http://shop.test/')
        ->assertOk();
});

test('storefront requests reject unknown or suspended stores', function () {
    $this->seed(DatabaseSeeder::class);

    $this->get('http://unknown-shop.test/')
        ->assertNotFound();

    $store = Store::factory()->suspended()->create();
    StoreDomain::factory()->create([
        'store_id' => $store->getKey(),
        'hostname' => 'suspended-shop.test',
    ]);

    $this->get('http://suspended-shop.test/')
        ->assertServiceUnavailable();
});

test('admin requests resolve the selected session store for authorized staff', function () {
    $this->seed(DatabaseSeeder::class);

    $user = User::query()->where('email', 'admin@acme.test')->firstOrFail();
    $store = Store::query()->where('handle', 'acme-fashion')->firstOrFail();

    $this->actingAs($user)
        ->withSession(['current_store_id' => $store->getKey()])
        ->get('/admin')
        ->assertOk();
});

test('admin login component authenticates active staff with a generic failure message', function () {
    $this->seed(DatabaseSeeder::class);

    Livewire::test(AdminLogin::class)
        ->set('email', 'admin@acme.test')
        ->set('password', 'wrong-password')
        ->call('login')
        ->assertHasErrors(['email']);

    Livewire::test(AdminLogin::class)
        ->set('email', 'admin@acme.test')
        ->set('password', 'password')
        ->call('login')
        ->assertHasNoErrors()
        ->assertRedirect(route('admin.dashboard', absolute: false));

    $this->assertAuthenticated();
});


Input:
*** Begin Patch
*** Update File: /Users/fabianwesner/Herd/shop/tests/Feature/Auth/CustomerPasswordResetTest.php
@@
-    $this->withHeader('Host', 'customer-reset.test')
-        ->get('/account/forgot-password')
+    $this->get('http://customer-reset.test/account/forgot-password')
         ->assertSuccessful()
         ->assertSee('Reset password')
         ->assertSee('Send reset link');

-    $this->withHeader('Host', 'customer-reset.test')
-        ->get('/account/reset-password/test-token?email=customer@example.test')
+    $this->get('http://customer-reset.test/account/reset-password/test-token?email=customer@example.test')
         ->assertSuccessful()
         ->assertSee('Set a new password')
*** End Patch


@@ -31,4 +31,3 @@

-    $this->withHeader('Host', 'customer-reset.test')
-        ->get('/account/forgot-password')
+    $this->get('http://customer-reset.test/account/forgot-password')
         ->assertSuccessful()
@@ -37,4 +36,3 @@

-    $this->withHeader('Host', 'customer-reset.test')
-        ->get('/account/reset-password/test-token?email=customer@example.test')
+    $this->get('http://customer-reset.test/account/reset-password/test-token?email=customer@example.test')
         ->assertSuccessful()


Output: {"output":"Success. Updated the following files:\nM /Users/fabianwesner/Herd/shop/tests/Feature/Auth/CustomerPasswordResetTest.php\n","metadata":{"exit_code":0,"duration_seconds":0.0}}


vendor/bin/pint --dirty --format agent && php artisan test --compact tests/Feature/Auth/CustomerPasswordResetTest.php


Output:
Chunk ID: 1959f7
Wall time: 1.1324 seconds
Process exited with code 0
Original token count: 21
Output:
{"result":"pass"}
  .....

  Tests:    5 passed (31 assertions)
  Duration: 0.54s


vendor/bin/pint --dirty --format agent && php artisan test --compact tests/Feature/Auth/CustomerPasswordResetTest.php

{"result":"pass"}
  .....

  Tests:    5 passed (31 assertions)
  Duration: 0.54s


The failure was test-host setup, not production routing; using a full storefront URL matches the project’s existing tenancy tests. The new customer reset tests now pass, and I’m running the adjacent auth coverage to catch any Fortify route collision or customer-login regression.


php artisan test --compact tests/Feature/Auth/CustomerPasswordResetTest.php tests/Feature/Auth/PasswordResetTest.php tests/Feature/Foundation/CustomerAuthTest.php


Output:
Chunk ID: ccad53
Wall time: 1.3585 seconds
Process exited with code 0
Original token count: 19
Output:

  ............

  Tests:    12 passed (55 assertions)
  Duration: 1.29s


php artisan test --compact tests/Feature/Auth/CustomerPasswordResetTest.php tests/Feature/Auth/PasswordResetTest.php tests/Feature/Foundation/CustomerAuthTest.php

  ............

  Tests:    12 passed (55 assertions)
  Duration: 1.29s


php artisan route:list | rg "account/(forgot|reset)| forgot-password | reset-password"


Output:
Chunk ID: eab877
Wall time: 0.1632 seconds
Process exited with code 0
Original token count: 127
Output:
  GET|HEAD  account/forgot-password account.password.request › Livewire\Mecha…
  GET|HEAD  account/reset-password/{token} account.password.reset › Livewire\…
  GET|HEAD  forgot-password password.request › Laravel\Fortify › PasswordRese…
  POST      forgot-password password.email › Laravel\Fortify › PasswordResetL…
  POST      reset-password password.update › Laravel\Fortify › NewPasswordCon…
  GET|HEAD  reset-password/{token} password.reset › Laravel\Fortify › NewPass…


php artisan route:list | rg "account/(forgot|reset)| forgot-password | reset-password"

  GET|HEAD  account/forgot-password account.password.request › Livewire\Mecha…
  GET|HEAD  account/reset-password/{token} account.password.reset › Livewire\…
  GET|HEAD  forgot-password password.request › Laravel\Fortify › PasswordRese…
  POST      forgot-password password.email › Laravel\Fortify › PasswordResetL…
  POST      reset-password password.update › Laravel\Fortify › NewPasswordCon…
  GET|HEAD  reset-password/{token} password.reset › Laravel\Fortify › NewPass…


Output:
Wall time: 0.1468 seconds
Output:
[{"type":"text","text":"http://shop.test/account/forgot-password"}]


The route table now shows the new customer reset pages alongside the existing Fortify root reset routes, so the flows are separate. I’m building the frontend assets next, then I’ll browser-smoke the storefront reset page through Herd.


Output:
Chunk ID: 36dd43
Wall time: 0.7325 seconds
Process exited with code 0
Original token count: 105
Output:

> build
> vite build

vite v7.3.1 building client environment for production...
transforming...
✓ 2 modules transformed.
Generated an empty chunk: "app".
rendering chunks...
computing gzip size...
public/build/manifest.json              0.33 kB │ gzip:  0.17 kB
public/build/assets/app-BbBBnqIg.css  228.32 kB │ gzip: 31.33 kB
public/build/assets/app-l0sNRNKZ.js     0.00 kB │ gzip:  0.02 kB
✓ built in 397ms


> build
> vite build

vite v7.3.1 building client environment for production...
transforming...
✓ 2 modules transformed.
Generated an empty chunk: "app".
rendering chunks...
computing gzip size...
public/build/manifest.json              0.33 kB │ gzip:  0.17 kB
public/build/assets/app-BbBBnqIg.css  228.32 kB │ gzip: 31.33 kB
public/build/assets/app-l0sNRNKZ.js     0.00 kB │ gzip:  0.02 kB
✓ built in 397ms


### Ran Playwright code
```js
await page.goto('http://shop.test/account/forgot-password');
```
### Open tabs
- 0: [Checkout](http://shop.test/checkout)
- 1: (current) [Dashboard](http://shop.test/admin)
### Page
- Page URL: http://shop.test/admin
- Page Title: Dashboard
### Snapshot
- [Snapshot](.playwright-mcp/page-2026-05-04T04-24-15-705Z.yml)
### Events
- New console entries: .playwright-mcp/console-2026-05-04T04-24-15-455Z.log#L1


Output:
Wall time: 0.2555 seconds
Output:
[{"type":"text","text":"### Ran Playwright code\n```js\nawait page.goto('http://shop.test/account/forgot-password');\n```\n### Open tabs\n- 0: [Checkout](http://shop.test/checkout)\n- 1: (current) [Dashboard](http://shop.test/admin)\n### Page\n- Page URL: http://shop.test/admin\n- Page Title: Dashboard\n### Snapshot\n- [Snapshot](.playwright-mcp/page-2026-05-04T04-24-15-705Z.yml)\n### Events\n- New console entries: .playwright-mcp/console-2026-05-04T04-24-15-455Z.log#L1"}]


### Result
- 0: [Checkout](http://shop.test/checkout)
- 1: [Dashboard](http://shop.test/admin)
- 2: (current) [Dashboard](http://shop.test/admin)
### Ran Playwright code
```js
await page.goto('http://shop.test/account/forgot-password');
```
### Open tabs
- 0: [Checkout](http://shop.test/checkout)
- 1: [Dashboard](http://shop.test/admin)
- 2: (current) [Dashboard](http://shop.test/admin)
### Page
- Page URL: http://shop.test/admin
- Page Title: Dashboard
### Snapshot
- [Snapshot](.playwright-mcp/page-2026-05-04T04-24-24-080Z.yml)
### Events
- New console entries: .playwright-mcp/console-2026-05-04T04-24-23-847Z.log#L1


Output:
Wall time: 0.3120 seconds
Output:
[{"type":"text","text":"### Result\n- 0: [Checkout](http://shop.test/checkout)\n- 1: [Dashboard](http://shop.test/admin)\n- 2: (current) [Dashboard](http://shop.test/admin)\n### Ran Playwright code\n```js\nawait page.goto('http://shop.test/account/forgot-password');\n```\n### Open tabs\n- 0: [Checkout](http://shop.test/checkout)\n- 1: [Dashboard](http://shop.test/admin)\n- 2: (current) [Dashboard](http://shop.test/admin)\n### Page\n- Page URL: http://shop.test/admin\n- Page Title: Dashboard\n### Snapshot\n- [Snapshot](.playwright-mcp/page-2026-05-04T04-24-24-080Z.yml)\n### Events\n- New console entries: .playwright-mcp/console-2026-05-04T04-24-23-847Z.log#L1"}]


async (page) => {
  await page.context().clearCookies();
  await page.goto('http://shop.test/account/forgot-password', { waitUntil: 'networkidle' });
  return { url: page.url(), title: await page.title(), body: await page.locator('body').innerText({ timeout: 5000 }) };
}


### Result
{"url":"http://shop.test/account/forgot-password","title":"Shop","body":"Shop\nReset password\nEnter your email and we will send a reset link\nEmail address\nSend reset link\nBack to log in"}
### Ran Playwright code
```js
await (async (page) => {
  await page.context().clearCookies();
  await page.goto('http://shop.test/account/forgot-password', { waitUntil: 'networkidle' });
  return { url: page.url(), title: await page.title(), body: await page.locator('body').innerText({ timeout: 5000 }) };
})(page);
```
### Open tabs
- 0: [Checkout](http://shop.test/checkout)
- 1: [Dashboard](http://shop.test/admin)
- 2: (current) [Shop](http://shop.test/account/forgot-password)
### Page
- Page URL: http://shop.test/account/forgot-password
- Page Title: Shop
### Events
- New console entries: .playwright-mcp/console-2026-05-04T04-24-23-847Z.log#L2


Output:
Wall time: 1.6370 seconds
Output:
[{"type":"text","text":"### Result\n{\"url\":\"http://shop.test/account/forgot-password\",\"title\":\"Shop\",\"body\":\"Shop\\nReset password\\nEnter your email and we will send a reset link\\nEmail address\\nSend reset link\\nBack to log in\"}\n### Ran Playwright code\n```js\nawait (async (page) => {\n  await page.context().clearCookies();\n  await page.goto('http://shop.test/account/forgot-password', { waitUntil: 'networkidle' });\n  return { url: page.url(), title: await page.title(), body: await page.locator('body').innerText({ timeout: 5000 }) };\n})(page);\n```\n### Open tabs\n- 0: [Checkout](http://shop.test/checkout)\n- 1: [Dashboard](http://shop.test/admin)\n- 2: (current) [Shop](http://shop.test/account/forgot-password)\n### Page\n- Page URL: http://shop.test/account/forgot-password\n- Page Title: Shop\n### Events\n- New console entries: .playwright-mcp/console-2026-05-04T04-24-23-847Z.log#L2"}]


### Result
Total messages: 3 (Errors: 0, Warnings: 0)
Returning 0 messages for level "warning"


Output:
Wall time: 0.0089 seconds
Output:
[{"type":"text","text":"### Result\nTotal messages: 3 (Errors: 0, Warnings: 0)\nReturning 0 messages for level \"warning\"\n"}]


### Ran Playwright code
```js
await page.locator('input[type="email"]').fill('missing@example.test');
```


Output:
Wall time: 0.0329 seconds
Output:
[{"type":"text","text":"### Ran Playwright code\n```js\nawait page.locator('input[type=\"email\"]').fill('missing@example.test');\n```"}]


### Ran Playwright code
```js
await page.locator('button[data-test="customer-forgot-password-button"]').click();
```
### Open tabs
- 0: [Checkout](http://shop.test/checkout)
- 1: [Dashboard](http://shop.test/admin)
- 2: (current) [Shop](http://shop.test/account/forgot-password)
### Page
- Page URL: http://shop.test/account/forgot-password
- Page Title: Shop
### Snapshot
- [Snapshot](.playwright-mcp/page-2026-05-04T04-24-52-219Z.yml)


Output:
Wall time: 2.0688 seconds
Output:
[{"type":"text","text":"### Ran Playwright code\n```js\nawait page.locator('button[data-test=\"customer-forgot-password-button\"]').click();\n```\n### Open tabs\n- 0: [Checkout](http://shop.test/checkout)\n- 1: [Dashboard](http://shop.test/admin)\n- 2: (current) [Shop](http://shop.test/account/forgot-password)\n### Page\n- Page URL: http://shop.test/account/forgot-password\n- Page Title: Shop\n### Snapshot\n- [Snapshot](.playwright-mcp/page-2026-05-04T04-24-52-219Z.yml)"}]


If an account matches that email, a reset link has been sent.


### Result
Waited for If an account matches that email, a reset link has been sent.
### Ran Playwright code
```js
await new Promise(f => setTimeout(f, 5 * 1000));
await page.getByText("If an account matches that email, a reset link has been sent.").first().waitFor({ state: 'visible' });
```
### Open tabs
- 0: [Checkout](http://shop.test/checkout)
- 1: [Dashboard](http://shop.test/admin)
- 2: (current) [Shop](http://shop.test/account/forgot-password)
### Page
- Page URL: http://shop.test/account/forgot-password
- Page Title: Shop
### Snapshot
- [Snapshot](.playwright-mcp/page-2026-05-04T04-25-02-973Z.yml)


Output:
Wall time: 5.0250 seconds
Output:
[{"type":"text","text":"### Result\nWaited for If an account matches that email, a reset link has been sent.\n### Ran Playwright code\n```js\nawait new Promise(f => setTimeout(f, 5 * 1000));\nawait page.getByText(\"If an account matches that email, a reset link has been sent.\").first().waitFor({ state: 'visible' });\n```\n### Open tabs\n- 0: [Checkout](http://shop.test/checkout)\n- 1: [Dashboard](http://shop.test/admin)\n- 2: (current) [Shop](http://shop.test/account/forgot-password)\n### Page\n- Page URL: http://shop.test/account/forgot-password\n- Page Title: Shop\n### Snapshot\n- [Snapshot](.playwright-mcp/page-2026-05-04T04-25-02-973Z.yml)"}]


Output:
Wall time: 0.0111 seconds
Output:
[{"type":"text","text":"### Result\nTotal messages: 3 (Errors: 0, Warnings: 0)\nReturning 0 messages for level \"warning\"\n"}]


sed -n '1,260p' app/Services/CustomerPasswordResetService.php


sed -n '1,180p' app/Notifications/CustomerResetPassword.php


sed -n '1,260p' app/Services/CustomerPasswordResetService.php

<?php

namespace App\Services;

use App\Models\Customer;
use App\Models\Store;
use App\Notifications\CustomerResetPassword;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\RateLimiter;
use Illuminate\Support\Str;

class CustomerPasswordResetService
{
    public function sendResetLink(Store $store, string $email): void
    {
        $email = $this->normalizeEmail($email);
        $rateLimitKey = $this->rateLimitKey($store, $email);

        if (RateLimiter::tooManyAttempts($rateLimitKey, 1)) {
            return;
        }

        RateLimiter::hit($rateLimitKey, $this->throttleSeconds());

        $customer = $this->findCustomer($store, $email);

        if (! $customer instanceof Customer) {
            return;
        }

        $token = Str::random(64);

        DB::table($this->table())->updateOrInsert(
            [
                'store_id' => $store->getKey(),
                'email' => $customer->email,
            ],
            [
                'token' => Hash::make($token),
                'created_at' => now(),
            ],
        );

        $customer->notify(new CustomerResetPassword($token, $store));
    }

    public function reset(Store $store, string $email, string $token, string $password): bool
    {
        $email = $this->normalizeEmail($email);

        $tokenRecord = DB::table($this->table())
            ->where('store_id', $store->getKey())
            ->whereRaw('lower(email) = ?', [$email])
            ->first();

        if (! $tokenRecord || $this->tokenExpired($tokenRecord->created_at) || ! Hash::check($token, $tokenRecord->token)) {
            return false;
        }

        $customer = $this->findCustomer($store, $tokenRecord->email);

        if (! $customer instanceof Customer) {
            $this->deleteToken($store, $tokenRecord->email);

            return false;
        }

        $customer->forceFill([
            'password' => $password,
        ])->save();

        $this->deleteToken($store, $tokenRecord->email);

        event(new \Illuminate\Auth\Events\PasswordReset($customer));

        return true;
    }

    private function findCustomer(Store $store, string $email): ?Customer
    {
        return Customer::withoutGlobalScopes()
            ->where('store_id', $store->getKey())
            ->whereRaw('lower(email) = ?', [$this->normalizeEmail($email)])
            ->first();
    }

    private function deleteToken(Store $store, string $email): void
    {
        DB::table($this->table())
            ->where('store_id', $store->getKey())
            ->whereRaw('lower(email) = ?', [$this->normalizeEmail($email)])
            ->delete();
    }

    private function normalizeEmail(string $email): string
    {
        return Str::lower(trim($email));
    }

    private function tokenExpired(?string $createdAt): bool
    {
        if (! $createdAt) {
            return true;
        }

        return Carbon::parse($createdAt)->addMinutes($this->expireMinutes())->isPast();
    }

    private function rateLimitKey(Store $store, string $email): string
    {
        return 'customer-password-reset:'.$store->getKey().':'.sha1($email);
    }

    private function table(): string
    {
        return config('auth.passwords.customers.table', 'customer_password_reset_tokens');
    }

    private function expireMinutes(): int
    {
        return (int) config('auth.passwords.customers.expire', 60);
    }

    private function throttleSeconds(): int
    {
        return (int) config('auth.passwords.customers.throttle', 60);
    }
}


Output:
Chunk ID: bd2f3c
Wall time: 0.0000 seconds
Process exited with code 0
Original token count: 905
Output:
<?php

namespace App\Services;

use App\Models\Customer;
use App\Models\Store;
use App\Notifications\CustomerResetPassword;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\RateLimiter;
use Illuminate\Support\Str;

class CustomerPasswordResetService
{
    public function sendResetLink(Store $store, string $email): void
    {
        $email = $this->normalizeEmail($email);
        $rateLimitKey = $this->rateLimitKey($store, $email);

        if (RateLimiter::tooManyAttempts($rateLimitKey, 1)) {
            return;
        }

        RateLimiter::hit($rateLimitKey, $this->throttleSeconds());

        $customer = $this->findCustomer($store, $email);

        if (! $customer instanceof Customer) {
            return;
        }

        $token = Str::random(64);

        DB::table($this->table())->updateOrInsert(
            [
                'store_id' => $store->getKey(),
                'email' => $customer->email,
            ],
            [
                'token' => Hash::make($token),
                'created_at' => now(),
            ],
        );

        $customer->notify(new CustomerResetPassword($token, $store));
    }

    public function reset(Store $store, string $email, string $token, string $password): bool
    {
        $email = $this->normalizeEmail($email);

        $tokenRecord = DB::table($this->table())
            ->where('store_id', $store->getKey())
            ->whereRaw('lower(email) = ?', [$email])
            ->first();

        if (! $tokenRecord || $this->tokenExpired($tokenRecord->created_at) || ! Hash::check($token, $tokenRecord->token)) {
            return false;
        }

        $customer = $this->findCustomer($store, $tokenRecord->email);

        if (! $customer instanceof Customer) {
            $this->deleteToken($store, $tokenRecord->email);

            return false;
        }

        $customer->forceFill([
            'password' => $password,
        ])->save();

        $this->deleteToken($store, $tokenRecord->email);

        event(new \Illuminate\Auth\Events\PasswordReset($customer));

        return true;
    }

    private function findCustomer(Store $store, string $email): ?Customer
    {
        return Customer::withoutGlobalScopes()
            ->where('store_id', $store->getKey())
            ->whereRaw('lower(email) = ?', [$this->normalizeEmail($email)])
            ->first();
    }

    private function deleteToken(Store $store, string $email): void
    {
        DB::table($this->table())
            ->where('store_id', $store->getKey())
            ->whereRaw('lower(email) = ?', [$this->normalizeEmail($email)])
            ->delete();
    }

    private function normalizeEmail(string $email): string
    {
        return Str::lower(trim($email));
    }

    private function tokenExpired(?string $createdAt): bool
    {
        if (! $createdAt) {
            return true;
        }

        return Carbon::parse($createdAt)->addMinutes($this->expireMinutes())->isPast();
    }

    private function rateLimitKey(Store $store, string $email): string
    {
        return 'customer-password-reset:'.$store->getKey().':'.sha1($email);
    }

    private function table(): string
    {
        return config('auth.passwords.customers.table', 'customer_password_reset_tokens');
    }

    private function expireMinutes(): int
    {
        return (int) config('auth.passwords.customers.expire', 60);
    }

    private function throttleSeconds(): int
    {
        return (int) config('auth.passwords.customers.throttle', 60);
    }
}


sed -n '1,180p' app/Notifications/CustomerResetPassword.php

<?php

namespace App\Notifications;

use App\Models\Store;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;

class CustomerResetPassword extends Notification
{
    use Queueable;

    public function __construct(
        public string $token,
        public Store $store,
    ) {}

    /**
     * Get the notification's delivery channels.
     *
     * @return array<int, string>
     */
    public function via(object $notifiable): array
    {
        return ['mail'];
    }

    /**
     * Get the mail representation of the notification.
     */
    public function toMail(object $notifiable): MailMessage
    {
        $resetUrl = route('account.password.reset', [
            'token' => $this->token,
            'email' => $notifiable->email,
        ]);

        return (new MailMessage)
            ->subject(__('Reset your :store password', ['store' => $this->store->name]))
            ->line(__('You are receiving this email because we received a password reset request for your account.'))
            ->action(__('Reset password'), $resetUrl)
            ->line(__('This password reset link will expire in :count minutes.', [
                'count' => config('auth.passwords.customers.expire', 60),
            ]))
            ->line(__('If you did not request a password reset, no further action is required.'));
    }

    /**
     * Get the array representation of the notification.
     *
     * @return array<string, mixed>
     */
    public function toArray(object $notifiable): array
    {
        return [
            //
        ];
    }
}


Output:
Chunk ID: e6a1ab
Wall time: 0.0000 seconds
Process exited with code 0
Original token count: 410
Output:
<?php

namespace App\Notifications;

use App\Models\Store;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;

class CustomerResetPassword extends Notification
{
    use Queueable;

    public function __construct(
        public string $token,
        public Store $store,
    ) {}

    /**
     * Get the notification's delivery channels.
     *
     * @return array<int, string>
     */
    public function via(object $notifiable): array
    {
        return ['mail'];
    }

    /**
     * Get the mail representation of the notification.
     */
    public function toMail(object $notifiable): MailMessage
    {
        $resetUrl = route('account.password.reset', [
            'token' => $this->token,
            'email' => $notifiable->email,
        ]);

        return (new MailMessage)
            ->subject(__('Reset your :store password', ['store' => $this->store->name]))
            ->line(__('You are receiving this email because we received a password reset request for your account.'))
            ->action(__('Reset password'), $resetUrl)
            ->line(__('This password reset link will expire in :count minutes.', [
                'count' => config('auth.passwords.customers.expire', 60),
            ]))
            ->line(__('If you did not request a password reset, no further action is required.'));
    }

    /**
     * Get the array representation of the notification.
     *
     * @return array<string, mixed>
     */
    public function toArray(object $notifiable): array
    {
        return [
            //
        ];
    }
}


 M resources/views/livewire/storefront/account/auth/login.blade.php
 M routes/web.php
?? .playwright-mcp/console-2026-05-03T23-28-42-443Z.log
?? .playwright-mcp/console-2026-05-04T04-05-07-157Z.log
?? .playwright-mcp/console-2026-05-04T04-24-15-455Z.log
?? .playwright-mcp/console-2026-05-04T04-24-23-847Z.log
?? .playwright-mcp/page-2026-05-04T04-24-15-705Z.yml
?? .playwright-mcp/page-2026-05-04T04-24-24-080Z.yml
?? .playwright-mcp/page-2026-05-04T04-24-52-219Z.yml
?? .playwright-mcp/page-2026-05-04T04-25-02-973Z.yml
?? app/Livewire/Storefront/Account/Auth/ForgotPassword.php
?? app/Livewire/Storefront/Account/Auth/ResetPassword.php
?? app/Notifications/
?? app/Services/CustomerPasswordResetService.php
?? resources/views/livewire/storefront/account/auth/forgot-password.blade.php
?? resources/views/livewire/storefront/account/auth/reset-password.blade.php
?? tests/Feature/Auth/CustomerPasswordResetTest.php


Output:
Chunk ID: 9068d0
Wall time: 0.0000 seconds
Process exited with code 0
Original token count: 230
Output:
 M resources/views/livewire/storefront/account/auth/login.blade.php
 M routes/web.php
?? .playwright-mcp/console-2026-05-03T23-28-42-443Z.log
?? .playwright-mcp/console-2026-05-04T04-05-07-157Z.log
?? .playwright-mcp/console-2026-05-04T04-24-15-455Z.log
?? .playwright-mcp/console-2026-05-04T04-24-23-847Z.log
?? .playwright-mcp/page-2026-05-04T04-24-15-705Z.yml
?? .playwright-mcp/page-2026-05-04T04-24-24-080Z.yml
?? .playwright-mcp/page-2026-05-04T04-24-52-219Z.yml
?? .playwright-mcp/page-2026-05-04T04-25-02-973Z.yml
?? app/Livewire/Storefront/Account/Auth/ForgotPassword.php
?? app/Livewire/Storefront/Account/Auth/ResetPassword.php
?? app/Notifications/
?? app/Services/CustomerPasswordResetService.php
?? resources/views/livewire/storefront/account/auth/forgot-password.blade.php
?? resources/views/livewire/storefront/account/auth/reset-password.blade.php
?? tests/Feature/Auth/CustomerPasswordResetTest.php


Input:
*** Begin Patch
*** Update File: /Users/fabianwesner/Herd/shop/app/Notifications/CustomerResetPassword.php
@@
-    /**
-     * Get the array representation of the notification.
-     *
-     * @return array<string, mixed>
-     */
-    public function toArray(object $notifiable): array
-    {
-        return [
-            //
-        ];
-    }
 }
*** End Patch


Success. Updated the following files:
M /Users/fabianwesner/Herd/shop/app/Notifications/CustomerResetPassword.php

@@ -48,13 +48,2 @@

-    /**
-     * Get the array representation of the notification.
-     *
-     * @return array<string, mixed>
-     */
-    public function toArray(object $notifiable): array
-    {
-        return [
-            //
-        ];
-    }
 }


Output: {"output":"Success. Updated the following files:\nM /Users/fabianwesner/Herd/shop/app/Notifications/CustomerResetPassword.php\n","metadata":{"exit_code":0,"duration_seconds":0.0}}


Output:
Chunk ID: 4fd1fb
Wall time: 0.2088 seconds
Process exited with code 0
Original token count: 43
Output:
{"result":"fixed","files":[{"path":"app\/Notifications\/CustomerResetPassword.php","fixers":["class_attributes_separation","braces_position","single_line_empty_body"]}]}


sed -n '1,140p' app/Notifications/CustomerResetPassword.php


sed -n '1,140p' app/Notifications/CustomerResetPassword.php

<?php

namespace App\Notifications;

use App\Models\Store;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;

class CustomerResetPassword extends Notification
{
    use Queueable;

    public function __construct(
        public string $token,
        public Store $store,
    ) {}

    /**
     * Get the notification's delivery channels.
     *
     * @return array<int, string>
     */
    public function via(object $notifiable): array
    {
        return ['mail'];
    }

    /**
     * Get the mail representation of the notification.
     */
    public function toMail(object $notifiable): MailMessage
    {
        $resetUrl = route('account.password.reset', [
            'token' => $this->token,
            'email' => $notifiable->email,
        ]);

        return (new MailMessage)
            ->subject(__('Reset your :store password', ['store' => $this->store->name]))
            ->line(__('You are receiving this email because we received a password reset request for your account.'))
            ->action(__('Reset password'), $resetUrl)
            ->line(__('This password reset link will expire in :count minutes.', [
                'count' => config('auth.passwords.customers.expire', 60),
            ]))
            ->line(__('If you did not request a password reset, no further action is required.'));
    }
}


Output:
Chunk ID: 3622be
Wall time: 0.0000 seconds
Process exited with code 0
Original token count: 353
Output:
<?php

namespace App\Notifications;

use App\Models\Store;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;

class CustomerResetPassword extends Notification
{
    use Queueable;

    public function __construct(
        public string $token,
        public Store $store,
    ) {}

    /**
     * Get the notification's delivery channels.
     *
     * @return array<int, string>
     */
    public function via(object $notifiable): array
    {
        return ['mail'];
    }

    /**
     * Get the mail representation of the notification.
     */
    public function toMail(object $notifiable): MailMessage
    {
        $resetUrl = route('account.password.reset', [
            'token' => $this->token,
            'email' => $notifiable->email,
        ]);

        return (new MailMessage)
            ->subject(__('Reset your :store password', ['store' => $this->store->name]))
            ->line(__('You are receiving this email because we received a password reset request for your account.'))
            ->action(__('Reset password'), $resetUrl)
            ->line(__('This password reset link will expire in :count minutes.', [
                'count' => config('auth.passwords.customers.expire', 60),
            ]))
            ->line(__('If you did not request a password reset, no further action is required.'));
    }
}


Output:
Chunk ID: 0b3d2b
Wall time: 1.6987 seconds
Process exited with code 0
Original token count: 19
Output:

  ............

  Tests:    12 passed (55 assertions)
  Duration: 1.43s


  ............

  Tests:    12 passed (55 assertions)
  Duration: 1.43s


The adjacent auth suite is green: 12 tests, 55 assertions. I’m reviewing the progress log now so the commit records this as a finished auth gap rather than just code changes.


git diff -- routes/web.php app/Services/CustomerPasswordResetService.php app/Livewire/Storefront/Account/Auth/ForgotPassword.php app/Livewire/Storefront/Account/Auth/ResetPassword.php tests/Feature/Auth/CustomerPasswordResetTest.php | sed -n '1,260p'


/bin/zsh
-lc
sed -n '1,260p' specs/progress.md

# Shop Build Progress

## Objective

Build a complete, self-contained Laravel shop system from `specs/*`, with implemented acceptance criteria mapped to evidence, passing automated checks, verified browser flows, independent QA, and meaningful commits.

## Current Status

- Status: in progress
- Active slice: Phase 8 - final verification and completion audit
- Started from: Laravel Livewire/Fortify starter kit with no shop domain tables or models present
- Last updated: 2026-05-04

## Phased Plan

1. Foundation: SQLite config, tenancy tables/models/factories/seeders, store resolution middleware, store scoping, admin/customer auth foundations, policies, and Phase 1 tests.
2. Catalog: product, variant, inventory, collection, media schema/models/services, admin catalog CRUD, storefront browsing, and tests.
3. Storefront theme/layout: theme/page/navigation data, storefront layout, product/collection/search/page views, and smoke browser verification.
4. Cart/checkout/pricing: cart API/UI, discount, shipping, tax, checkout state machine, and tests.
5. Payments/orders/fulfillment: mock PSP, order creation, refunds, fulfillments, customer account order views, and tests.
6. Admin panel: dashboard and all admin list/form/detail pages from Spec 03, with Livewire/Flux interactions.
7. Search/analytics/apps/webhooks: SQLite search, event aggregation, developer token/webhook UI, delivery jobs, and tests.
8. Final verification: full Pest suite, Pint, frontend build, Playwright MCP customer/admin flows, independent QA, fixes, and completion audit.

## Acceptance Checklist

| Area | Criteria Source | Status | Evidence |
| --- | --- | --- | --- |
| Database schema | `specs/01-DATABASE-SCHEMA.md` | partial | Phase 1 tenancy/auth tables, Phase 2 catalog tables, Phase 3 theme/content/navigation tables, Phase 4 cart/checkout/pricing tables, Phase 5 order/payment/fulfillment tables, and Phase 7 search/analytics/apps/webhooks tables are implemented: search_settings, search_queries, SQLite FTS5 `products_fts`, analytics_events, analytics_daily, apps, app_installations, oauth_clients, oauth_tokens, webhook_subscriptions, and webhook_deliveries. |
| Routes/API | `specs/02-API-ROUTES.md` | partial | Phase 1 auth routes plus catalog/cart/order/customer/discount/content/settings/search/analytics/apps/developers UI routes exist: `/`, `/collections`, `/collections/{handle}`, `/products/{handle}`, `/cart`, `/checkout`, `/checkout/confirmation/{order}`, `/search`, `/pages/{handle}`, `/account`, `/account/orders/{order}`, `/admin/products`, `/admin/products/create`, `/admin/products/{product}/edit`, `/admin/collections`, `/admin/collections/create`, `/admin/collections/{collection}/edit`, `/admin/inventory`, `/admin/orders`, `/admin/orders/{order}`, `/admin/customers`, `/admin/customers/{customer}`, `/admin/discounts`, `/admin/discounts/create`, `/admin/discounts/{discount}/edit`, `/admin/pages`, `/admin/pages/create`, `/admin/pages/{page}/edit`, `/admin/navigation`, `/admin/themes`, `/admin/themes/{theme}/editor`, `/admin/settings`, `/admin/settings/shipping`, `/admin/settings/taxes`, `/admin/search/settings`, `/admin/analytics`, `/admin/apps`, `/admin/apps/{installation}`, and `/admin/developers`. Storefront REST API now includes cart line CRUD, checkout address/shipping/discount/payment-method selection, checkout payment completion, token-gated order lookup, product search, search suggestions, and analytics event ingestion under `/api/storefront/v1`. Admin REST API now includes store-scoped order list/detail, fulfillment creation, and refund creation under `/api/admin/v1/stores/{store}`. OAuth/app API endpoints and broader admin REST surfaces are still missing. |
| Admin UI | `specs/03-ADMIN-UI.md` | partial | Flux/Livewire admin shell now includes dashboard KPI/date-range reporting, analytics reporting with filters/export, catalog/product/collection/inventory management, order/customer/discount management, page index/form, navigation menu editor, theme grid, theme settings editor with iframe preview, general settings, domain management, shipping zone/rate management, tax settings, search settings/reindexing, installed app list/detail, and developer token/webhook management with auth protection and store scoping. Checkout/notification settings tabs, advanced theme file editing, and product media upload UI are still missing. |
| Storefront UI | `specs/04-STOREFRONT-UI.md` | partial | Storefront layout, home, collections index/detail, product detail, SQLite-backed search with filters/sort/pagination, breadcrumbs, price display, product cards, DB-backed pages, seeded navigation menus, cached theme settings, product add-to-cart persistence, cart drawer, cart page with discount and shipping estimates, checkout address/shipping/discount/payment-selection/order-submission UI, order confirmation, and customer order list/detail views render seeded and runtime data. |
| Business logic | `specs/05-BUSINESS-LOGIC.md` | partial | `ResolveStore`, `Belo…37267 chars truncated…assed after the apps/webhooks changes: 182 tests, 909 assertions.
- 2026-05-04: `vendor/bin/pint --dirty --format agent` passed after the apps/webhooks changes.
- 2026-05-04: `php artisan migrate:fresh --seed --no-interaction` passed after browser verification and full tests to restore seeded fixtures.

## Decisions

- Follow the roadmap order strictly. Phase 1 is required before catalog, checkout, admin, storefront, and QA flows can be meaningfully implemented.
- Preserve the starter Fortify conventions where they do not conflict with the shop specs.
- Use integer minor units for all money columns and JSON text columns cast through Eloquent as specified.
- Keep `password_hash` as the database column for admin users and customers while exposing `password`/`getAuthPassword()` at the model layer for Fortify/Laravel auth compatibility.
- Seed both `shop.test` and `acme-fashion.test` as storefront domains for the first store so the goal URL and E2E spec URL can both resolve.
- Customer Livewire auth components persist `storeId` from the initial storefront request because Livewire update requests do not run through the original storefront route middleware.
- The seed specification contains an arithmetic conflict: Acme Fashion's per-product variant table sums to 117 variants, while the prose says 107. The implementation follows the concrete per-product table, resulting in 117 Fashion variants and 10 Electronics variants, 127 total.
- Child catalog models without a `store_id` column are tenant-scoped through their parent product relationship. Inventory keeps its denormalized `store_id` and enforces that it matches the variant product store at save time.
- Storefront content pages now resolve from the `pages` table and only published pages are rendered.
- The catalog admin form intentionally blocks active products without a priced variant and duplicate in-store SKUs during UI edits, mirroring service-layer invariants where the current CRUD surface touches product variants directly.
- Navigation tree support is flat for now because the Phase 3 schema defines `navigation_items.position` but no `parent_id`; `NavigationService::buildTree()` returns a flat tree-compatible array with empty children.
- Cart, checkout, and pricing runtime records are not seeded; only deterministic tax, shipping, and discount configuration is seeded. Runtime carts/checkouts are created by services and tests.
- The cart drawer reads the current session/customer cart without creating an empty cart on every storefront render; carts are created on first add-to-cart or checkout/cart service mutation.
- The checkout UI reserves inventory by selecting a payment method, then submits payment through `CheckoutService::completeCheckout()` so failed card payments can release reservations and return customers to payment selection.
- Order confirmation access is allowed for the authenticated owning customer or for the session that just placed the order via `last_order_id`.
- Customer account order list/detail routes use the `customer` guard and reload orders through explicit store/customer constraints.
- The cart REST API exposes `cart_version` as the public optimistic concurrency field while the service layer keeps its `expectedVersion` argument; `expected_version` remains accepted as a compatibility alias in API requests.
- Cart page discount codes are validated with `DiscountService`, saved in session, and applied to the checkout when the customer proceeds.
- Admin discount forms persist minimum purchase, product eligibility, and collection eligibility in the existing `discounts.rules_json` keys consumed by `DiscountService`; `one_per_customer` is captured for future redemption-history enforcement.
- `PricingEngine` applies an explicit checkout discount code first, then active automatic discounts returned by `DiscountService`.
- `orders.checkout_id` is intentionally added beyond the original schema table to enforce idempotent checkout completion without duplicate orders.
- Failed card payments release reserved inventory and move the checkout back to `shipping_selected` so customers can retry payment selection.
- Bank transfer order completion creates a pending order and payment while keeping inventory reserved until the later admin payment-confirmation flow.
- Inventory commit/release/restock locks by primary key without the current-store global scope because scheduled jobs can operate across stores in one run.
- Admin order Livewire components persist locked `storeId`/`orderId` state and reload orders without global scopes but with explicit store constraints before each service-backed action.
- Admin order actions deliberately delegate to `OrderService`, `RefundService`, and `FulfillmentService` so UI validation cannot bypass payment, refund, fulfillment, or inventory guards.
- Storefront order lookup uses a deterministic HMAC access token derived from store/order identity so confirmation links can be token-gated without adding a new runtime column.