1. Go to this page and download the library: Download timgws/query-builder-parser library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
timgws / query-builder-parser example snippets
use timgws\QueryBuilderParser;
$table = DB::table('table_of_data_to_integrate');
$qbp = new QueryBuilderParser(
// provide here a list of allowable rows from the query builder.
// NOTE: if a row is listed here, you will be able to create limits on that row from QBP.
array( 'name', 'email' )
);
$query = $qbp->parse($input['querybuilder'], $table);
$rows = $query->get();
return Response::JSON($rows);
use timgws\QueryBuilderParser;
$table = DB::collection('data');
$qbp = new QueryBuilderParser(
// provide here a list of allowable rows from the query builder.
// NOTE: if a row is listed here, you will be able to create limits on that row from QBP.
array( 'name', 'email' )
);
$query = $qbp->parse($input['querybuilder'], $table);
$rows = $query->get();
return Response::JSON($rows);
use timgws\QueryBuilderParser;
class AdminUserController {
function displayUserDatatable() {
/* builder is POST'd by the datatable */
$queryBuilderJSON = Input::get('rules');
$show_columns = array('id', 'username', 'email_address');
$query = new QueryBuilderParser($show_columns);
/** Illuminate/Database/Query/Builder $queryBuilder **/
$queryBuilder = $query->parse(DB::table('users'));
return Datatable::query($queryBuilder)
->showColumns($show_columns)
->orderColumns($show_columns)
->searchColumns($show_columns)
->make()
}
}