PHP Class Yajra\Datatables\Engines\BaseEngine

Inheritance: implements Yajra\Datatables\Contracts\DataTableEngineContract
Exibir arquivo Open project: yajra/laravel-datatables-oracle Class Usage Examples

Public Properties

Property Type Description
$request Yajra\Datatables\Request Datatables Request object.

Protected Properties

Property Type Description
$appends array Array of data to append on json response.
$autoFilter boolean Auto-filter flag.
$builder Illuminate\Database\Query\Builder Query builder object.
$columnDef array DT columns definitions container (add/edit/remove/filter/order/escape).
$columns array Array of result columns/fields.
$connection Illuminate\Database\Connection Database connection used.
$database string Database driver used.
$extraColumns array Extra/Added columns.
$filterCallback callable Callback to override global search.
$filterCallbackParameters mixed Parameters to passed on filterCallback.
$filteredRecords integer Total filtered records.
$isFilterApplied boolean [internal] Track if any filter was applied for at least one column
$nullsLast boolean Flag for ordering NULLS LAST option.
$orderCallback callable Custom ordering callback.
$prefix string Database prefix
$query Illuminate\Database\Query\Builder | Illuminate\Database\Eloquent\Builder Builder object.
$query_type string Query type.
$serializer string | null Fractal serializer class.
$skipPaging boolean Skip paginate as needed.
$templates array DT row templates container.
$totalRecords integer Total records.
$transformer League\Fractal\TransformerAbstract Output transformer.
$withTrashed boolean By default we do not select soft deleted records

Public Methods

Method Description
__call ( string $name, array $arguments ) : mixed Allows previous API calls where the methods were snake_case.
addColumn ( string $name, string | callable $content, boolean | integer $order = false ) Add column in collection.
addIndexColumn ( ) Add DT row index column on response.
addRowAttr ( string $key, string | callable $value ) Add DT_RowAttr template.
addRowData ( string $key, string | callable $value ) Add DT_RowData template.
blacklist ( array $blacklist ) Update list of columns that is not allowed for search/sort.
editColumn ( string $name, string | callable $content ) Edit column's content.
escapeColumns ( string | array $columns = '*' ) Declare columns to escape values.
filterColumn ( string $column, string | callable $method ) Override default column filter search.
getQueryBuilder ( mixed $instance = null ) : mixed Get Query Builder object.
isCaseInsensitive ( ) : boolean Get config is case insensitive status.
isDebugging ( ) : boolean Check if app is in debug mode.
isEloquent ( ) : boolean Check if the engine used was eloquent.
isOracleSql ( ) : boolean Check if the current sql language is based on oracle syntax.
isQueryBuilder ( ) : boolean Check query type is a builder.
isSmartSearch ( ) : boolean Check if DataTables uses smart search.
isWildcard ( ) : boolean Get config use wild card status.
make ( boolean $mDataSupport = false, boolean $orderFirst = false ) : Illuminate\Http\JsonResponse Organizes works.
order ( callable $closure ) Override default ordering method with a closure callback.
orderByNullsLast ( ) Set datatables to do ordering with NULLS LAST option.
orderColumn ( string $column, string $sql, array $bindings = [] ) Override default column ordering.
orderColumns ( array $columns, string $sql, array $bindings = [] ) Order each given columns versus the given custom sql.
removeColumn ( ) Remove column from collection.
setRowAttr ( array $data ) Set DT_RowAttr templates.
setRowClass ( string | callable $content ) Sets DT_RowClass template.
setRowData ( array $data ) Set DT_RowData templates.
setRowId ( string | callable $content ) Sets DT_RowId template.
setSerializer ( string $serializer ) Set fractal serializer class.
setTotalRecords ( integer $total ) Set total records manually.
setTransformer ( League\Fractal\TransformerAbstract $transformer ) Set data output transformer.
skipPaging ( ) Skip pagination as needed.
smart ( boolean $bool = true ) Set smart search config at runtime.
whitelist ( string | array $whitelist = '*' ) Update list of columns that is not allowed for search/sort.
with ( mixed $key, mixed $value = '' ) Append data on json response.
withTrashed ( boolean $withTrashed = true ) Change withTrashed flag value.

Protected Methods

