Hey guys!
<?php
use Phalcon\Mvc\Controller;
class AdminController extends Controller {
public function initialize() {
if(!$this->session->has('user')) {
// fix a recursion calling if call /adm/login
if($this->dispatcher->getActionName() !== 'login') {
$this->dispatcher->forward([
'controller' => 'admin',
'action' => 'login',
]);
}
}
}
public function indexAction() {
echo 'HELLO_ADM';
}
public function loginAction() {
echo 'LOGIN_PAGE';
}
}
GET /adm returned "HELLO ADM LOGIN PAGE". why? why not "LOGIN _ PAGE" only? (Session is empty).