PHP 트레잇 Lookitsatravis\Listify\Listify

http://lookitsatravis.github.io/listify Ported from https://github.com/swanandp/acts_as_list
저자: Travis Vignon ([email protected])
파일 보기 프로젝트 열기: lookitsatravis/listify

공개 메소드들

메소드 설명
addNewAt ( ) : string Returns the value of the 'add_new_at' option
bootListify ( ) : boolean Returns whether the scope has changed during the course of interaction with the model
decrementPosition ( ) : void Decrease the position of this item without adjusting the rest of the list.
defaultPosition ( ) : mixed Get the default item position
getListifyPosition ( ) : integer Returns the value of the model's current position
higherItem ( ) : mixed Return the next higher item in the list.
higherItems ( integer $limit = NULL ) : mixed Return the next n higher items in the list. Selects all higher items by default
incrementPosition ( ) : void Increase the position of this item without adjusting the rest of the list.
initListify ( array $options = [] ) : void Required to override options and kick off the Listify's automatic list management.
insertAt ( integer $position = NULL ) : void Insert the item at the given position (defaults to the top position of 1).
isDefaultPosition ( ) : boolean Returns whether the item's current position matches the default position
isFirst ( ) : boolean Returns if this object is the first in the list.
isInList ( ) : boolean Returns whether the item is in the list
isLast ( ) : boolean Returns if this object is the last in the list.
isNotInList ( ) : boolean Returns whether the item is not in the list
listifyTop ( ) : string Get the value of the "top_of_list" option
lowerItem ( ) : mixed Return the next lower item in the list.
lowerItems ( integer $limit = NULL ) : mixed Return the next n lower items in the list. Selects all lower items by default.
moveHigher ( ) : void Swap positions with the next higher item, if one exists.
moveLower ( ) : void Swap positions with the next lower item, if one exists.
moveToBottom ( ) : void Move to the bottom of the list. If the item is already in the list, the items below it have their positions adjusted accordingly.
moveToTop ( ) : void Move to the top of the list. If the item is already in the list, the items above it have their positions adjusted accordingly.
positionColumn ( ) : string Get the name of the position 'column' option
removeFromList ( ) : void Removes the item from the list.
scopeInList ( $query ) : Eloquent An Eloquent scope that returns only items currently in the list
scopeListifyScope ( $query ) : Eloquent An Eloquent scope based on the processed scope option
scopeName ( ) : mixed Get the value of the 'scope' option
setListPosition ( integer $new_position ) : void Sets the new position and saves it
setListifyConfig ( $key, $value ) : void Updates a listify config value
setListifyPosition ( integer $position ) : void Sets the value of the model's position
swapChangedAttributes ( ) : void Temporarily swap changes attributes with current attributes

비공개 메소드들

메소드 설명
addToListBottom ( ) : void Adds item to the bottom of the list
addToListTop ( ) : void Adds item to the top of the list
assumeBottomPosition ( ) : void Forces item to assume the bottom position in the list.
assumeTopPosition ( ) : void Forces item to assume the top position in the list.
bottomItem ( mixed $except = NULL ) : mixed Returns the bottom item
bottomPositionInList ( mixed $except = NULL ) : integer Returns the bottom position number in the list
checkScope ( ) : void Determines whether scope has changed. If so, it will move the current item to the top/bottom of the list and update all other items
decrementPositionsOnLowerItems ( integer $position = NULL ) : void This has the effect of moving all the lower items up one.
getConditionStringFromQueryBuilder ( $query ) : string Returns a raw WHERE clause based off of a Query Builder object
hasScopeChanged ( ) : boolean Returns whether the scope has changed during the course of interaction with the model
incrementPositionsOnAllItems ( ) : void Increments position of all items in the list.
incrementPositionsOnHigherItems ( ) : void This has the effect of moving all the higher items down one.
incrementPositionsOnLowerItems ( integer $position ) : void This has the effect of moving all the lower items down one.
insertAtPosition ( integer $position ) : void Inserts the item at a particular location in the list. All items around it will be modified
listifyList ( ) : mixed Creates an instance of the current class scope as a list
primaryKey ( ) : string Returns the primary key of the current Eloquent instance
reloadPosition ( ) : void Reloads the position value of the current item. This is only called when an item is deleted and is here to prevent unsetting the position column which would prevent other items from being moved properly
scopeCondition ( ) : string Returns the raw WHERE clause to be used as the Listify scope
shufflePositionsOnIntermediateItems ( integer $old_position, integer $new_position, string $avoid_id = NULL ) : void Reorders intermediate items to support moving an item from old_position to new_position.
updatePositions ( ) : void Updates all items based on the original position of the item and the new position of the item

메소드 상세

addNewAt() 공개 메소드