Method Description
createSerializer ( ) : League\Fractal\Serializer\SerializerAbstract Get or create transformer serializer instance.
createTransformer ( ) : League\Fractal\TransformerAbstract Get or create transformer instance.
extractColumnName ( string $str, boolean $wantsAlias ) : string Get column name from string.
filterRecords ( ) : void Perform necessary filters.
getColumnName ( integer $index, boolean $wantsAlias = false ) : string Get column name to be use for filtering and sorting.
getColumnNameByIndex ( integer $index ) : mixed Get column name by order column index.
getPrimaryKeyName ( ) : string If column name could not be resolved then use primary key.
getProcessedData ( boolean | false $object = false ) : array Get processed data
isBlacklisted ( string $column ) : boolean Check if column is blacklisted.
orderRecords ( boolean $skip ) : void Sort records.
overrideGlobalSearch ( callable $callback, mixed $parameters, boolean $autoFilter = false ) Update flags to disable global search
paginate ( ) : void Apply pagination.
render ( boolean $object = false ) : Illuminate\Http\JsonResponse Render json response.
setupKeyword ( string $value ) : string Setup search keyword.
showDebugger ( array $output ) : array Append debug parameters on output.
wildcardLikeString ( string $str, boolean $lowercase = true ) : string Adds % wildcards to the given string.

Method Details

__call() public method

Will convert a camelCase API call to a snake_case call. Allow query builder method to be used by the engine.
public __call ( string $name, array $arguments ) : mixed
$name string
$arguments array
return mixed

addColumn() public method

Add column in collection.
public addColumn ( string $name, string | callable $content, boolean | integer $order = false )
$name string
$content string | callable
$order boolean | integer

addIndexColumn() public method

Add DT row index column on response.
public addIndexColumn ( )

addRowAttr() public method

Add DT_RowAttr template.
public addRowAttr ( string $key, string | callable $value )
$key string
$value string | callable

addRowData() public method

Add DT_RowData template.
public addRowData ( string $key, string | callable $value )
$key string
$value string | callable

blacklist() public method

Update list of columns that is not allowed for search/sort.
public blacklist ( array $blacklist )
$blacklist array

createSerializer() protected method

Get or create transformer serializer instance.
protected createSerializer ( ) : League\Fractal\Serializer\SerializerAbstract
return League\Fractal\Serializer\SerializerAbstract

createTransformer() protected method

Get or create transformer instance.
protected createTransformer ( ) : League\Fractal\TransformerAbstract
return League\Fractal\TransformerAbstract

editColumn() public method

Edit column's content.
public editColumn ( string $name, string | callable $content )
$name string
$content string | callable

escapeColumns() public method

Declare columns to escape values.
public escapeColumns ( string | array $columns = '*' )
$columns string | array

extractColumnName() protected method

Get column name from string.
protected extractColumnName ( string $str, boolean $wantsAlias ) : string
$str string
$wantsAlias boolean
return string

filterColumn() public method

Override default column filter search.
public filterColumn ( string $column, string | callable $method )
$column string
$method string | callable

filterRecords() protected method

Perform necessary filters.
protected filterRecords ( ) : void
return void

getColumnName() protected method

Get column name to be use for filtering and sorting.
protected getColumnName ( integer $index, boolean $wantsAlias = false ) : string
$index integer
$wantsAlias boolean
return string

getColumnNameByIndex() protected method

Get column name by order column index.
protected getColumnNameByIndex ( integer $index ) : mixed
$index integer
return mixed

getPrimaryKeyName() protected method

If column name could not be resolved then use primary key.
protected getPrimaryKeyName ( ) : string
return string

getProcessedData() protected method

Get processed data
protected getProcessedData ( boolean | false $object = false ) : array
$object boolean | false
return array

getQueryBuilder() public method

Get Query Builder object.
public getQueryBuilder ( mixed $instance = null ) : mixed
$instance mixed
return mixed

isBlacklisted() protected method

Check if column is blacklisted.
protected isBlacklisted ( string $column ) : boolean
$column string
return boolean

isCaseInsensitive() public method

Get config is case insensitive status.
public isCaseInsensitive ( ) : boolean
return boolean

isDebugging() public method

Check if app is in debug mode.
public isDebugging ( ) : boolean
return boolean

isEloquent() public method

Check if the engine used was eloquent.
public isEloquent ( ) : boolean
return boolean

isOracleSql() public method

Check if the current sql language is based on oracle syntax.
public isOracleSql ( ) : boolean
return boolean

isQueryBuilder() public method

Check query type is a builder.
public isQueryBuilder ( ) : boolean
return boolean

isSmartSearch() public method

Check if DataTables uses smart search.
public isSmartSearch ( ) : boolean
return boolean

isWildcard() public method

Get config use wild card status.
public isWildcard ( ) : boolean
return boolean

make() public method

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

order() public method

Override default ordering method with a closure callback.
public order ( callable $closure )
$closure callable

orderByNullsLast() public method

Set datatables to do ordering with NULLS LAST option.
public orderByNullsLast ( )

orderColumn() public method

Override default column ordering.
public orderColumn ( string $column, string $sql, array $bindings = [] )
$column string
$sql string
$bindings array

orderColumns() public method

Order each given columns versus the given custom sql.
public orderColumns ( array $columns, string $sql, array $bindings = [] )
$columns array
$sql string
$bindings array

orderRecords() protected method

Sort records.
protected orderRecords ( boolean $skip ) : void
$skip boolean
return void

