承接 brunaobh/eloquent-ql 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

brunaobh/eloquent-ql

Composer 安装命令:

composer require brunaobh/eloquent-ql

包简介

A library that provides content negotiation

README 文档

README

This library helps to negotiate content related to eloquent models (fields, relations and filters)

Installation

Install the package using composer:

$ composer require brunaobh/eloquent-ql

Publish the package configuration: $ php artisan vendor:publish --provider="brunaobh\Search\Search\SearchServiceProvider"

That's it.

Simple usage

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\User;
use Search;

class UserController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index(Request $request)
    {
        $res = Search::handleRequest($request)
            ->negotiate('User')
            ->get();
        
        return response()->json($res);
    }

Create your filter

public function scopeFilterByAddressNotNull($query)
{
   return $query->whereNotNull('address');
}

Now you simply call your route with your filter and the fields you want to return in the request

http://localhost:8000/api/users?fields=name,email&filters=filterByAddressNotNull

Using with Laravel

Service Provider (Optional on Laravel 5.5)

Once Composer has installed or updated your packages you need add aliases or register you packages into Laravel. Open up config/app.php and find the aliases key and add:

Providers:

brunaobh\Search\Search\SearchServiceProvider::class,

Aliases:

brunaobh\Search\Search\SearchServiceProvider::class,

'Search' => brunaobh\Search\Facades\Search::class,

Contact

Bruno Coelho brunaobh@gmail.com

License

This project is distributed under the MIT License. Check [LICENSE][LICENSE.md] for more information.

统计信息

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

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-06-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固