wtf/middleware-filters

1.0.6 2020-12-03 14:14 UTC

This package is auto-updated.

Last update: 2024-03-29 03:57:38 UTC


README

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']);