PHP Class Msieprawski\ResourceTable\Generators\Collection

Show file Open project: msieprawski/resource-table Class Usage Examples

Public Methods

Method Description
__construct ( Builder $builder ) Sets builder object
addColumn ( array $data ) Adds column to resource table
customView ( string $name ) Sets custom view name for further rendering
filter ( boolean $enabled ) Sets true if filter should be rendered
getSort ( ) : array Returns $_sort variable
make ( ) : string Returns HTML with resource table
page ( integer $page ) Sets $_page variable
paginate ( boolean $paginate ) Sets $_paginate variable
perPage ( integer $perPage ) Sets $_perPage variable
renderFilterForm ( ) : boolean Checks if filter form should be generated
rendererNamespace ( ) : string Returns renderer default namespace
resetFormUrl ( ) : string Returns URL to reset search form
setExtraViewData ( array $data ) Sets extra (custom) view data
setPaginationPresenter ( string $presenter ) Sets $_paginationPresenter object name
setRendererNamespace ( string $namespace ) Set renderer default namespace to prevent long class names
sort ( string $index, string $direction ) Sets sort configuration
view ( string $name ) Sets package view name for further rendering

Private Methods

Method Description
_addQueryCondition ( Builder $builder, string $type, string $columnName, string $operator, string $value ) : Builder Adds condition to the query builder
_getCountForPagination ( Builder $builder ) : integer Returns total results for given query
_getPaginatorPresenter ( array $items ) : mixed Returns Paginator Presenter object if pagination is enabled
_prepareBuilder ( ) Prepares builder object before calling get method on it
_prepareFilterValue ( array $column, mixed $value ) : mixed Basing on column configuration prepares given field value If column configuration has filter function - use it to prepare value
_setView ( string $name, boolean $custom = false ) Sets view name for further rendering
_validSort ( array $params ) : boolean Checks if provided order configuration (from GET) is valid
_validateColumn ( array $data ) : boolean | string Checks if provided column data is valid Returns bool if it's valid Returns string it it's not valid

Method Details

__construct() public method

Sets builder object
public __construct ( Builder $builder )
$builder Illuminate\Database\Query\Builder

addColumn() public method

Adds column to resource table
public addColumn ( array $data )
$data array

customView() public method

Sets custom view name for further rendering
public customView ( string $name )
$name string

filter() public method

Sets true if filter should be rendered
public filter ( boolean $enabled )
$enabled boolean

getSort() public method

Returns $_sort variable
public getSort ( ) : array
return array

make() public method

Returns HTML with resource table
public make ( ) : string
return string

page() public method

Sets $_page variable
public page ( integer $page )
$page integer

paginate() public method

Sets $_paginate variable
public paginate ( boolean $paginate )
$paginate boolean

perPage() public method

Sets $_perPage variable
public perPage ( integer $perPage )
$perPage integer

renderFilterForm() public method

Checks if filter form should be generated
public renderFilterForm ( ) : boolean
return boolean

rendererNamespace() public method

Returns renderer default namespace
public rendererNamespace ( ) : string
return string

resetFormUrl() public method

Returns URL to reset search form
public resetFormUrl ( ) : string
return string

setExtraViewData() public method

Sets extra (custom) view data
public setExtraViewData ( array $data )
$data array

setPaginationPresenter() public method

Sets $_paginationPresenter object name
public setPaginationPresenter ( string $presenter )
$presenter string

setRendererNamespace() public method

Set renderer default namespace to prevent long class names
public setRendererNamespace ( string $namespace )
$namespace string

sort() public method

Sets sort configuration
public sort ( string $index, string $direction )
$index string
$direction string

view() public method

Sets package view name for further rendering
public view ( string $name )
$name string