/** * Update the specified resource in storage. * * @param \Clan\Models\Event $event * @param \Clan\Http\Requests\Admin\Event\Update $request * @return Response */ public function update(Event $event, Requests\Admin\Event\Update $request) { $this->db->beginTransaction(); try { $event->update($request->input()); $event->members()->detach(); foreach ($request->input('members') as $id => $member_id) { $member = Member::findOrFail($member_id); $event->members()->attach($member->id); } } catch (Exception $e) { $this->db->rollback(); throw $e; } $this->db->commit(); return redirect(route('admin.event.show', [$event->getKey()]))->with('successes', new MessageBag(['Successfully updated the event'])); }
/** * 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'])); }