You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.0 KiB
48 lines
1.0 KiB
1 year ago
|
<?php
|
||
|
|
||
|
namespace App\Http\Controllers\RecursosHumanos;
|
||
|
|
||
|
use App\Http\Controllers\Controller;
|
||
|
use App\Models\ArchivosNominas;
|
||
|
use Illuminate\Http\Request;
|
||
|
use Illuminate\Support\Facades\Auth;
|
||
|
use Illuminate\Support\Facades\Storage;
|
||
|
|
||
|
|
||
|
class CargarPdfsController extends Controller
|
||
|
{
|
||
|
|
||
|
public function index()
|
||
|
{
|
||
|
|
||
|
return view('recursos_humanos/cargar_pdfs');
|
||
|
|
||
|
}
|
||
|
|
||
|
public function cargarArchivos( Request $request ){
|
||
|
|
||
|
$fk_id_users = Auth::user()->id;
|
||
|
|
||
|
foreach( $request->file('files') as $archivo ){
|
||
|
|
||
|
$nombreArchivo = $archivo->getClientOriginalName();
|
||
|
$claveEmpleado = explode('_',$nombreArchivo);
|
||
|
|
||
|
Storage::disk('public')->put( $nombreArchivo , \File::get( $archivo ));
|
||
|
|
||
|
ArchivosNominas::updateOrCreate([
|
||
|
'nombre_archivo' => $nombreArchivo
|
||
|
],
|
||
|
['fk_id_users' => $fk_id_users,
|
||
|
'clave_empleado' => $claveEmpleado[5]]
|
||
|
);
|
||
|
}
|
||
|
|
||
|
|
||
|
return 'exito!!!';
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|