PHP Class Yajra\Datatables\Engines\QueryBuilderEngine

Author: Arjay Angeles ([email protected])
Inheritance: extends BaseEngine
Show file Open project: yajra/laravel-datatables-oracle Class Usage Examples

Public Methods

Method Description
__construct ( Builder $builder, Request $request )
castColumn ( string $column ) : string Wrap a column and cast in pgsql.
columnSearch ( ) : void Perform column search.
count ( ) : integer Counts current query.
filter ( Closure $callback, boolean $globalSearch = false ) Set auto filter off and run your own filter.
filtering ( ) : void Perform global search.
make ( boolean $mDataSupport = false, boolean $orderFirst = false ) : Illuminate\Http\JsonResponse Organizes works
ordering ( ) : void Perform sorting of columns.
paging ( ) : void Perform pagination
results ( ) : array | static[] Get results
totalCount ( ) : integer Count total items.

Protected Methods

Method Description
compileColumnQuery ( mixed $query, string | Closur\Closure $method, mixed $parameters, string $column, string $keyword ) Perform filter column on selected field.
compileColumnSearch ( integer $i, mixed $column, string $keyword ) Compile queries for column search.
compileQuerySearch ( mixed $query, string $column, string $keyword, string $relation = 'or' ) Compile query builder where clause depending on configurations.
compileRelationSearch ( mixed $query, string $relation, string $column, string $keyword ) Add relation query on global search.
getEagerLoads ( ) : array Get eager loads keys if eloquent.
getNullsLastSql ( string $column, string $direction ) : string Get NULLS LAST SQL.
init ( Request $request, Builder $builder, string $type = 'builder' ) Initialize attributes.
joinEagerLoadedColumn ( string $relation, string $relationColumn ) : string Join eager loaded relation and get the related column name.
parameterize ( ) : array Build Query Builder Parameters.
prepareKeyword ( string $keyword ) : string Prepare search keyword based on configurations.
regexColumnSearch ( mixed $column, string $keyword ) Compile regex query column search.
wrap ( string $column ) : string Wrap column with DB grammar.

Private Methods

Method Description
getSearchKeyword ( integer $i, boolean $raw = false ) : string Get proper keyword to use for search.
modelUseSoftDeletes ( ) : boolean Check if model use SoftDeletes trait

Method Details

__construct() public method

public __construct ( Builder $builder, Request $request )
$builder Illuminate\Database\Query\Builder
$request Yajra\Datatables\Request

castColumn() public method

Wrap a column and cast in pgsql.
public castColumn ( string $column ) : string
$column string
return string

columnSearch() public method

Perform column search.
public columnSearch ( ) : void
return void

compileColumnQuery() protected method

Perform filter column on selected field.
protected compileColumnQuery ( mixed $query, string | Closur\Closure $method, mixed $parameters, string $column, string $keyword )
$query mixed
$method string | Closur\Closure
$parameters mixed
$column string
$keyword string

compileColumnSearch() protected method

Compile queries for column search.
protected compileColumnSearch ( integer $i, mixed $column, string $keyword )
$i integer
$column mixed
$keyword string

compileQuerySearch() protected method

Compile query builder where clause depending on configurations.
protected compileQuerySearch ( mixed $query, string $column, string $keyword, string $relation = 'or' )
$query mixed
$column string
$keyword string
$relation string

compileRelationSearch() protected method

Add relation query on global search.
protected compileRelationSearch ( mixed $query, string $relation, string $column, string $keyword )
$query mixed
$relation string
$column string
$keyword string

count() public method

Counts current query.
public count ( ) : integer
return integer

filter() public method

Overrides global search
public filter ( Closure $callback, boolean $globalSearch = false )
$callback Closure
$globalSearch boolean

filtering() public method

Perform global search.
public filtering ( ) : void
return void

getEagerLoads() protected method

Get eager loads keys if eloquent.
protected getEagerLoads ( ) : array
return array

getNullsLastSql() protected method

Get NULLS LAST SQL.
protected getNullsLastSql ( string $column, string $direction ) : string
$column string
$direction string
return string

init() protected method

Initialize attributes.
protected init ( Request $request, Builder $builder, string $type = 'builder' )
$request Yajra\Datatables\Request
$builder Illuminate\Database\Query\Builder
$type string

joinEagerLoadedColumn() protected method

Join eager loaded relation and get the related column name.
protected joinEagerLoadedColumn ( string $relation, string $relationColumn ) : string
$relation string
$relationColumn string
return string

make() public method

Organizes works
public make ( boolean $mDataSupport = false, boolean $orderFirst = false ) : Illuminate\Http\JsonResponse
$mDataSupport boolean
$orderFirst boolean
return Illuminate\Http\JsonResponse

ordering() public method

Perform sorting of columns.
public ordering ( ) : void
return void

paging() public method

Perform pagination
public paging ( ) : void
return void

parameterize() protected method

Build Query Builder Parameters.
protected parameterize ( ) : array
return array

prepareKeyword() protected method

Prepare search keyword based on configurations.
protected prepareKeyword ( string $keyword ) : string
$keyword string
return string

regexColumnSearch() protected method

Compile regex query column search.
protected regexColumnSearch ( mixed $column, string $keyword )
$column mixed
$keyword string

results() public method

Get results
public results ( ) : array | static[]
return array | static[]

totalCount() public method

Count total items.
public totalCount ( ) : integer
return integer

wrap() protected method

Wrap column with DB grammar.
protected wrap ( string $column ) : string
$column string
return string