/**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker::create();
     $preUach = PreUach::all();
     $samples_temp = [];
     foreach ($preUach as $item) {
         $samples_temp[] = ['postulante' => $item->postulante, 'nombre' => $faker->lastName . ' ' . $faker->firstName, 'indicaciones' => $faker->paragraph($nbSentences = 3, $variableNbSentences = true)];
     }
     Asistente::insert($samples_temp);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker::create();
     $preUach = PreUach::all();
     $samples_temp = [];
     foreach ($preUach as $item) {
         $samples_temp[] = ['postulante' => $item->postulante, 'persona_matricula' => $faker->lastName . ' ' . $faker->firstName, 'fecha_matricula' => $faker->dateTimeBetween($startDate = '-5 months', $endDate = 'now')];
     }
     Declaracion::insert($samples_temp);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker::create();
     $preUach = PreUach::all();
     $samples_temp = [];
     foreach ($preUach as $item) {
         $samples_temp[] = ['postulante' => $item->postulante, 'carrera' => $faker->numberBetween($min = 1, $max = 20), 'anio_ingreso' => $faker->year($max = 'now'), 'ranking' => $faker->randomFloat($nbMaxDecimals = NULL, $min = 0, $max = 100), 'beneficios' => $faker->sentence($nbWords = 8, $variableNbWords = true)];
     }
     PreUEstudioActual::insert($samples_temp);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker::create();
     $preUach = PreUach::all();
     $tipoResponsable = array('Representante Legal', 'Contacto');
     $samples_temp = [];
     foreach ($preUach as $item) {
         $samples_temp[] = ['postulante' => $item->postulante, 'nombre' => $faker->lastName . ' ' . $faker->firstName, 'tipo' => $tipoResponsable[$faker->numberBetween($min = 0, $max = 1)], 'telefono_1' => $faker->phoneNumber, 'telefono_2' => $faker->phoneNumber, 'parentesco' => $faker->word, 'email' => $faker->unique->email, 'direccion' => $faker->address];
     }
     PreUResponsable::insert($samples_temp);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker::create();
     $preUach = PreUach::all();
     $samples_temp = [];
     foreach ($preUach as $item) {
         $samples_temp[] = ['postulante' => $item->postulante, 'pga' => $faker->randomFloat($nbMaxDecimals = NULL, $min = 0, $max = 100), 'motivo' => '', 'fecha' => $faker->dateTimeBetween($startDate = '-30 days', $endDate = 'now')];
     }
     foreach ($preUach as $item) {
         if ($faker->numberBetween($min = 0, $max = 1) == 0) {
             $samples_temp[] = ['postulante' => $item->postulante, 'pga' => '', 'motivo' => $faker->paragraph($nbSentences = 3, $variableNbSentences = true), 'fecha' => $faker->dateTimeBetween($startDate = '-30 days', $endDate = 'now')];
         }
     }
     Homologacion::insert($samples_temp);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker::create();
     $preUach = PreUach::all();
     $samples_temp = [];
     foreach ($preUach as $item) {
         if ($faker->numberBetween($min = 0, $max = 1) == 0) {
             $llegada = new ConfirmacionLlegada();
             $fLlegada = $faker->dateTimeBetween($startDate = '-5 months', $endDate = 'now');
             $fInicioCurso = $faker->dateTimeBetween($startDate = $fLlegada, $endDate = 'now');
             $fTerminoCurso = $faker->dateTimeBetween($startDate = $fInicioCurso, $endDate = 'now');
             $samples_temp[] = ['postulante' => $item->postulante, 'fecha_llegada' => $fLlegada, 'fecha_inicio_curso' => $fInicioCurso, 'fecha_termino_curso' => $fTerminoCurso];
         }
     }
     ConfirmacionLlegada::insert($samples_temp);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker::create();
     $preUach = PreUach::all();
     foreach ($preUach as $item) {
         $cExtranjero = new ContactoExtranjero();
         $cExtranjero->postulante = $item->postulante;
         $cExtranjero->conocido_extranjero = $faker->paragraph($nbSentences = 3, $variableNbSentences = true);
         $cExtranjero->direccion = $faker->address;
         $cExtranjero->telefono_1 = $faker->phoneNumber;
         $cExtranjero->telefono_2 = $faker->phoneNumber;
         $cExtranjero->nombre_seguro = $faker->sentence($nbWords = 3, $variableNbWords = true);
         $cExtranjero->validez_seguro = $faker->dateTimeBetween($startDate = '-2 years', $endDate = 'now');
         $cExtranjero->numero_seguro = $faker->swiftBicNumber;
         $cExtranjero->nombre_hospital = $faker->sentence($nbWords = 3, $variableNbWords = true);
         $cExtranjero->direccion_hospital = $faker->address;
         $cExtranjero->save();
     }
 }
 /**
  * Run the database seeds. 
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker::create();
     $pregrado = Pregrado::all();
     $samples_temp_no_uach = [];
     $samples_temp_uach = [];
     foreach ($pregrado as $item) {
         if ($faker->numberBetween($min = 0, $max = 1) == 0) {
             $item->procedencia = 'NO UACH';
             $samples_temp_no_uach[] = ['postulante' => $item->postulante];
             $item->save();
         } else {
             $item->procedencia = 'UACH';
             $samples_temp_uach[] = ['postulante' => $item->postulante, 'email_institucional' => $faker->email, 'grupo_sanguineo' => $faker->asciify('GS ***'), 'enfermedades' => $faker->sentence($nbWords = 3, $variableNbWords = true), 'telefono' => $faker->phoneNumber, 'ciudad' => $faker->numberBetween($min = 1, $max = 42), 'direccion' => $faker->address];
             $item->save();
         }
     }
     PreNoUach::insert($samples_temp_no_uach);
     PreUach::insert($samples_temp_uach);
 }
 public function putUpdate(CretePostulacionRequest $request, Guard $auth)
 {
     $postulante = Postulante::firstOrNew(array('user_id' => $auth->id()));
     $mensaje = '';
     if ($postulante->tipo_estudio === 'Pregrado') {
         if ($request->get('tipo_estudio') === "Postgrado") {
             Pregrado::find($postulante->id)->delete();
         }
     }
     if ($postulante->tipo_estudio === 'Postgrado') {
         if ($request->get('tipo_estudio') === "Pregrado") {
             Postgrado::find($postulante->id)->delete();
         }
     }
     $postulante->fill($request->all());
     $postulante->save();
     $documento = DocumentoIdentidad::where('postulante', $postulante->id)->first();
     $documento->fill($request->all());
     $documento->save();
     // se verifica si el alumno va a postular a una carrera de pregrado o postgrado.
     if ($request->get('tipo_estudio') === 'Pregrado') {
         $pregrado = Pregrado::firstOrNew(array('postulante' => $postulante->id));
         $pregrado->procedencia = $request->get('procedencia');
         $pregrado->save();
         // se verifica si el estudiante es un alumno entrante o saliente.
         if ($request->get('procedencia') === 'UACH') {
             $preUach = PreUach::firstOrNew(array('postulante' => $postulante->id));
             $preUach->email_institucional = $request->get('email_institucional');
             $preUach->grupo_sanguineo = $request->get('grupo_sanguineo');
             $preUach->enfermedades = $request->get('enfermedades');
             $preUach->telefono = $request->get('telefono_2');
             $preUach->ciudad = $request->get('ciudad_2');
             $preUach->direccion = $request->get('direccion_2');
             $preUach->save();
         } else {
             $preNoUach = PreNoUach::firstOrCreate(array('postulante' => $postulante->id));
             //$preNoUach->save();
         }
         $mensaje = 'Su postulación se actualizó correctamente(' . $request->get('tipo_estudio') . ')';
     } else {
         $postgrado = Postgrado::firstOrNew(array('postulante' => $postulante->id));
         $postgrado->procedencia = $request->get('procedencia');
         $postgrado->titulo_profesional = $request->get('titulo_profesional');
         $postgrado->save();
         $mensaje = 'Su postulación se actualizó correctamente(' . $request->get('tipo_estudio') . ')';
     }
     return response()->json(['message' => $mensaje]);
 }