Implements the design captured in
docs/superpowers/specs/2026-04-26-vps-hosting-estimator-design.md.
Estimator (after the hero on /vps-hosting):
- Workload picker (9 chips) recommends a plan; "Not sure" opens a
mini-quiz with a 12-app catalog and a traffic+priority follow-up.
- Recommended-plan card with "or pick another" alternates dropdown.
- Add-ons panel: IPv4 stepper (1-8, $8/extra), Windows BYOL toggle,
4-tier Managed Support radio (Self/Basic/Pro/Pilot @ $0/29/79/99),
5-tier Off-site Backup radio (None/Lite/Standard/Extended/Vault @
$0/5/12/25/59).
- Pilot tier gated to VPS-8+ via plan.features.tier; auto-fallback to
Pro on plan downgrade with snackbar warning.
- Billing cycle toggle (Monthly / Quarterly / Annual) reuses
per-cycle prices already on plan_prices and plan_config_values.
- Sticky footer with live total, "Order this configuration"
(deep-links to /checkout/{plan} with all params), and "Copy share
link" (history.replaceState debounced 300ms).
- Plans-table rows get an "Estimate →" link that pre-fills the
estimator with that plan and scrolls up.
Backend:
- PlanSeeder: each VPS plan gets features.tier (1-32) for gating.
- ConfigOptionSeeder: scope existing Server Management group to
dedicated only; add VPS Managed Support and Off-site Backup
groups with full per-cycle prices.
- routes/marketing.php /vps-hosting: pass addOns + workloadMap +
appExamples Inertia props.
- CheckoutController::show: build prefilledSelections from
?ipv4&windows&managed&backup query params; Vue page hydrates
configSelections from this prop.
Included With All Plans: rewritten to 13 accurate items with
per-line wording (10 Gbps fair-use uplink, ZFS snapshots free,
KVM virtualization, rDNS/PTR control, OOB console/VNC, 99.9%
SLA, etc.) plus a "Coming soon" badge for DDoS protection.
Tests: 10 Pest feature tests in tests/Feature/Marketing/
VpsHostingEstimatorTest.php cover the page props, both new
seeded groups, plan-tier metadata, Server Management dedicated
scope, configGroups attachment, and checkout query-param
pre-fill round-trip. All 10 pass.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
34 lines
1.1 KiB
PHP
34 lines
1.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Http\Middleware;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Inertia\Middleware;
|
|
|
|
class HandleInertiaRequests extends Middleware
|
|
{
|
|
/** @return array<string, mixed> */
|
|
public function share(Request $request): array
|
|
{
|
|
return array_merge(parent::share($request), [
|
|
'auth' => fn () => [
|
|
'user' => $request->user() ? $request->user()->only('id', 'name', 'email', 'status') : null,
|
|
],
|
|
'flash' => fn () => [
|
|
'success' => $request->session()->get('success'),
|
|
'error' => $request->session()->get('error'),
|
|
'info' => $request->session()->get('info'),
|
|
],
|
|
'impersonating' => fn () => $request->session()->has('impersonator_id'),
|
|
'domains' => fn () => [
|
|
'marketing' => config('app.domains.marketing'),
|
|
'account' => config('app.domains.account'),
|
|
'admin' => config('app.domains.admin'),
|
|
],
|
|
'panels' => fn () => config('app.panels'),
|
|
]);
|
|
}
|
|
}
|