예제 #1
0
 public function destroy($Id)
 {
     $id = base64_decode($Id);
     $personal = Personal::find($id);
     $personal->delete();
     // Para restaurar es con el metodo restore()
     \Session::flash('message', 'Usuario Borrado Correctamente');
     return Redirect('personal');
 }
예제 #2
0
 public function postindex(Request $request)
 {
     $id_cod = $request->input('id_cod');
     $hora = $request->input('hora');
     $per = Personal::where('id', $id_cod)->first();
     if ($per) {
         $id = DB::table("hora")->insertGetId(array('hora' => $hora));
         DB::table("registra")->insertGetId(array('id_e' => $id_cod, 'id_hor' => $id, 'fecha_ac' => date('y-m-d')));
         return response()->json(array('msg' => "<h1>" . $per->nombre . " Registrado exitosamente</h1>"));
     } else {
         return response()->json(array('msg' => "<h1>No existe el codigo " . $id_cod . "</h1>"));
     }
 }
예제 #3
0
 public function postRegistrarPersonal(Request $request)
 {
     $personal = Personal::create(['user_id' => Auth::user()->id, 'full_name' => $request->get('nombres'), 'dni' => $request->get('dni'), 'email' => $request->get('email'), 'phone' => $request->get('telefono'), 'address' => $request->get('direccion')]);
     $usuario = User::create(['full_name' => $request->get('nombres'), 'username' => $request->get('usuario'), 'password' => Hash::make($request->get('clave'))]);
     $personal->save();
     $usuario->save();
     return redirect('personal/contratacion');
 }
예제 #4
0
 public function prueba()
 {
     $personal = Personal::all();
     return User::all()->union($personal);
 }
예제 #5
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('personals')->delete();
     Personal::create(array('prefix' => 'Mr.', 'user_id' => 1, 'firstname' => 'Hyginus', 'middlename' => 'miskoom', 'lastname' => 'Horson', 'gender' => 'male', 'marital_status' => 'married', 'dob' => '1995-10-05', 'country_address' => 156, 'office_state' => 32, 'address' => 'Old Airport road, Jos, Plateau State', 'country_office_address' => 156, 'lga_address' => 611, 'phone' => '08036914016', 'email' => '*****@*****.**', 'occupation' => 'teacher', 'market_associated' => 'main market', 'park_associated' => 'bukuru park', 'office_lga' => 611, 'drivers_license' => 'something2', 'national_id' => 'something', 'passport_number' => 'A025689H', 'disability' => 'blind', 'nationality' => 156, 'jtbtin' => '3887464738', 'origin_state' => 32, 'lga' => 611, 'tin' => '33434343434', 'workplace_name' => '0123456789'));
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $Request)
 {
     $Persona = Personal::findOrFail($Request->id);
     $Persona->nombre = $Request->nombres;
     $Persona->documento = $Request->documento;
     $Persona->idTipoDocumento = $Request->tipoDocumento;
     $Persona->primerApellido = $Request->prApellido;
     $Persona->segundoApellido = $Request->sgApellido;
     $Persona->fechaNacimiento = $Request->fechaNaci;
     $Persona->idDepartamento = $Request->departamento;
     $Persona->idMunicipio = $Request->municipio;
     $Persona->tipoSangre = $Request->sangre;
     $Persona->tipoRh = $Request->rh;
     $Persona->direccion = $Request->direccion;
     $Persona->correo = $Request->email;
     $Persona->telefono = $Request->telfijo;
     $Persona->telefonoMovil = $Request->telMovil;
     $Persona->idProfesion = $Request->profesion;
     $Persona->fechaTitulo = $Request->fechaTitulo;
     $Persona->otrosEstudios = $Request->otrosEstu;
     $Persona->finalizacion = $Request->fechaFin;
     $Persona->obtenido = "Si";
     $Persona->idCargo = $Request->cargo;
     $Persona->idTipoContrato = $Request->contrato;
     $Persona->fechaContrato = $Request->fechaContra;
     $Persona->estado = $Request->estado;
     $Persona->save();
     $cargo = Cargo::all();
     $profesion = Profesion::all();
     $tipoDocumento = TipoDocumento::all();
     $tipoContrato = TipoContrato::all();
     $departamento = Departamento::all();
     $array = array();
     array_push($array, $tipoDocumento, $departamento, $profesion, $cargo, $tipoContrato);
     return redirect()->route('show_personal_path', ['array' => $array])->withErrors('El Empleado se modifico satisfactoriamente.');
 }