예제 #1
0
 /**
  * Update the specified resource in storage.
  * @param type int $id
  * @param type Teams $team
  * @param type TeamUpdate $request
  * @return type Response
  */
 public function update($id, Teams $team, TeamUpdate $request)
 {
     try {
         $teams = $team->whereId($id)->first();
         //updating check box
         $alert = $request->input('assign_alert');
         $teams->assign_alert = $alert;
         $teams->save();
         //saving check box
         //updating whole field
         /* Check whether function success or not */
         if ($teams->fill($request->input())->save() == true) {
             /* redirect to Index page with Success Message */
             return redirect('teams')->with('success', 'Teams  Updated Successfully');
         } else {
             /* redirect to Index page with Fails Message */
             return redirect('teams')->with('fails', 'Teams  can not Update');
         }
     } catch (Exception $e) {
         /* redirect to Index page with Fails Message */
         return redirect('teams')->with('fails', 'Teams  can not Update');
     }
 }
예제 #2
0
 /**
  * Update the specified resource in storage.
  * @param type int $id
  * @param type Teams $team
  * @param type TeamUpdate $request
  * @return type Response
  */
 public function update($id, Teams $team, TeamUpdate $request)
 {
     $teams = $team->whereId($id)->first();
     //updating check box
     if ($request->team_lead) {
         $team_lead = $request->team_lead;
     } else {
         $team_lead = null;
     }
     $teams->team_lead = $team_lead;
     $teams->save();
     $alert = $request->input('assign_alert');
     $teams->assign_alert = $alert;
     $teams->save();
     //saving check box
     //updating whole field
     /* Check whether function success or not */
     try {
         $teams->fill($request->except('team_lead'))->save();
         /* redirect to Index page with Success Message */
         return redirect('teams')->with('success', 'Teams  Updated Successfully');
     } catch (Exception $e) {
         /* redirect to Index page with Fails Message */
         return redirect('teams')->with('fails', 'Teams  can not Update' . '<li>' . $e->errorInfo[2] . '</li>');
     }
 }