I have custom admin grid which shows data from my table. Last column in this table is "Actions". And there are two actions (links) - "Approve" and "Reject". My links looks like:



How to make custom actions for each link with redirect back to grid?

Thank you!

1 Answer 1


Fight, fight and win.

1) Create file [Vendor]/[Module]/Controller/Adminhtml/Approve/Index.php

2) Fill this file with code below:


    namespace [Vendor]\[Module]\Controller\Adminhtml\Approve;

    class Index extends \Magento\Backend\App\Action

        public function execute()
            // In this variable you will have id from your URL
            $id = $this->getRequest()->getParam('id');

            // Here will be your code


        protected function _isAllowed() {
            // grid_list - your layout file
            return $this->_authorization->isAllowed('[Vendor]_[Module]::grid_list');

3) Type in console: magento setup:upgrade

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.