user(); if (! $user) { return null; } // Prefer the explicit link; fall back to email for legacy unlinked accounts. return Customer::query()->where('user_id', $user->id)->first() ?? Customer::query()->where('email', $user->email)->first(); } /** Same as customer(), but tells the user why nothing happened. */ protected function requireCustomer(): ?Customer { $customer = $this->customer(); if ($customer === null) { $this->dispatch('notify', message: __('dashboard.no_customer_action')); } return $customer; } }