public function postStoreAndUpdate(Guard $auth, Request $request) { $postulante = Postulante::where('user_id', $auth->id())->first(); $solicitudCurso = PreNuSolicitudCurso::firstOrNew(array('postulante' => $postulante->id)); $solicitudCurso->save(); $detalleSolicitud = new DetalleSolicitudCurso(); $detalleSolicitud->solicitud_curso = $solicitudCurso->id; $detalleSolicitud->asignatura = $request->get('asignatura'); $detalleSolicitud->save(); return response()->json(['message' => 'La asignatura se ha adjuntado a la solicitud de cursos.']); }