wtf/中间件过滤器

1.0.6 2020-12-03 14:14 UTC

This package is auto-updated.

Last update: 2024-08-29 05:22:17 UTC


README

ORM包构建

目录

安装

composer require wtf/middleware-filters

向您的提供者添加新的中间件

<?php

$container['middleware_filters'] = function ($c) {
    return new \Wtf\Middleware\Filters($c);
};

将其添加到您的suit.php中间件列表中

<?php
//...
'middlewares' => [
//...
    'middleware_filters',
//...
],

使用方法

在查询中使用medoo where条件,例如

GET /?filter[name[~]]=Nich&limit=20&offset=20 => 数组

<?php
[
    'name[~]' => 'Nich',
    'LIMIT' => [20,20],
];

在您的代码内部

<?php

$collection = $this->entity('employee')->loadAll($this->container['filters']);