group()->associate(Group::find($_POST['groupId'])); $vote->points += 1; if(!empty($_POST['comment'])){ $vote->comment = $_POST['comment']; }else{ header("location: ../../../Frontend/index.html?error=EmptyField"); exit(); } $vote->save(); header("location: ../../../Frontend/index.html?success=YouHaveVoted"); exit(); } }else{ header("location: ../../../Frontend/index.html?error=YouCantVoted"); exit(); }