public static function getMsg($msgId) { $userId = ModelFacade::getLoggedInUser()->id; $msg = DirectMessages::getDirectMessage($msgId); if ($msg->receiver != $userId && $msg->sender != $userId) { header("Location: /DirectMsgInbox.php"); } return $msg; }