/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { $examen = ExamenDocente::find($id)->where('id', $id)->with('carreras')->get(); $carreras = $this->carreraRepository->getModel()->all(); $detalles = ['examen' => $examen, 'carrera' => $carreras]; return Response()->json($detalles); }
public function crearExamen(Docente $request) { $examen = ExamenDocente::create($request->all()); $examen->carreras()->attach($request->get('carrera_list')); return $examen; }