update
This commit is contained in:
@@ -5,8 +5,11 @@ namespace App\Imports;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use App\Models\Cuentas;
|
||||
use App\Models\Historial_cuenta;
|
||||
use App\Models\Notificacion;
|
||||
use App\Models\Pendientes;
|
||||
use App\Models\Servicio;
|
||||
use App\Notifications\NotificacionPendiente;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Maatwebsite\Excel\Concerns\ToModel;
|
||||
|
||||
class UsersImport implements ToModel
|
||||
@@ -39,12 +42,25 @@ class UsersImport implements ToModel
|
||||
->get();
|
||||
|
||||
foreach ($cuentasPendientes as $i => $cuentaPendiente) {
|
||||
$servicioName = $cuentaPendiente->servicio->nombre;
|
||||
|
||||
$historial_cuenta = new Historial_cuenta();
|
||||
$historial_cuenta->historial_id = $cuentaPendiente->historial_id;
|
||||
$historial_cuenta->cuenta_id = $cuenta->id;
|
||||
$historial_cuenta->perfil = $i + 1;
|
||||
$historial_cuenta->save();
|
||||
$cuentaPendiente->update(['estado' => 'cerrado']);
|
||||
|
||||
$historial_cuenta->historial->vendedor->notify(new NotificacionPendiente($servicioName));
|
||||
|
||||
$consulta = new Notificacion();
|
||||
$consulta->remitente_id = Auth::user()->id;
|
||||
$consulta->destinatario_id = $historial_cuenta->historial->vendedor_id;
|
||||
$consulta->titulo = "Licencia asignada para $servicioName";
|
||||
$consulta->descripcion = "La licencia de $servicioName ha sido activada y ahora puedes utilizar tu cuenta sin problemas.";
|
||||
$consulta->estado = true;
|
||||
$consulta->todos = false;
|
||||
$consulta->save();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user