/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update($id, ProfessorRequest $request) { $data = $request->all(); $professor = ProfessorQuery::create()->findPK($id); $professor->fromArray($data); $professor->save(); flash()->success("UPDATED"); session(['attribute' => \Lang::get('general.PROFESSOR')]); return redirect($this->main_page); }
/** * Update the specified resource in storage. * * @param \App\Http\Requests\ProfessorRequest $request * @param int $id * @return \Symfony\Component\HttpFoundation\Response */ public function update(ProfessorRequest $request, $id) { /** @var Professor $professor */ $professor = Professor::findOrFail($id)->load('personalDetails'); if (Gate::denies('update', $professor)) { Flash::error('Ud. no tiene permisos para esta acción.'); return Redirect::back(); } $professor->title_id = $request->input('title_id'); $professor->save(); return Redirect::route('users.show', $professor->personalDetails->user_id); }