<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
zazmaster / query-builder-parser-eloquent 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()
}
}