/** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(FacultyRequest $request, $id) { $faculty = Faculty::findOrFail($id); $faculty->fill($request->all())->save(); Flash::success("Faculty's details has been updated"); return redirect('faculty'); }
/** * Update the specified resource in Faculty. * * @param FacultyRequest $request * @param int $id * @return Response */ public function update(FacultyRequest $request, $id) { $faculty = Faculty::find($id); $faculty->update(['name' => $request->name, 'designation' => $request->designation, 'email' => $request->email, 'phone' => $request->phone, 'website' => $request->website, 'address' => $request->address, 'education_leave' => $request->has('education_leave') ? 1 : 0, 'bio' => e($this->htmlEditor->parseHtml($request->bio))]); //Profile Picture if ($request->hasFile('avatar')) { $this->saveProfileImage($request->file('avatar'), $faculty->id); } Flash::success('Faculty dpdated successfully.'); return redirect('/admin/faculty'); }
/** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(FacultyRequest $request, $id) { $input = $request->except('_method', '_token'); $faculty = Faculty::findOrFail($id); if ($faculty->update($input)) { $faculty->subjects()->sync($request->input('subject_list')); return redirect('/faculties'); } }