Hi Guys,
I made this new functionality in services.php, but I think that is not better file to this, Could you help about better file or i just make a new file(name?)?
//services.php
Routing::Init()
->Controller(Controllers::INDEX)
->Action(Routes::INDEX, Actions::INDEX)
->Action(Routes::E404, Actions::E404)
->Action(Routes::E505, Actions::E505)
->Action(Routes::REFRESH, Actions::REFRESH)
->Controller(Controllers::USER)
->Action(Routes::SIGN_IN, Actions::SIGN_IN)
->Action(Routes::REGISTER, Actions::REGISTER)
->Action(Routes::LOGON, Actions::LOGON)
->Controller(Controllers::ADMIN)
->Action(Routes::USERS, Actions::USERS)
->Controller(Controllers::PRODUCT)
->Action(Routes::PRODUCT_GET, Actions::GET)
->Build();
the values of defines is :
// Actions.php
abstract class Actions {
const INDEX = 'index';
const E404 = 'e404';
const E505 = 'e505';
const REFRESH = 'refresh';
const SIGN_IN = 'signin';
const REGISTER = 'register';
const LOGON = 'logon';
const GET = 'get';
}
// Controllers.php
abstract class Controllers {
const INDEX = 'index';
const USER = 'user';
const ADMIN = 'admin';
const PRODUCT = 'product';
}
// Routes.php
define ('index', '');
define ('e404' , Actions::E404);
define ('e505' , Actions::E505);
define ('refresh', Actions::REFRESH);
define ('index_user', Controllers::USER);
define ('sign_in', Controllers::USER.'/'.Actions::SIGN_IN);
define ('register', Controllers::USER.'/'.Actions::REGISTER);
define ('alter_user', Controllers::USER.'/'.Actions::ALTER);
define ('logon', Controllers::USER.'/'.Actions::LOGON);
define ('orders_user', Controllers::USER.'/'.Actions::ORDERS);
define ('logoff_user', Controllers::USER.'/'.Actions::LOGOFF);
define ('remove', Controllers::USER.'/'.Actions::REMOVE);
define ('index_admin', Controllers::ADMIN);
define ('users', Controllers::ADMIN.'/'.Actions::USERS);
define ('user', Controllers::ADMIN.'/'.Actions::USER);
define ('categories', Controllers::ADMIN.'/'.Actions::USERS);
define ('category', Controllers::ADMIN.'/'.Actions::CATEGORY);
define ('orders_admin', Controllers::ADMIN.'/'.Actions::ORDERS);
define ('order_admin', Controllers::ADMIN.'/'.Actions::ORDER);
define ('logoff_admin', Controllers::ADMIN.'/'.Actions::LOGOFF);
define ('product_get', Controllers::PRODUCT.'/'.Actions::GET.'/{name}.json');
abstract class Routes {
const INDEX = index;
const E404 = e404;
const E505 = e505;
const REFRESH = refresh;
const SIGN_IN = sign_in;
const REGISTER = register;
const LOGON = logon;
const PRODUCT_GET = product_get;
}