bzarzuela/modelfilter 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

bzarzuela/modelfilter

最新稳定版本:v0.1.4

Composer 安装命令:

composer require bzarzuela/modelfilter

包简介

Utility Class for Laravel 5 to assist in easily filtering paginated results.

README 文档

README

Utility Class for Laravel 5 to assist in easily filtering paginated results

Installation

composer require bzarzuela/modelfilter

Usage

Use in actions that show the list of models. In this example, it's the index action in the TicketsController.

public function index()
{
    $model_filter = new ModelFilter('tickets');

    $model_filter->setRules([
        'id' => ['primary'],
        'concern_types' => ['in', 'concern_type_id'],
        'created_from' => ['from', 'created_at'],
        'created_to' => ['to', 'created_at'],
    ]);

    $tickets = $model_filter->filter(Ticket::query())->paginate(30);

    $filters = $model_filter->getFormData();

    return view('tickets.index', compact('tickets', 'filters'));
}

The $filters variable passed to the view allows for the form to render the previously specified filters.

统计信息

  • 总下载量: 1.62k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 5
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-08-28