I need to pass a database field from my controller to print it in a sweetalert modal but I can't get it to print it
The field is captured through a condition:
$nombre_empleado = Empleado::where('codigo_empleado', $asistencia->codigo_empleado)->get('nombre');
But I've tried passing it to the view to print it to swal and it doesn't work either way:
return redirect()->route('home')
->with('store_result', 'nok')
->with('empleado', $nombre_empleado);
In swal I have tried with and without quotes, in a thousand ways but I am not successful...
Swal.fire({
icon: 'success',
title: 'Entrada registrada',
html: 'Hora: ' + moment().format('HH:mm:ss') + '<br>' + ' empleado',
})
Any ideas?