Demo plan + Payment integrations (Stripe/PayPal/Bank)

Models & migrations:
- platform_settings table (key/value JSON store + Cache::remember 5min)
- plans: is_demo bool + trial_days int
- companies: is_demo bool

Plans:
- Demo plan seeded (is_demo=true, is_public=false, all features, 14 trial days)
- Trial 14-day plan seeded (is_public=true, basic features)
- Plan form: is_demo toggle + trial_days field
- Plan table: badge 🎬 Demo / 🎁 N zile trial

Central panel:
- PaymentSettings page (heroicon-credit-card, sort 90)
  Form sections: General, Date legale, Stripe, PayPal, Transfer bancar
  Each gateway collapsible, fields hidden until enabled toggle
  Saves to platform_settings keyed by `payments.{gateway}`
- CompanyResource: is_demo toggle + table description

Payment flow (PaymentController):
- GET  /billing                 — tenant invoices list with Pay button
- POST /pay/{sub}               — start checkout (stripe/paypal/bank)
- GET  /pay/{sub}/{success,cancel}
- POST /payments/stripe/webhook — mark paid + extend company.active_until
- POST /payments/paypal/webhook — same

Views:
- site/billing.blade.php       — invoices list with payment modal (3 methods)
- site/bank-instructions       — IBAN/BIC/reference for manual transfer
- site/checkout-stub           — placeholder until composer require stripe-php
- site/payment-{success,cancel}

Tenant panel:
- userMenuItems → "Facturile mele" link to /billing
This commit is contained in:
2026-05-08 05:55:30 +00:00
parent d1a18848d3
commit 827bf12d89
16 changed files with 904 additions and 3 deletions
+26
View File
@@ -76,6 +76,32 @@ class DatabaseSeeder extends Seeder
'is_active' => true, 'is_public' => true,
]);
// Demo — full features, dar marcat is_demo (nu apare public, e doar
// pentru sales/onboarding). Trial_days lipsește = sandbox permanent
// controlat de operator.
Plan::firstOrCreate(['slug' => 'demo'], [
'name' => 'Demo',
'price_monthly' => 0,
'price_yearly' => 0,
'currency' => 'MDL',
'features' => ['kanban', 'pdf', 'reports', 'ai', 'api', 'reverb', 'multi_user', 'white_label'],
'limits' => ['max_users' => 5, 'max_clients' => 50, 'max_vehicles' => 50],
'is_active' => true, 'is_public' => false, 'is_demo' => true,
'trial_days' => 14,
]);
// Trial 14 zile — plan vizibil public, devine status=trial.
Plan::firstOrCreate(['slug' => 'trial'], [
'name' => 'Trial 14 zile',
'price_monthly' => 0,
'price_yearly' => 0,
'currency' => 'MDL',
'features' => ['kanban', 'pdf', 'reports'],
'limits' => ['max_users' => 3, 'max_clients' => 100, 'max_vehicles' => 100],
'is_active' => true, 'is_public' => true, 'is_demo' => false,
'trial_days' => 14,
]);
// ─── Super-admin (operator platformă) ─────────────────────
SuperAdmin::firstOrCreate(['email' => 'vasyka.moraru@gmail.com'], [
'name' => 'Vasyka',