/** * Update the specified resource in storage. * * @param \Gladiator\Requests\FeaturedReportbackRequest $request * @param \Gladiator\Models\Competition $competition * @param \Gladiator\Models\Message $message * @return \Illuminate\Http\Response */ public function updateFeaturedReportback(FeaturedReportbackRequest $request, Competition $competition, Message $message) { $reportback = FeaturedReportback::where('competition_id', '=', $competition->id)->where('message_id', '=', $message->id)->first(); // @TODO: Make a function for this, potentially move it out of this controller. if (!isset($reportback)) { $reportback = new FeaturedReportback(); $reportback->competition_id = $competition->id; $reportback->message_id = $message->id; $reportback->save(); } $reportback->fill($request->all())->save(); return redirect()->route('competitions.message', [$competition, $competition->contest])->with('status', 'Featured reportback has been updated!'); }