2017 © Pedro Peláez
 

library querybuilder

This package is used to build a query from jQuery Query builder plugin rules.

image

hassanalisalem/querybuilder

This package is used to build a query from jQuery Query builder plugin rules.

  • Thursday, June 14, 2018
  • by anacoder
  • Repository
  • 2 Watchers
  • 3 Stars
  • 34 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 9 Versions
  • 17 % Grown

The README.md

Laravel QueryBuilder for jQuery Query Builder

jQuery Query Builder

this package is to build query form jQuery Query Builder library, it works with laravel models, and it uses the model relations. Also it hide your table structure, so you dont need to name the filters as your table columns, (*1)

Structure

Install

Via Composer, (*2)

``` bash $ composer require hassanalisalem/querybuilder, (*3)


## Usage in your controller or whatever place you are building your query ``` php use hassanalisalem\querybuilder\Query; ... ... $model = new User(); $rules = $request->rules; // rules from the jQuery query builder form. $query = Query::build($model, $rules); // you can use it as: $query->get() to get the query result // or to check the query string: $query->toSql()

in the model

you should define a public array variable named filterable. This should contain all your filters as filter id or key (from the jquery query builder filters) => filter value., (*4)

incase of ambiguous key you can add "as". so if I have table named industries and I want to query whereIn('id', [])... so the key should be 'filter_name_industries' => 'industries.id as industries', (*5)

php public $filterable = [ 'filter_name' => 'this.name', 'filter_user_post_title' => 'posts.title', 'filter_user_post_comment' => 'posts.comments.text', 'filter_industry' => 'industries.id as industries', // if there is ambiguous key. // it is recommended to prepend the key with 'filter_' ]; this means that the name source is the model itself. posts means that the title is from another relation named posts (posts) should be a function in the model that returns a relation.. also comments is a function in Post that returns a relation.., (*6)

The Versions

14/06 2018

dev-master

9999999-dev https://github.com/hassanalisalem/querybuilder

This package is used to build a query from jQuery Query builder plugin rules.

  Sources   Download

MIT

The Requires

 

The Development Requires

querybuilder hassanalisalem

14/06 2018

v1.0.7

1.0.7.0 https://github.com/hassanalisalem/querybuilder

This package is used to build a query from jQuery Query builder plugin rules.

  Sources   Download

MIT

The Requires

 

The Development Requires

querybuilder hassanalisalem

29/04 2018

v1.0.6

1.0.6.0 https://github.com/hassanalisalem/querybuilder

This package is used to build a query from jQuery Query builder plugin rules.

  Sources   Download

MIT

The Requires

 

The Development Requires

querybuilder hassanalisalem

28/04 2018

v1.0.5

1.0.5.0 https://github.com/hassanalisalem/querybuilder

This package is used to build a query from jQuery Query builder plugin rules.

  Sources   Download

MIT

The Requires

 

The Development Requires

querybuilder hassanalisalem

28/04 2018

v1.0.4

1.0.4.0 https://github.com/hassanalisalem/querybuilder

This package is used to build a query from jQuery Query builder plugin rules.

  Sources   Download

MIT

The Requires

 

The Development Requires

querybuilder hassanalisalem

28/04 2018

v1.0.3

1.0.3.0 https://github.com/hassanalisalem/querybuilder

This package is used to build a query from jQuery Query builder plugin rules.

  Sources   Download

MIT

The Requires

 

The Development Requires

querybuilder hassanalisalem

28/04 2018

v1.0.2

1.0.2.0 https://github.com/hassanalisalem/querybuilder

This package is used to build a query from jQuery Query builder plugin rules.

  Sources   Download

MIT

The Requires

 

The Development Requires

querybuilder hassanalisalem

28/04 2018

v1.0.1

1.0.1.0 https://github.com/hassanalisalem/querybuilder

This package is used to build a query from jQuery Query builder plugin rules.

  Sources   Download

MIT

The Requires

 

The Development Requires

querybuilder hassanalisalem

28/04 2018

v1.0

1.0.0.0 https://github.com/hassanalisalem/querybuilder

This package is used to build a query from jQuery Query builder plugin rules.

  Sources   Download

MIT

The Requires

 

The Development Requires

querybuilder hassanalisalem