Seed DemoWorld business and customer continuity for Woo Manager demos
Deploy Ladill Woo Manager / deploy (push) Successful in 47s
Deploy Ladill Woo Manager / deploy (push) Successful in 47s
Store site names now reference the DemoWorld business identity for the active plan, and order customers use DemoWorld people (name, email, phone) instead of generic "Demo Customer N" placeholders. Staff logins skip the login reseed. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -9,6 +9,7 @@ use App\Models\WooOrder;
|
||||
use App\Models\WooProduct;
|
||||
use App\Models\WooStore;
|
||||
use App\Services\Woo\SubscriptionService;
|
||||
use App\Support\DemoWorld;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Str;
|
||||
@@ -115,25 +116,26 @@ class DemoSeedCommand extends Command
|
||||
private function storeSpecs(string $plan): array
|
||||
{
|
||||
$baseCategories = ['Apparel', 'Accessories', 'Home'];
|
||||
$businessName = DemoWorld::business($plan)['name'];
|
||||
|
||||
return match ($plan) {
|
||||
'enterprise' => [
|
||||
[
|
||||
'site_name' => 'Demo Accra Shop',
|
||||
'site_name' => $businessName.' Shop',
|
||||
'site_url' => 'https://demo-accra.example.com',
|
||||
'products' => 30,
|
||||
'orders' => 12,
|
||||
'categories' => $baseCategories,
|
||||
],
|
||||
[
|
||||
'site_name' => 'Demo Kumasi Shop',
|
||||
'site_name' => $businessName.' — Kumasi Branch Shop',
|
||||
'site_url' => 'https://demo-kumasi.example.com',
|
||||
'products' => 24,
|
||||
'orders' => 8,
|
||||
'categories' => ['Electronics', 'Gadgets'],
|
||||
],
|
||||
[
|
||||
'site_name' => 'Demo Wholesale',
|
||||
'site_name' => $businessName.' Wholesale',
|
||||
'site_url' => 'https://demo-wholesale.example.com',
|
||||
'products' => 20,
|
||||
'orders' => 6,
|
||||
@@ -142,14 +144,14 @@ class DemoSeedCommand extends Command
|
||||
],
|
||||
'pro' => [
|
||||
[
|
||||
'site_name' => 'Demo Pro Shop',
|
||||
'site_name' => $businessName.' Shop',
|
||||
'site_url' => 'https://demo-pro-shop.example.com',
|
||||
'products' => 35,
|
||||
'orders' => 10,
|
||||
'categories' => $baseCategories,
|
||||
],
|
||||
[
|
||||
'site_name' => 'Demo Outlet',
|
||||
'site_name' => $businessName.' Outlet',
|
||||
'site_url' => 'https://demo-outlet.example.com',
|
||||
'products' => 15,
|
||||
'orders' => 5,
|
||||
@@ -158,7 +160,7 @@ class DemoSeedCommand extends Command
|
||||
],
|
||||
default => [
|
||||
[
|
||||
'site_name' => 'Demo Free Shop',
|
||||
'site_name' => $businessName.' Shop',
|
||||
'site_url' => 'https://demo-free-shop.example.com',
|
||||
'products' => 15,
|
||||
'orders' => 4,
|
||||
@@ -225,10 +227,13 @@ class DemoSeedCommand extends Command
|
||||
}
|
||||
}
|
||||
|
||||
$people = DemoWorld::people();
|
||||
|
||||
for ($i = 1; $i <= $spec['orders']; $i++) {
|
||||
$product = $products[($i - 1) % count($products)];
|
||||
$qty = 1 + ($i % 3);
|
||||
$lineTotal = (int) $product->regular_price_minor * $qty;
|
||||
$customer = $people[($i - 1) % count($people)];
|
||||
|
||||
WooOrder::query()->create([
|
||||
'woo_store_id' => $store->id,
|
||||
@@ -236,9 +241,9 @@ class DemoSeedCommand extends Command
|
||||
'order_number' => (string) (1000 + $i),
|
||||
'wc_status' => $i % 4 === 0 ? 'completed' : 'processing',
|
||||
'payment_status' => 'paid',
|
||||
'customer_name' => 'Demo Customer '.$i,
|
||||
'customer_email' => 'customer'.$i.'@example.com',
|
||||
'customer_phone' => '+233200000'.str_pad((string) $i, 3, '0', STR_PAD_LEFT),
|
||||
'customer_name' => DemoWorld::fullName($customer),
|
||||
'customer_email' => $customer['email'],
|
||||
'customer_phone' => $customer['phone'],
|
||||
'line_items' => [[
|
||||
'id' => $product->external_id,
|
||||
'name' => $product->name,
|
||||
|
||||
Reference in New Issue
Block a user