I've created simple application by Phalcon Dev Tools.
I've added created router.php under condig directory:
<?php
/*
* Define custom routes. File gets included in the router service definition.
*/
$router = new Phalcon\Mvc\Router();
$router->add("/upload.\php", array(
'controller' => 'upload',
'action' => 'index'
));
return $router;
I've set up dispatched in services:
$di->set('dispatcher', function () use ($di) {
$eventsManager = new EventsManager;
/**
* Check if the user is allowed to access certain action using the SecurityPlugin
*/
$eventsManager->attach('dispatch:beforeDispatch', new SecurityPlugin);
/**
* Handle exceptions and not-found exceptions using NotFoundPlugin
*/
$eventsManager->attach('dispatch:beforeException', new NotFoundPlugin);
$dispatcher = new Dispatcher;
$dispatcher->setEventsManager($eventsManager);
return $dispatcher;
});
And router:
/**
* Loading routes from the routes.php file
*/
$di->set('router', function () {
return require __DIR__ . '/routes.php';
});
However everytime I'm trying to get to upload.php I'm redirected to log in page.
I've tried to change router to:
$router->add("/upload.\php", array(
'controller' => 'dashboard',
'action' => 'index'
));
To test if it works but even it doesn't redirect me to dashboard page.
What I' doing wrong?