/** * * Cria um link * * @param string $label * @param string $url * @param array $options * @return string */ public function linkPermissao($label, $url, $options = []) { if (!is_array($url)) { return $this->link($label, $url, $options); } $defautl = ['action' => $this->request->action, 'controller' => $this->request->controller, 'path' => $this->request->path]; $url = array_merge($defautl, $url); $_url = $this->request->prepareUrl($url); $Menu = new \App\Model\Table\MenusTable(); $find = $Menu->where('path', $_url['path'])->where('controller', $_url['controller'])->where('action', $_url['action'])->where(\Core\Session::read('Auth.User.tipo') == 1 ? 'administrador' : 'tosador', 1)->find(); if (!empty($find)) { return $this->link($label, $url, $options); } return null; }