Last active
March 31, 2022 07:24
-
-
Save mohfahrul/c50bb95e0ce98b850f2498674dfb0872 to your computer and use it in GitHub Desktop.
Magento Redirect using { $this->_redirect } on Controller
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Icube\Training\Controller\Index; | |
use \Magento\Framework\App\Action\Action; | |
use \Magento\Framework\App\Action\Context; | |
class Example extends Action | |
{ | |
protected $traineeFactory; | |
public function __construct( | |
Context $context, | |
\Icube\Training\Model\TraineeFactory $traineeFactory, | |
){ | |
$this->traineeFactory = $traineeFactory; | |
parent::__construct($context); | |
} | |
public function execute() | |
{ | |
// redirect to path -> {baseUrl}/Training/ | |
// $this->_redirect is default function that inherit from parent class Action | |
$this->_redirect('training/'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment