I have below table named "messages".
id | posts_id | message_description | created_at
-----------------------------------------------------------------------------
1 1 test1 2016-09-06 10:00:00
2 1 test2 2016-09-06 11:00:00
3 2 test1 2016-09-06 10:00:00
4 2 test2 2016-09-06 11:00:00
app\code\Custom\Module\Block\Edit.php
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$messages = $objectManager->create('Custom\Module\Model\Messages')->loadByPostsId($this->getRequest()->getParam('id'));
return $messages;
I would like to retrieve messages by posts_id. How can i get that?