Как можно сделать один запрос без цикла?

Можно ли сделать запрос сразу по всем ролям пользователя без цикла?

foreach ($this->roles as $role) {
            $access = (ORM::factory('Role', $role)
                    ->permission
                    ->where_open()
                    ->where('directory', '=', $this->request->directory())
                    ->or_where('directory', '=', '')
                    ->or_where('directory', 'is', NULL)
                    ->where_close()
                    ->and_where_open()
                    ->where('controller', '=', $this->request->controller())
                    ->or_where('controller', '=', '')
                    ->or_where('controller', 'is', NULL)
                    ->and_where_close()
                    ->and_where_open()
                    ->where('action', '=', $this->request->action())
                    ->or_where('action', '=', '')
                    ->or_where('action', 'is', NULL)
                    ->and_where_close()
                    ->count_all() > 0);
            if ($access)
                break;
        }
  • Вопрос задан
  • 95 просмотров
Пригласить эксперта
Ответы на вопрос 1
@vashaaa
Юх с горы
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы