ltsecurityinc安防产品在线商城代码
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Olegnax Athlete Slideshow
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Olegnax.com license that is
|
||||
* available through the world-wide-web at this URL:
|
||||
* https://www.olegnax.com/license
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this extension to newer
|
||||
* version in the future.
|
||||
*
|
||||
* @category Olegnax
|
||||
* @package Olegnax_AthleteSlideshow
|
||||
* @copyright Copyright (c) 2023 Olegnax (http://www.olegnax.com/)
|
||||
* @license https://www.olegnax.com/license
|
||||
*/
|
||||
|
||||
namespace Olegnax\Athlete2Slideshow\Controller\Adminhtml\Slides;
|
||||
|
||||
use Exception;
|
||||
use Magento\Backend\Model\View\Result\Redirect;
|
||||
use Magento\Framework\Controller\ResultInterface;
|
||||
use Olegnax\Athlete2Slideshow\Model\Slides;
|
||||
|
||||
class Delete extends \Olegnax\Athlete2Slideshow\Controller\Adminhtml\Slides
|
||||
{
|
||||
const ADMIN_RESOURCE = 'Olegnax_Athlete2Slideshow::Slides_Delete';
|
||||
/**
|
||||
* Delete action
|
||||
*
|
||||
* @return ResultInterface
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
/** @var Redirect $resultRedirect */
|
||||
$resultRedirect = $this->resultRedirectFactory->create();
|
||||
// check if we know what should be deleted
|
||||
$id = $this->getRequest()->getParam('id');
|
||||
if ($id) {
|
||||
try {
|
||||
// init model and delete
|
||||
$model = $this->_objectManager->create( Slides::class);
|
||||
$model->load($id);
|
||||
$model->delete();
|
||||
// display success message
|
||||
$this->messageManager->addSuccessMessage(__('You deleted the Slide.'));
|
||||
// go to grid
|
||||
return $resultRedirect->setPath('*/*/');
|
||||
} catch ( Exception $e) {
|
||||
// display error message
|
||||
$this->messageManager->addErrorMessage($e->getMessage());
|
||||
// go back to edit form
|
||||
return $resultRedirect->setPath('*/*/edit', ['id' => $id]);
|
||||
}
|
||||
}
|
||||
// display error message
|
||||
$this->messageManager->addErrorMessage(__('We can\'t find a Slide to delete.'));
|
||||
// go to grid
|
||||
return $resultRedirect->setPath('*/*/');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user