first(); if ($buildingFunction) { $formulaName = "{$buildingFunction->name} - Lantai {$floorNumber}"; RetributionFormula::updateOrCreate( [ 'building_function_id' => $buildingFunction->id, 'floor_number' => $floorNumber ], [ 'name' => $formulaName, 'formula_expression' => $fullFormulaExpression, 'description' => "Formula retribusi untuk {$buildingFunction->name} dengan {$floorNumber} lantai. Formula: {$fullFormulaExpression}", 'floor_number' => $floorNumber, 'luas_bangunan_rate' => $buildingFunction->base_tariff ?? 50000, 'is_active' => true ] ); $this->command->info("Created formula for: {$formulaName}"); } else { $this->command->warn("Building function not found: {$code}"); } } } $this->command->info('Retribution Formulas seeding completed for 5 floors!'); $this->command->info("Building functions processed: " . implode(', ', $buildingFunctionCodes)); $this->command->info("Floor calculation formula: {$floorCalculationFormula}"); $this->command->info("Full retribution formula: {$fullFormulaExpression}"); } }