Corección de error al escribir

This commit is contained in:
Juan Felipe Zapata Moreno 2025-11-25 13:01:54 -06:00
parent 01cd737b29
commit f070777945

View File

@ -449,9 +449,9 @@ private function processPackageFromText(SimCard $sim, array $row)
); );
$hasActivePackage = $sim->packages() $hasActivePackage = $sim->packages()
->wherePivot('package_id', $package->id) ->wherePivot('package_id', $package->id)
->wherePivot('is_active', true) ->wherePivot('is_active', true)
->exists(); ->exists();
if (!$hasActivePackage) { if (!$hasActivePackage) {
$sim->packages()->attach($package->id, [ $sim->packages()->attach($package->id, [
@ -490,12 +490,16 @@ private function getOrCreatePackage(string $type, float $price): Packages
return $this->packageCache[$cacheKey]; return $this->packageCache[$cacheKey];
} }
$package = Packages::create([ $package = Packages::firstOrCreate(
'name' => $type, [
'price' => (float) $price, 'name' => $type,
'period' => 0, 'price' => (float) $price
'data_limit' => 0, ],
]); [
'period' => 0,
'data_limit' => 0,
]
);
if ($package->wasRecentlyCreated) { if ($package->wasRecentlyCreated) {
$this->stats['packages_created']++; $this->stats['packages_created']++;