Пример #1
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Clan\Models\PYPSeason  $season
  * @param  \Clan\Models\PYPTeam  $team
  * @param  \Clan\Http\Requests\Admin\PYP\Team\Update  $request
  * @return Response
  */
 public function update(SwcSeason $season, SwcCompetition $comp, Requests\Admin\Swc\Competition\Update $request)
 {
     $this->db->beginTransaction();
     try {
         $comp->update($request->input());
         $comp->members()->detach();
         foreach ($request->input('members') as $id => $member_id) {
             $member = Member::findOrFail($member_id);
             $comp->members()->attach($member->id);
         }
     } catch (Exception $e) {
         $this->db->rollback();
         throw $e;
     }
     $this->db->commit();
     return redirect(route('admin.swc.competition.show', [$season->getKey(), $comp->getKey()]))->with('successes', new MessageBag(['Successfully updates the competition']));
 }