public static function vote($request, $context) { //print_r($request); if (!empty($request['idtweet']) && $context->getSessionAttribute('is_logged') == 1) { $voteInfo['message'] = $request['idtweet']; $voteInfo['utilisateur'] = $_SESSION['id']; $vote = new vote($voteInfo); $vote->save(); $tweetInfo['id'] = $request['idtweet']; $nbVotes = vote::getVote($request['idtweet']); //print_r($nbVotes); $tweetInfo['nbVotes'] = $nbVotes[0]['count']; $tweet = new tweet($tweetInfo); $tweet->save(); context::redirect(history . back()); return context::SUCCESS; } return context::ERROR; }