Returns the value of the 'add_new_at' option
public addNewAt ( ) : string
리턴 string

bootListify() 공개 정적인 메소드

Returns whether the scope has changed during the course of interaction with the model
public static bootListify ( ) : boolean
리턴 boolean

decrementPosition() 공개 메소드

Decrease the position of this item without adjusting the rest of the list.
public decrementPosition ( ) : void
리턴 void

defaultPosition() 공개 메소드

Get the default item position
public defaultPosition ( ) : mixed
리턴 mixed

getListifyPosition() 공개 메소드

Returns the value of the model's current position
public getListifyPosition ( ) : integer
리턴 integer

higherItem() 공개 메소드

Return the next higher item in the list.
public higherItem ( ) : mixed
리턴 mixed Returned item will be of the same type as the current class instance

higherItems() 공개 메소드

Return the next n higher items in the list. Selects all higher items by default
public higherItems ( integer $limit = NULL ) : mixed
$limit integer The number of items to return
리턴 mixed Returned items will be of the same type as the current class instance

incrementPosition() 공개 메소드

Increase the position of this item without adjusting the rest of the list.
public incrementPosition ( ) : void
리턴 void

initListify() 공개 메소드

Required to override options and kick off the Listify's automatic list management.
public initListify ( array $options = [] ) : void
$options array [column=>string, scope=>string|BelongsTo|Builder, top_of_list=>int, add_new_at=>string]
리턴 void

insertAt() 공개 메소드

Insert the item at the given position (defaults to the top position of 1).
public insertAt ( integer $position = NULL ) : void
$position integer
리턴 void

isDefaultPosition() 공개 메소드

Returns whether the item's current position matches the default position
public isDefaultPosition ( ) : boolean
리턴 boolean

isFirst() 공개 메소드

Returns if this object is the first in the list.
public isFirst ( ) : boolean
리턴 boolean

isInList() 공개 메소드

Returns whether the item is in the list
public isInList ( ) : boolean
리턴 boolean

isLast() 공개 메소드

Returns if this object is the last in the list.
public isLast ( ) : boolean
리턴 boolean

isNotInList() 공개 메소드

Returns whether the item is not in the list
public isNotInList ( ) : boolean
리턴 boolean

listifyTop() 공개 메소드

Get the value of the "top_of_list" option
public listifyTop ( ) : string
리턴 string

lowerItem() 공개 메소드

Return the next lower item in the list.
public lowerItem ( ) : mixed
리턴 mixed Returned item will be of the same type as the current class instance

lowerItems() 공개 메소드

Return the next n lower items in the list. Selects all lower items by default.
public lowerItems ( integer $limit = NULL ) : mixed
$limit integer The number of items to return
리턴 mixed Returned items will be of the same type as the current class instance

moveHigher() 공개 메소드

Swap positions with the next higher item, if one exists.
public moveHigher ( ) : void
리턴 void

moveLower() 공개 메소드

Swap positions with the next lower item, if one exists.
public moveLower ( ) : void
리턴 void

moveToBottom() 공개 메소드

Move to the bottom of the list. If the item is already in the list, the items below it have their positions adjusted accordingly.
public moveToBottom ( ) : void
리턴 void

moveToTop() 공개 메소드

Move to the top of the list. If the item is already in the list, the items above it have their positions adjusted accordingly.
public moveToTop ( ) : void
리턴 void

positionColumn() 공개 메소드

Get the name of the position 'column' option
public positionColumn ( ) : string
리턴 string

removeFromList() 공개 메소드

Removes the item from the list.
public removeFromList ( ) : void
리턴 void

scopeInList() 공개 메소드

An Eloquent scope that returns only items currently in the list
public scopeInList ( $query ) : Eloquent
$query
리턴 Eloquent Query Builder instance

scopeListifyScope() 공개 메소드

An Eloquent scope based on the processed scope option
public scopeListifyScope ( $query ) : Eloquent
$query An Eloquent Query Builder instance
리턴 Eloquent Query Builder instance

scopeName() 공개 메소드

Get the value of the 'scope' option
public scopeName ( ) : mixed
리턴 mixed Can be a string, an Eloquent BelongsTo, or an Eloquent Builder

setListPosition() 공개 메소드

Sets the new position and saves it
public setListPosition ( integer $new_position ) : void
$new_position integer
리턴 void

setListifyConfig() 공개 메소드

Updates a listify config value
public setListifyConfig ( $key, $value ) : void
리턴 void

setListifyPosition() 공개 메소드

Sets the value of the model's position
public setListifyPosition ( integer $position ) : void
$position integer
리턴 void

swapChangedAttributes() 공개 메소드

Temporarily swap changes attributes with current attributes
public swapChangedAttributes ( ) : void
리턴 void