public function postStoreAndUpdate(ConfirmacionLlegadaRequest $Request) { $confirmacion = ConfirmacionLlegada::firstOrNew(['postulante' => $Request->get('postulante')]); $confirmacion->fill($Request->all()); $confirmacion->save(); return response()->json(['message' => 'sus datos de confirmaciĆ³n de llegada se han almacenado correctamente.']); }
/** * 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); }