Skip to content

Latest commit

 

History

History
56 lines (39 loc) · 798 Bytes

README.md

File metadata and controls

56 lines (39 loc) · 798 Bytes

Middleware Filters

Built for ORM package

Table of Contents

Installation

composer require wtf/middleware-filters

Add new middleware to your provider:

<?php

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

Add it to your suit.php middleware list:

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

Usage

Use medoo where conditions in your query, eg:

GET /?filter[name[~]]=Nich&limit=20&offset=20 => array:

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

And inside your code:

<?php

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