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:
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('platform_settings', function (Blueprint $t) {
|
||||
$t->id();
|
||||
$t->string('key', 100)->unique();
|
||||
$t->json('value')->nullable();
|
||||
$t->timestamps();
|
||||
});
|
||||
|
||||
Schema::table('plans', function (Blueprint $t) {
|
||||
$t->boolean('is_demo')->default(false)->after('is_public');
|
||||
$t->integer('trial_days')->nullable()->after('is_demo')
|
||||
->comment('Days of free trial for tenants on this plan (null = no trial)');
|
||||
});
|
||||
|
||||
Schema::table('companies', function (Blueprint $t) {
|
||||
$t->boolean('is_demo')->default(false)->after('plan_id')
|
||||
->comment('Demo tenant — features unlocked but data may be reset');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('platform_settings');
|
||||
Schema::table('plans', fn (Blueprint $t) => $t->dropColumn(['is_demo', 'trial_days']));
|
||||
Schema::table('companies', fn (Blueprint $t) => $t->dropColumn('is_demo'));
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user