$userId, 'name' => 'TechStore - E-commerce', 'currency' => 'EUR', 'business_type' => 'products', 'employees_count' => 3, 'hours_per_week' => 40, 'working_days_per_week' => 5, 'working_days_per_month' => 22, 'productivity_rate' => 85, 'monthly_revenue' => 45000, 'fixed_expenses' => 8500, 'tax_rate' => 21, 'price_includes_tax' => true, 'vat_rate' => 21, 'sales_commission' => 3, 'card_fee' => 1.5, 'other_variable_costs' => 2, 'investment_rate' => 5, 'profit_margin' => 15, 'is_active' => true, ]); $ecommerce->recalculateMarkup(); // Produtos do E-commerce $this->createProduct($ecommerce, 'Smartphone Samsung Galaxy S24', 'PHONE-001', 'Eletrônicos', [ ['name' => 'Custo do produto', 'cost' => 650, 'quantity' => 1], ['name' => 'Embalagem premium', 'cost' => 5, 'quantity' => 1], ['name' => 'Frete de entrada', 'cost' => 8, 'quantity' => 1], ]); $this->createProduct($ecommerce, 'Notebook Dell Inspiron 15', 'NOTE-001', 'Eletrônicos', [ ['name' => 'Custo do notebook', 'cost' => 580, 'quantity' => 1], ['name' => 'Embalagem', 'cost' => 12, 'quantity' => 1], ['name' => 'Frete importação', 'cost' => 25, 'quantity' => 1], ]); $this->createProduct($ecommerce, 'Fone Bluetooth JBL', 'AUDIO-001', 'Áudio', [ ['name' => 'Custo do fone', 'cost' => 45, 'quantity' => 1], ['name' => 'Embalagem', 'cost' => 2, 'quantity' => 1], ]); $this->createProduct($ecommerce, 'Smartwatch Apple Watch SE', 'WATCH-001', 'Wearables', [ ['name' => 'Custo do relógio', 'cost' => 220, 'quantity' => 1], ['name' => 'Embalagem premium', 'cost' => 8, 'quantity' => 1], ]); $this->createProduct($ecommerce, 'Carregador USB-C 65W', 'ACC-001', 'Acessórios', [ ['name' => 'Custo do carregador', 'cost' => 18, 'quantity' => 1], ['name' => 'Embalagem', 'cost' => 1, 'quantity' => 1], ]); // ===================================================================== // NEGÓCIO 2: CONSULTORIA DE TI (Apenas Serviços) // ===================================================================== $consultoria = BusinessSetting::create([ 'user_id' => $userId, 'name' => 'DevPro Consultoria', 'currency' => 'EUR', 'business_type' => 'services', 'employees_count' => 2, 'hours_per_week' => 40, 'working_days_per_week' => 5, 'working_days_per_month' => 22, 'productivity_rate' => 75, 'monthly_revenue' => 18000, 'fixed_expenses' => 3500, 'tax_rate' => 21, 'price_includes_tax' => false, 'vat_rate' => 21, 'sales_commission' => 0, 'card_fee' => 0, 'other_variable_costs' => 1, 'investment_rate' => 10, 'profit_margin' => 25, 'is_active' => true, ]); $consultoria->recalculateMarkup(); // Serviços da Consultoria (duração em minutos) $this->createService($consultoria, 'Desenvolvimento Web - React', 'DEV-001', 'Desenvolvimento', [ ['name' => 'Infraestrutura cloud', 'cost' => 5, 'quantity' => 1], ['name' => 'Licenças software', 'cost' => 3, 'quantity' => 1], ], 480); // 8 horas $this->createService($consultoria, 'Consultoria Arquitetura Cloud', 'CONS-001', 'Consultoria', [ ['name' => 'Ferramentas de análise', 'cost' => 10, 'quantity' => 1], ], 240); // 4 horas $this->createService($consultoria, 'Manutenção Mensal WordPress', 'MAINT-001', 'Manutenção', [ ['name' => 'Hosting dedicado', 'cost' => 15, 'quantity' => 1], ['name' => 'Backup automático', 'cost' => 5, 'quantity' => 1], ], 180); // 3 horas $this->createService($consultoria, 'Setup E-commerce Shopify', 'SETUP-001', 'Implementação', [ ['name' => 'Tema premium', 'cost' => 150, 'quantity' => 1], ['name' => 'Apps necessários', 'cost' => 50, 'quantity' => 1], ], 1200); // 20 horas $this->createService($consultoria, 'Auditoria de Segurança', 'SEC-001', 'Segurança', [ ['name' => 'Ferramentas de scan', 'cost' => 25, 'quantity' => 1], ['name' => 'Relatório detalhado', 'cost' => 10, 'quantity' => 1], ], 600); // 10 horas // ===================================================================== // NEGÓCIO 3: GRÁFICA E DESIGN (Produtos + Serviços) // ===================================================================== $grafica = BusinessSetting::create([ 'user_id' => $userId, 'name' => 'Print & Design Studio', 'currency' => 'EUR', 'business_type' => 'both', 'employees_count' => 4, 'hours_per_week' => 44, 'working_days_per_week' => 6, 'working_days_per_month' => 26, 'productivity_rate' => 80, 'monthly_revenue' => 28000, 'fixed_expenses' => 6200, 'tax_rate' => 21, 'price_includes_tax' => true, 'vat_rate' => 21, 'sales_commission' => 2, 'card_fee' => 1.2, 'other_variable_costs' => 3, 'investment_rate' => 8, 'profit_margin' => 20, 'is_active' => true, ]); $grafica->recalculateMarkup(); // Produtos da Gráfica $this->createProduct($grafica, 'Cartões de Visita (500 unid)', 'CARD-001', 'Impressos', [ ['name' => 'Papel couché 300g', 'cost' => 8, 'quantity' => 1], ['name' => 'Tinta e impressão', 'cost' => 12, 'quantity' => 1], ['name' => 'Corte e acabamento', 'cost' => 5, 'quantity' => 1], ]); $this->createProduct($grafica, 'Banner Roll-up 85x200cm', 'BANNER-001', 'Grandes Formatos', [ ['name' => 'Lona impressa', 'cost' => 25, 'quantity' => 1], ['name' => 'Estrutura roll-up', 'cost' => 35, 'quantity' => 1], ['name' => 'Bolsa de transporte', 'cost' => 8, 'quantity' => 1], ]); $this->createProduct($grafica, 'Flyers A5 (1000 unid)', 'FLYER-001', 'Impressos', [ ['name' => 'Papel couché 150g', 'cost' => 15, 'quantity' => 1], ['name' => 'Impressão offset', 'cost' => 20, 'quantity' => 1], ]); $this->createProduct($grafica, 'Catálogo 20 páginas', 'CAT-001', 'Impressos', [ ['name' => 'Papel interior', 'cost' => 30, 'quantity' => 1], ['name' => 'Capa dura', 'cost' => 15, 'quantity' => 1], ['name' => 'Encadernação', 'cost' => 10, 'quantity' => 1], ['name' => 'Impressão', 'cost' => 45, 'quantity' => 1], ]); // Serviços da Gráfica $this->createService($grafica, 'Design de Logotipo', 'LOGO-001', 'Design', [ ['name' => 'Banco de imagens', 'cost' => 5, 'quantity' => 1], ['name' => 'Fontes premium', 'cost' => 10, 'quantity' => 1], ], 360); // 6 horas $this->createService($grafica, 'Design de Embalagem', 'PACK-001', 'Design', [ ['name' => 'Mockups 3D', 'cost' => 15, 'quantity' => 1], ], 720); // 12 horas $this->createService($grafica, 'Identidade Visual Completa', 'BRAND-001', 'Branding', [ ['name' => 'Manual de marca', 'cost' => 20, 'quantity' => 1], ['name' => 'Arquivos fonte', 'cost' => 10, 'quantity' => 1], ['name' => 'Aplicações básicas', 'cost' => 15, 'quantity' => 1], ], 1500); // 25 horas $this->createService($grafica, 'Design de Post Redes Sociais', 'SOCIAL-001', 'Marketing', [ ['name' => 'Templates Canva Pro', 'cost' => 2, 'quantity' => 1], ], 60); // 1 hora $this->command->info('Business examples seeded successfully!'); $this->command->info('- TechStore (Products): ' . $ecommerce->productSheets()->count() . ' products'); $this->command->info('- DevPro (Services): ' . $consultoria->serviceSheets()->count() . ' services'); $this->command->info('- Print & Design (Both): ' . $grafica->productSheets()->count() . ' products, ' . $grafica->serviceSheets()->count() . ' services'); } /** * Create a product with items */ private function createProduct(BusinessSetting $setting, string $name, string $sku, string $category, array $items): ProductSheet { $product = ProductSheet::create([ 'user_id' => $setting->user_id, 'business_setting_id' => $setting->id, 'name' => $name, 'sku' => $sku, 'category' => $category, 'currency' => $setting->currency, 'is_active' => true, ]); foreach ($items as $item) { ProductSheetItem::create([ 'product_sheet_id' => $product->id, 'name' => $item['name'], 'amount' => $item['cost'], 'quantity' => $item['quantity'], 'unit_cost' => $item['cost'], 'type' => 'product_cost', ]); } // Recalculate totals $product->refresh(); $product->cmv_total = $product->items->sum(fn($i) => ($i->amount ?? $i->unit_cost) * $i->quantity); $product->sale_price = $product->calculateSalePrice($setting); $product->final_price = $product->calculateFinalPrice(); $product->save(); return $product; } /** * Create a service with items */ private function createService(BusinessSetting $setting, string $name, string $code, string $category, array $items, int $durationMinutes): ServiceSheet { // Calculate CSV $totalCsv = collect($items)->sum(fn($i) => $i['cost'] * $i['quantity']); $service = ServiceSheet::create([ 'user_id' => $setting->user_id, 'business_setting_id' => $setting->id, 'name' => $name, 'code' => $code, 'category' => $category, 'duration_minutes' => $durationMinutes, 'total_csv' => $totalCsv, 'premium_multiplier' => 1.0, 'psychological_pricing' => false, 'is_active' => true, ]); foreach ($items as $item) { ServiceSheetItem::create([ 'service_sheet_id' => $service->id, 'name' => $item['name'], 'type' => 'supply', 'unit_cost' => $item['cost'], 'quantity_used' => $item['quantity'], ]); } // Recalculate pricing $service->refresh(); $service->fixed_cost_portion = $service->calculateFixedCostPortion(); $service->calculated_price = $service->calculatePrice(); $service->contribution_margin = $service->calculateContributionMargin(); $service->margin_percentage = $service->calculated_price > 0 ? round(($service->contribution_margin / $service->calculated_price) * 100, 2) : 0; $service->save(); return $service; } }