Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Create.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Framework\App\Action\HttpGetActionInterface as HttpGetActionInterface;
14 
16 {
20  protected $registration;
21 
25  protected $session;
26 
30  protected $resultPageFactory;
31 
38  public function __construct(
39  Context $context,
40  Session $customerSession,
43  ) {
44  $this->session = $customerSession;
45  $this->resultPageFactory = $resultPageFactory;
46  $this->registration = $registration;
47  parent::__construct($context);
48  }
49 
55  public function execute()
56  {
57  if ($this->session->isLoggedIn() || !$this->registration->isAllowed()) {
59  $resultRedirect = $this->resultRedirectFactory->create();
60  $resultRedirect->setPath('*/*');
61  return $resultRedirect;
62  }
63 
65  $resultPage = $this->resultPageFactory->create();
66  return $resultPage;
67  }
68 }
__construct(Context $context, Session $customerSession, PageFactory $resultPageFactory, Registration $registration)
Definition: Create.php:38