public function edit($id) { $usuario = Usuario::find($id); $usuario->empleado; $empleados = Empleado::orderBy('nombres', 'ASC')->lists('nombres', 'id'); return view('admin.usuarios.edit')->with('usuario', $usuario)->with('empleados', $empleados); }
/** * Run the database seeds. * * @return void */ public function run() { $faker = Faker\Factory::create('es_ES'); $empleados = \App\Empleado::all()->lists('rut')->toArray(); $proyectos = \App\Proyecto::all()->lists('id')->toArray(); for ($i = 0; $i < 25; $i++) { DB::table('informes')->insert(['texto' => $faker->realText(255), 'fecha_creacion' => $faker->date(), 'fecha_ultima_revision' => 'now', 'proyecto_id' => $faker->randomElement($proyectos), 'empleado_rut' => $faker->randomElement($empleados), 'created_at' => 'now', 'updated_at' => 'now']); } }
/** * Run the database seeds. * * @return void */ public function run() { $faker = Faker\Factory::create('es_ES'); $empleados = \App\Empleado::all()->lists('rut')->toArray(); $proyectos = \App\Proyecto::all()->lists('id')->toArray(); for ($i = 0; $i < 20; $i++) { DB::table('empleados_proyectos')->insert(['proyecto_id' => $faker->randomElement($proyectos), 'empleado_rut' => $faker->randomElement($empleados), 'created_at' => 'now', 'updated_at' => 'now']); } }
/** * Show the application dashboard to the user. * * @return Response */ public function indexOrm() { $result = Empleado::first(); $result = dd($result); /* $result = \DB::table('empleado')->get(); */ return $result; //"Testo controller de prueba";//view('Empleado'); }
public function run() { $faker = Faker\Factory::create('es_ES'); $parentesco = ['Hijo', 'Conyugue', 'Primo', 'Suegro', 'Hermano', 'Padre/Madre', 'Abuelo/Abuela', 'Tio', 'Sobrino', 'Cunado']; $ocupacion = ['Trabajador dependiente', 'Trabajador independiente', 'Cesante', 'Estudiante', 'Sin ocupacion', 'Jubilado']; $rut_empleados = \App\Empleado::all()->lists('rut'); for ($i = 0; $i < 60; $i++) { DB::table('cargas')->insert(['rut' => $faker->unique()->numerify('##.###.###-#'), 'nombres' => $faker->firstName, 'apellido_paterno' => $faker->lastName, 'apellido_materno' => $faker->lastName, 'fecha_nacimiento' => $faker->date($format = 'Y-m-d', $max = 'now'), 'parentesco' => $faker->randomElement($parentesco), 'ocupacion' => $faker->randomElement($ocupacion), 'rut_empleado' => $faker->randomElement($rut_empleados), 'created_at' => 'now', 'updated_at' => 'now']); } }
public function testingShowFunction() { $usuario = Cuenta::where('rut', '=', '11.111.111-1')->first(); //Busca el usuario de prueba $this->be($usuario); //Conecta con el usuario de pruebas $empleado = Empleado::all()->random(1); //Busca una tupla de empleado aleatoria en la db $respuesta = $this->action('GET', 'EmpleadoController@show', ['id' => $empleado->id]); $this->assertEquals(200, $respuesta->getStatusCode()); }
/** * Create a new user instance after a valid registration. * * @param array $data * @return Cuenta */ public function create(array $data) { $cuenta = new Cuenta(); $cuenta->setAttribute('rut', $data['rut']); $cuenta->setAttribute('password', bcrypt($data['password'])); $cuenta->save(); $empleado = Empleado::find($data['rut']); $empleado->setAttribute('id_cuenta', $cuenta->id); $empleado->save(); return $cuenta; }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { Empleado::destroy($id); return redirect()->route('admin.empleados.index'); }
public function borrar($rut) { try { $empleado = Empleado::all()->find($rut); $empleado->forceDelete(); Flash::success('Empleado eliminado con exito'); return redirect('empleados/desvinculados'); } catch (QueryException $e) { Flash::error('Empleado no pudo ser eliminado'); return redirect('empleado/desvinculado'); } }
public function destroy($rut_empleado) { $empleado = Empleado::find($rut_empleado); $empleado->delete(); return redirect('empleados'); }