Horje
how to delete single row from grid in magento Code Example
how to delete single row from grid in magento
<?php
namespace Vendor\Module\Controller\Adminhtml\Module;

use Magento\Backend\App\Action;
use Magento\TestFramework\ErrorLog\Logger;

class DeleteRow extends \Magento\Backend\App\Action
{

    
    protected function _isAllowed()
    {
        return $this->_authorization->isAllowed('Vendor_Module::route_id');
    }

    
    public function execute()
    {
        $id = $this->getRequest()->getParam('id');
        $resultRedirect = $this->resultRedirectFactory->create();
        if ($id) {
            try {
                $model = $this->_objectManager->create('Vendor\Module\Model\Module');
                $model->load($id);
                $model->delete();
                $this->messageManager->addSuccess(__('The Record has been deleted.'));
                return $resultRedirect->setPath('*/*/');
            } catch (\Exception $e) {
                $this->messageManager->addError($e->getMessage());
                return $resultRedirect->setPath('*/*/edit', ['entity_id' => $id]);
            }
        }
        $this->messageManager->addError(__('We can\'t find a row to delete.'));
        return $resultRedirect->setPath('*/*/');
    }
}
?>




Php

Related
joomla include jfactory Code Example joomla include jfactory Code Example
getname eloquent slug laravel Code Example getname eloquent slug laravel Code Example
how do i implement blockchain payments on laravel website Code Example how do i implement blockchain payments on laravel website Code Example
Split Functions.php Code Example Split Functions.php Code Example
how to show limited text in laravel on page Code Example how to show limited text in laravel on page Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
8