Hi, I have an application that controls the customer payments. My app have a sidebar with 5 option. I have 2 database: 1. Mysql that is used to authenticate it has a cam name role: user and admin. 2. Mongodb it has customer payments info. In that second databse I have a camp name–> comprobante: 1 or 0. I want to validate the loging with role from mysql and comprobante from mongodb comprobante. If my customer has role: user and comprobante: 1. I want to show 5 option in my side bar. but if the customer has role: user and comprobante: 0. I will show 4 option. This is my code where it is working only with role: user from mysql. Can anybody help me?
CODE:
$links = array();
$role = $this->Auth->user(‘role’);
if($role == 'user') {
$links = array(
array(
'title' => 'Detalle de visitas',
'icon' => 'icon-bag',
'controller' => 'dashboard',
'action' => 'index',
'sub' => array(
)
),
array(
'title' => 'Mis compras y pagos',
'icon' => 'icon-doc',
'controller' => 'dashboard',
'action' => 'payments_invoices',
'sub' => array(
)
),
array(
'title' => 'Facturas y Recibos',
'icon' => 'icon-doc',
'controller' => 'dashboard',
'action' => 'facturas_recibos',
'sub' => array(
)
),
array(
'title' => 'Contacto',
'icon' => 'icon-bubble',
'controller' => 'dashboard',
'action' => 'contact',
'sub' => array(
)
),
array(
'title' => 'Mi cuenta',
'icon' => 'icon-user',
'controller' => 'users',
'action' => 'profile',
'sub' => array(
)
),
array(
'title' => 'Salir',
'icon' => 'icon-logout',
'controller' => 'users',
'action' => 'logout',
'sub' => array(
)
),
);
}