/** * Update the specified resource in storage. * @param type $id * @param type Help_topic $topic * @param type HelptopicUpdate $request * @return type Response */ public function update($id, Help_topic $topic, HelptopicUpdate $request) { try { $topics = $topic->whereId($id)->first(); /* Check whether function success or not */ if ($topics->fill($request->input())->save() == true) { /* redirect to Index page with Success Message */ return redirect('helptopic')->with('success', 'Helptopic Updated Successfully'); } else { /* redirect to Index page with Fails Message */ return redirect('helptopic')->with('fails', 'Helptopic can not Updated'); } } catch (Exception $e) { /* redirect to Index page with Fails Message */ return redirect('helptopic')->with('fails', 'Helptopic can not Create'); } }
/** * Update the specified resource in storage. * @param type $id * @param type Help_topic $topic * @param type HelptopicUpdate $request * @return type Response */ public function update($id, Help_topic $topic, HelptopicUpdate $request) { // dd($request); try { $topics = $topic->whereId($id)->first(); if ($request->custom_form) { $custom_form = $request->custom_form; } else { $custom_form = null; } if ($request->auto_assign) { $auto_assign = $request->auto_assign; } else { $auto_assign = null; } /* Check whether function success or not */ $topics->fill($request->except('custom_form', 'auto_assign'))->save(); $topics->custom_form = $custom_form; $topics->auto_assign = $auto_assign; $topics->save(); /* redirect to Index page with Success Message */ return redirect('helptopic')->with('success', 'Helptopic Updated Successfully'); } catch (Exception $e) { /* redirect to Index page with Fails Message */ return redirect('helptopic')->with('fails', 'Helptopic can not Update' . '<li>' . $e->errorInfo[2] . '</li>'); } }