u
This commit is contained in:
@@ -316,6 +316,25 @@ class ShowPromociones extends Component
|
|||||||
'confirmButtonText' => 'Sí, comprar.',
|
'confirmButtonText' => 'Sí, comprar.',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
|
||||||
|
|
||||||
|
$descuento = Saldo::where('usuario_id', Auth::user()->id)->first();
|
||||||
|
$saldo_anterior = $descuento->valor;
|
||||||
|
$nuevo_saldo = $saldo_anterior - ($this->precioAhora *$this->cantidad_comprarPromo);
|
||||||
|
$cobro = $descuento->update(['valor' => $nuevo_saldo]);
|
||||||
|
//dd($cobro);
|
||||||
|
if ($cobro) {
|
||||||
|
$historial->update(['estado' => 'activo']);
|
||||||
|
$this->modalComprarPromo = false;
|
||||||
|
$this->credenciales($historial);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$eliminar = Historial_cuenta::whereIn('id',$this->n)->delete();
|
||||||
|
//dd($eliminar);
|
||||||
|
$this->alert('warning', 'Error en el cobro, comuniquese con soporte!', [
|
||||||
|
'position' => 'top']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user