nasustop/hapi-base

3.0.1 2023-12-30 10:03 UTC

This package is auto-updated.

Last update: 2024-11-04 11:01:46 UTC


README

使用Hyperf框架时,一些基础类的集合

Repository

新建repository类App\Repository\Repository

<?php

namespace App\Repository;

class Repository extends \Nasustop\HapiBase\Repository\Repository
{
    // TODO: 单独建立一个基础类的好处是,如果组件中的方法有不符合自己业务的,可选择重写该方法
}

filter查询

$filter = [
    'name' => 'test',
    'age|gte' => 18,
];

$filter = [
    'sex' => '',
    [
        ['name' => 'test'],
        'id' => 1,
        ['age|lte' => 18],
    ],
];
$filter = [
    'name' => 'test',
    'or' => [
        ['age' => 18, 'sex' => ''],
        ['age' => 19, 'sex' => ''],
        ['age' => 19, 'sex' => ''],
        'name' => 'test01',
    ],
];