overrideGlobalSearch() protected method

Update flags to disable global search
protected overrideGlobalSearch ( callable $callback, mixed $parameters, boolean $autoFilter = false )
$callback callable
$parameters mixed
$autoFilter boolean

paginate() protected method

Apply pagination.
protected paginate ( ) : void
return void

removeColumn() public method

Remove column from collection.
public removeColumn ( )

render() protected method

Render json response.
protected render ( boolean $object = false ) : Illuminate\Http\JsonResponse
$object boolean
return Illuminate\Http\JsonResponse

setRowAttr() public method

result: .
public setRowAttr ( array $data )
$data array

setRowClass() public method

result: .
public setRowClass ( string | callable $content )
$content string | callable

setRowData() public method

Set DT_RowData templates.
public setRowData ( array $data )
$data array

setRowId() public method

result: .
public setRowId ( string | callable $content )
$content string | callable

setSerializer() public method

Set fractal serializer class.
public setSerializer ( string $serializer )
$serializer string

setTotalRecords() public method

Set total records manually.
public setTotalRecords ( integer $total )
$total integer

setTransformer() public method

Set data output transformer.
public setTransformer ( League\Fractal\TransformerAbstract $transformer )
$transformer League\Fractal\TransformerAbstract

setupKeyword() protected method

Setup search keyword.
protected setupKeyword ( string $value ) : string
$value string
return string

showDebugger() protected method

Append debug parameters on output.
protected showDebugger ( array $output ) : array
$output array
return array

skipPaging() public method

Skip pagination as needed.
public skipPaging ( )

smart() public method

Set smart search config at runtime.
public smart ( boolean $bool = true )
$bool boolean

whitelist() public method

Update list of columns that is not allowed for search/sort.
public whitelist ( string | array $whitelist = '*' )
$whitelist string | array

wildcardLikeString() protected method

Adds % wildcards to the given string.
protected wildcardLikeString ( string $str, boolean $lowercase = true ) : string
$str string
$lowercase boolean
return string

with() public method

Append data on json response.
public with ( mixed $key, mixed $value = '' )
$key mixed
$value mixed

withTrashed() public method

Change withTrashed flag value.
public withTrashed ( boolean $withTrashed = true )
$withTrashed boolean

Property Details

$appends protected_oe property

Array of data to append on json response.
protected array $appends
return array

$autoFilter protected_oe property

Auto-filter flag.
protected bool $autoFilter
return boolean

$builder protected_oe property

Query builder object.
protected Builder,Illuminate\Database\Query $builder
return Illuminate\Database\Query\Builder

$columnDef protected_oe property

DT columns definitions container (add/edit/remove/filter/order/escape).
protected array $columnDef
return array

$columns protected_oe property

Array of result columns/fields.
protected array $columns
return array

$connection protected_oe property

Database connection used.
protected Connection,Illuminate\Database $connection
return Illuminate\Database\Connection

$database protected_oe property

Database driver used.
protected string $database
return string

$extraColumns protected_oe property

Extra/Added columns.
protected array $extraColumns
return array

$filterCallback protected_oe property

Callback to override global search.
protected callable $filterCallback
return callable

$filterCallbackParameters protected_oe property

Parameters to passed on filterCallback.
protected mixed $filterCallbackParameters
return mixed

$filteredRecords protected_oe property

Total filtered records.
protected int $filteredRecords
return integer

$isFilterApplied protected_oe property

[internal] Track if any filter was applied for at least one column
protected bool $isFilterApplied
return boolean

$nullsLast protected_oe property

Flag for ordering NULLS LAST option.
protected bool $nullsLast
return boolean

$orderCallback protected_oe property

Custom ordering callback.
protected callable $orderCallback
return callable

$prefix protected_oe property

Database prefix
protected string $prefix
return string

$query protected_oe property

Builder object.
protected Builder,Illuminate\Database\Query|Builder,Illuminate\Database\Eloquent $query
return Illuminate\Database\Query\Builder | Illuminate\Database\Eloquent\Builder

$query_type protected_oe property

Query type.
protected string $query_type
return string

$request public_oe property

Datatables Request object.
public Request,Yajra\Datatables $request
return Yajra\Datatables\Request

$serializer protected_oe property

Fractal serializer class.
protected string|null $serializer
return string | null

$skipPaging protected_oe property

Skip paginate as needed.
protected bool $skipPaging
return boolean

$templates protected_oe property

DT row templates container.
protected array $templates
return array

$totalRecords protected_oe property

Total records.
protected int $totalRecords
return integer

$transformer protected_oe property

Output transformer.
protected TransformerAbstract,League\Fractal $transformer
return League\Fractal\TransformerAbstract

$withTrashed protected_oe property

By default we do not select soft deleted records
protected bool $withTrashed
return boolean