$answer,'question_id'=>$question_id,'user_id'=>$user_id]); } public static function actionUpvoteAnswer($answer_id,$user_id) { return Upvote::create(['answer_id'=>$answer_id,'user_id'=>$user_id]); } public function actionUpdateAnswer($answer_id,$new_answer) { $answer = Answer::find($answer_id); $answer->answer = $new_answer; return $answer->save(); } public function actionViewAllAnswers(): void { foreach (Answer::all() as $answer) { echo $answer->answer . "
"; } } }