PredispatchAdminActionControllerObserver.php 778 B

1234567891011121314151617181920212223242526
  1. <?php
  2. namespace Smartwave\Core\Observer;
  3. use Magento\Framework\Event\ObserverInterface;
  4. class PredispatchAdminActionControllerObserver implements ObserverInterface
  5. {
  6. protected $_feedFactory;
  7. protected $_backendAuthSession;
  8. public function __construct(
  9. \Smartwave\Core\Model\FeedFactory $feedFactory,
  10. \Magento\Backend\Model\Auth\Session $backendAuthSession
  11. ) {
  12. $this->_feedFactory = $feedFactory;
  13. $this->_backendAuthSession = $backendAuthSession;
  14. }
  15. public function execute(\Magento\Framework\Event\Observer $observer)
  16. {
  17. if ($this->_backendAuthSession->isLoggedIn()) {
  18. $feedModel = $this->_feedFactory->create();
  19. $feedModel->checkUpdate();
  20. }
  21. }
  22. }