/**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  *
  * @return Response
  */
 public function update($id, Request $request)
 {
     $this->validate($request, ['razon_de_ser_la_asignatura' => 'required', 'por_que_se_ensena_y_por_que_esta_dentro_del_plan_de_estudios' => 'required', 'en_que_medida_contribuye_a_la_formacion_integral_del_profesional' => 'required']);
     $justificaiongeneral = JustificaionGeneral::findOrFail($id);
     $justificaiongeneral->update($request->all());
     Session::flash('flash_message', 'JustificaionGeneral updated!');
     $PropositosGenerale = PropositosGenerale::where("plan_global_id", "=", $justificaiongeneral->plan_global_id)->first();
     return redirect('admin/propositosgenerales/' . $PropositosGenerale->id . '/edit');
 }
 public function printplanglobal($id)
 {
     $this->edit($id);
     //$materium = Materium::findOrFail($id);
     //   $pdf = \PDF::loadView('admin.planglobal.print', array('data' => $data) )
     //         ->setOrientation('portrait')->setPaper('a4');
     // return $pdf->stream('PlanGlobal.pdf');
     $planglobal = PlanGlobal::findOrFail($id);
     $grupo = Grupo::where("materium_id", "=", $planglobal->materium_id)->where("control_de_plan_global", "=", 1)->first();
     if (empty($grupo)) {
         $docentep = Docente::where("nombre", "=", "por designar")->first();
         $grupo = new Grupo();
         $grupo->materium_id = $planglobal->materium_id;
         $grupo->docente_id = $docentep->id;
         $grupo->control_de_plan_global = 1;
         $grupo->save();
         $grupo = Grupo::findOrFail($grupo->id);
     }
     $docente = Docente::where("id", "=", $grupo->docente_id)->first();
     $justificaiongeneral = JustificaionGeneral::where("plan_global_id", "=", $id)->first();
     $propositosgenerale = PropositosGenerale::where("plan_global_id", "=", $id)->first();
     $objetivosgenerale = ObjetivosGenerale::where("plan_global_id", "=", $id)->first();
     $evaluacion = Evaluacion::where("plan_global_id", "=", $id)->first();
     $unidades = $planglobal->unidade;
     $view = view('admin.planglobal.print', compact('planglobal', 'docente', 'justificaiongeneral', 'propositosgenerale', 'objetivosgenerale', 'unidades', 'evaluacion'));
     $pdf = App::make('dompdf.wrapper');
     $pdf->loadHTML($view);
     return $pdf->stream('PlanGlobal.pdf');
 }