<?php
/**
* Landofcoder
*
* NOTICE OF LICENSE
*
* This source file is subject to the Landofcoder.com license that is
* available through the world-wide-web at this URL:
* http://landofcoder.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 Landofcoder
* @package Lofmp_SmsNotification
* @copyright Copyright (c) 2016 Landofcoder (http://www.landofcoder.com/)
* @license http://www.landofcoder.com/LICENSE-1.0.html
*/
namespace Lofmp\SmsNotification\Controller\Notification;
class Index extends \Magento\Framework\App\Action\Action
{
/**
* @var \Magento\Framework\View\Result\PageFactory
*/
protected $resultPageFactory;
/**
*
* @var Magento\Framework\App\Action\Session
*/
protected $session;
/**
* @param \Magento\Framework\App\Action\Context $context
* @param \Magento\Framework\View\Result\PageFactory $resultPageFactory
*/
public function __construct(
\Magento\Framework\App\Action\Context $context,
\Magento\Customer\Model\Session $customerSession,
\Magento\Framework\View\Result\PageFactory $resultPageFactory
) {
$this->resultPageFactory = $resultPageFactory;
$this->session = $customerSession;
parent::__construct($context);
}
public function execute()
{
$customerSession = $this->session;
$page = $this->resultPageFactory->create();
if ($customerSession->isLoggedIn()) {
$this->_view->loadLayout();
$this->_view->renderLayout();
} else{
$this->_redirect('customer/account/login');
}
}
} |