Create collection in Magento 2

Posted at: September 21, 2018 2:13 PM

Create Model File Allnews.php

Rsgitech\News\Model\Allnews.php

Create Resource Model

Rsgitech\News\Model\ResourceModel\Allnews.php

Define table in resource model

Create Collection

Rsgitech\News\Model\ResourceModel\Allnews\Collection.php

Define model and resource model

View Collection on Controller Action

Rsgitech\News\Controller\Adminhtml\AllNews\Index.php

View collection on controller

Then run below commands


Complete!!

Download source code: Download

This lesson also available on YouTube
Create Collection Magento 2

Please leave comments

1 Comments