/** * @param ReplyRepo $replyRepo */ public function handle(ReplyRepo $replyRepo) { $reply = $replyRepo->findOrFail($this->reply_id); $reply->correct_answer = !$reply->correct_answer; $reply->save(); if (config('forum.events.fire')) { event(new BestAnswer($reply)); } }
/** * Execute the job. * * @param ReplyRepo $replyRepo * @param Mailer $mailer * @return void */ public function handle(ReplyRepo $replyRepo, Mailer $mailer) { $reply = $replyRepo->model(); $reply->fill($this->prepareData()); $reply->save(); if (config('config.forum.emails.fire')) { $this->sendEmail($mailer, $reply); } }
/** * Execute the job. * * @param ReplyRepo $replyRepo * @param Mailer $mailer * @return void */ public function handle(ReplyRepo $replyRepo, Mailer $mailer) { $reply = $replyRepo->model(); $reply->fill($this->prepareData()); $reply->save(); if (config('forum.emails.fire') && auth()->user()->id != $reply->user_id) { $this->sendEmail($mailer, $reply); } if (config('forum.broadcasting') && auth()->user()->id != $reply->user_id) { event(new NewReply($reply)); } }
/** * Execute the job. * * @param ReplyRepo $replyRepo * @param Mailer $mailer * * @return void */ public function handle(ReplyRepo $replyRepo, Mailer $mailer) { $reply = $replyRepo->model(); $reply->fill($this->prepareData()); $reply->save(); if (config('forum.emails.fire') && !$this->authUserIsOwner($reply->conversation)) { $this->sendEmail($mailer, $reply); } if (config('forum.broadcasting') && !$this->authUserIsOwner($reply->conversation)) { event(new NewReply($reply)); } }
/** * @param ReplyRepo $replyRepo */ public function handle(ReplyRepo $replyRepo) { $reply = $replyRepo->findOrFail($this->reply_id); $reply->correct_answer = !$reply->correct_answer; $reply->save(); }
/** * Execute the job. * * @param ReplyRepo $replyRepo * * @return void */ public function handle(ReplyRepo $replyRepo) { $reply = $replyRepo->find($this->id); $reply->update($this->prepareData()); }
/** * Determine if the user is authorized to make this request. * * @param ReplyRepo $replyRepo * @return bool */ public function authorize(ReplyRepo $replyRepo) { $reply_id = $this->route('reply_id'); $reply = $replyRepo->findOrFail($reply_id); return $reply->user_id == auth()->user()->id; }