0

i have tried through this method

public function isAdmin() {
        $this->_coreSession->start();
        echo $this->_coreSession->getMessage();
        echo 'session test4';
        exit;
    }
1

1 Answer 1

1
 protected $_session;
 public function __construct(
\Magento\Framework\Model\Context $context,
\Magento\Backend\Model\Auth\Session $authSession
) { $this->_session = $authSession;
   parent::__construct($context);
 } 

Use:-

$this->_session->isLoggedIn()

to check whether the admin is logged in or not.

Your Answer

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

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