/** * Store a newly created resource in storage. * * @param \App\Http\Requests\EventRequest $request * @param \App\Event $event * @return \Symfony\Component\HttpFoundation\Response */ public function store(EventRequest $request, Event $event) { /** @var Institute $institute */ $institute = Institute::findOrFail($request->input('institute_id')); $event->fill($request->all()); $institute->events()->save($event); return Redirect::route('events.index'); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Symfony\Component\HttpFoundation\Response */ public function destroy($id) { $title = Institute::findOrFail($id); if ($this->destroyPrototype($title, 'delete', 'Instituto')) { return Redirect::route('institutes.index'); } return Redirect::route('institutes.show', $id); }
/** * Elimina la relacion entre un profesor y un instituto * * @param int $professorId * @param int $instituteId * * @return \Illuminate\Http\RedirectResponse */ public function destroyProfessorInstitute($professorId, $instituteId) { /** @var Institute $institute */ $institute = Institute::findOrFail($instituteId); $institute->professors()->detach([$professorId]); Flash::success('Profesor eliminado correctamente.'); return Redirect::route('institutes.show', $institute->id); }