-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
FilterContract.php
29 lines (27 loc) · 970 Bytes
/
FilterContract.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
/**
* @link https://github.com/illuminatech
* @copyright Copyright (c) 2019 Illuminatech
* @license [New BSD License](http://www.opensource.org/licenses/bsd-license.php)
*/
namespace Illuminatech\DataProvider;
/**
* FilterContract defines interface, which each data filter should implement.
*
* @see \Illuminatech\DataProvider\DataProvider::filters()
*
* @author Paul Klimov <[email protected]>
* @since 1.0
*/
interface FilterContract
{
/**
* Applies this filter to the given data source.
*
* @param \Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder|object $source raw data source.
* @param string $name filter attribute name, e.g. filter name from request.
* @param mixed $value filter value.
* @return \Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder|object adjusted data source.
*/
public function apply(object $source, string $name, $value): object;
}