Files
WMS/Modules/Pricing/Database/Seeders/PricingDatabaseSeeder.php
2026-09-21 10:14:57 +01:00

132 lines
4.7 KiB
PHP
Executable File

<?php
declare(strict_types=1);
namespace Modules\Pricing\Database\Seeders;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
final class PricingDatabaseSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
$plans = [
[
'code' => 'basic',
'name' => 'Basic',
'strapline' => 'Core warehouse visibility',
'description' => 'Essential WMS tools for small warehouse operations and controlled stock visibility.',
'monthly_amount' => 14900,
'annual_amount' => 49000,
'currency' => 'gbp',
'badge_label' => 'Starter',
'features' => [
'Warehouse dashboard',
'Inventory overview',
'Basic audit trail',
'Email support',
],
'sort_order' => 10,
'is_featured' => false,
'is_active' => true,
],
[
'code' => 'advanced',
'name' => 'Advanced',
'strapline' => 'Operational control suite',
'description' => 'Expanded controls for teams that need replenishment, reporting and integration monitoring.',
'monthly_amount' => 9900,
'annual_amount' => 99000,
'currency' => 'gbp',
'badge_label' => 'Popular',
'features' => [
'Everything in Basic',
'Replenishment workflows',
'Reporting workspace',
'M3 integration status',
'Priority support',
],
'sort_order' => 20,
'is_featured' => true,
'is_active' => true,
],
[
'code' => 'pro',
'name' => 'Pro',
'strapline' => 'Enterprise-grade administration',
'description' => 'Full platform administration for regulated warehouse, carrier and document operations.',
'monthly_amount' => 19900,
'annual_amount' => 199000,
'currency' => 'gbp',
'badge_label' => 'Enterprise',
'features' => [
'Everything in Advanced',
'Multi-company administration',
'Security and audit controls',
'Document archive',
'Carrier management',
'Dedicated support',
],
'sort_order' => 30,
'is_featured' => false,
'is_active' => true,
],
[
'code' => 'ultimate',
'name' => 'Ultimate',
'strapline' => 'Ultimate Enterprise Grade Administration',
'description' => 'Full platform administration for regulated warehouse, unlimited warehouses and users, carrier and document operations.',
'monthly_amount' => 1009900,
'annual_amount' => 1000000,
'currency' => 'gbp',
'badge_label' => 'Enterprise',
'features' => [
'Everything in Pro',
'Multi-company administration',
'Security and audit controls',
'Document archive',
'Carrier management',
'Dedicated support',
],
'sort_order' => 50,
'is_featured' => false,
'is_active' => true,
],
];
foreach ($plans as $plan) {
$exists = DB::table('platform_prices')
->where('code', $plan['code'])
->exists();
$payload = [
'name' => $plan['name'],
'strapline' => $plan['strapline'],
'description' => $plan['description'],
'monthly_amount' => $plan['monthly_amount'],
'annual_amount' => $plan['annual_amount'],
'currency' => $plan['currency'],
'badge_label' => $plan['badge_label'],
'features' => json_encode($plan['features'], JSON_THROW_ON_ERROR),
'sort_order' => $plan['sort_order'],
'is_featured' => $plan['is_featured'],
'is_active' => $plan['is_active'],
'updated_at' => now(),
];
if (! $exists) {
$payload['created_at'] = now();
}
DB::table('platform_prices')->updateOrInsert(
['code' => $plan['code']],
$payload,
);
}
}
}