liaosp/array-search

数组搜索,数组分页

1.0.4 2020-02-03 02:42 UTC

This package is auto-updated.

Last update: 2024-09-29 05:35:54 UTC


README

.

安装

$ composer require liaosp/array-search -vvv

用法

示例:

$target = [
    [
        'id'=>1,
        'status'=>3
        ],
    [
        'id'=>2,
        'status'=>1
    ],
    [
        'id'=>3,
        'status'=>2
    ],
    [
        'id'=>4,
        'status'=>1
    ],
    [
        'id'=>5,
        'status'=>1
    ],
    [
        'id'=>6,
        'status'=>1
    ],

];
$obj = new ArraySearch();

$data = $obj->arrayData($target)->paginate(1);//firstPageData  ,第一页数据。

where:

$data = $obj->arrayData($target)->where(['status'=>1])->paginate(1);//firstPageData  ,第一页数据。

whereIn

$data = $obj->arrayData($target)->whereIn(['status'=>[1,2]])->paginate(1);//firstPageData  ,第一页数据。

orWhere

$data = $obj->arrayData($target)->orWhere(['status'=>1,'id'=>1])->paginate(1);//firstPageData  ,第一页数据。

notWhere

$data = $obj->arrayData($target)->notWhere(['status'=>1,'id'=>1])->paginate(1);//firstPageData  ,第一页数据。

贡献

您可以通过以下三种方式之一进行贡献:

  1. 使用 问题跟踪器 提交错误报告。
  2. 问题跟踪器 上回答问题或修复错误。
  3. 贡献新功能或更新维基。

代码贡献过程并不十分正式。您只需确保遵循 PSR-0、PSR-1 和 PSR-2 编码规范。任何新的代码贡献都必须附有适用的单元测试。

许可证

MIT