PHP Class Nestable\Services\NestableService

Inheritance: use trait Nestable\MacrosTrait
Show file Open project: atayahmet/laravel-nestable Class Usage Examples

Public Properties

Property Type Description
$data Collection data.

Protected Properties

Property Type Description
$active mixed Selectable values for html output.
$config array configuration vars.
$dropdownAttr array Dropdown attributes.
$multiple boolean Multiple dropdown status.
$optionAttr array Dropdown or Listbox item attributes.
$optionUlAttr
$parent string Parent key name.
$parents array Parent idset of current process.
$route array Route parameters.
$selected mixed Selectable values.

Public Methods

Method Description
__call ( $method, $args )
active ( ) : object Attribute insert helper for html render.
addAttr ( mixed $attr, mixed $value = '' ) : object Add attribute to
  • element.
  • attr ( array $attributes ) : object Set the attributes of generated dropdown.
    closeLi ( string $li ) : string Generate close li tag.
    closeUl ( string $ul ) : string Generate close ul tag.
    hasChild ( string $key = null, mixed $value = null, Collection $data = null ) : boolean Child menu checker.
    isValid ( string $type, $render = false ) : mixed Array validator.
    make ( mixed $data ) : object Set the data to wrap class.
    multiple ( ) : object Multiple dropdown menu.
    openLi ( array $li, $extra = '' ) : string Generate open li tag.
    parent ( integer $parent = false ) : object Set the parent id for child elements.
    renderAsArray ( object $data = false, integer $parent ) : Recursion | array Pass to array of all data as nesting.
    renderAsDropdown ( object $data = false, integer $parent, boolean $first = true, integer $level ) : string Convert to dropdown.
    renderAsHtml ( object $data = false, integer $parent, boolean $first = true ) : string Pass to html (ul:li) as nesting.
    renderAsJson ( object $data = false, integer $parent ) : Recursion | array Pass to json string of all data as nesting.
    renderAsMultiple ( )
    route ( array $route ) Route generator.
    save ( array $params ) Save the parameters.
    selected ( integer | array $values ) : object Save the will select values.
    ul ( string $items = false, $parent_id ) : string Generate open ul tag.
    ulAttr ( mixed $attr, mixed $value = '' ) : object Add attribute to
      element.

    Protected Methods

    Method Description
    addAttributes ( ) : string Contact th attributes to dropdown.
    doActive ( array $href, string $label ) : string Insert all saved attributes to
  • element.
  • doSelect ( mixed $value, $label ) : string Set the as selected of items.
    renderAttr ( mixed $attributes = false, mixed $params = false ) : string Render the attritues of html elements.
    setParameters ( array $args ) initialize parameters (toArray, toHtml, toDropdown).
    url ( string $path, $label ) : string URL Generator.

    Method Details

    __call() public method

    public __call ( $method, $args )

    active() public method

    Attribute insert helper for html render.
    public active ( ) : object
    return object (instance)

    addAttr() public method

    Add attribute to
  • element.
  • public addAttr ( mixed $attr, mixed $value = '' ) : object
    $attr mixed
    $value mixed
    return object (instance)

    addAttributes() protected method

    Contact th attributes to dropdown.
    protected addAttributes ( ) : string
    return string

    attr() public method

    Set the attributes of generated dropdown.
    public attr ( array $attributes ) : object
    $attributes array
    return object (instance)

    closeLi() public method

    Generate close li tag.
    public closeLi ( string $li ) : string
    $li string
    return string

    closeUl() public method

    Generate close ul tag.
    public closeUl ( string $ul ) : string
    $ul string
    return string

    doActive() protected method

    Insert all saved attributes to
  • element.
  • protected doActive ( array $href, string $label ) : string
    $href array
    $label string
    return string

    doSelect() protected method

    Set the as selected of items.
    protected doSelect ( mixed $value, $label ) : string
    $value mixed
    return string

    hasChild() public method

    Child menu checker.
    public hasChild ( string $key = null, mixed $value = null, Collection $data = null ) : boolean
    $key string
    $value mixed
    $data Illuminate\Support\Collection Illuminate\Support\Collection as Collect
    return boolean

    isValid() public method

    Array validator.
    public isValid ( string $type, $render = false ) : mixed
    $type string
    return mixed

    make() public method

    Set the data to wrap class.
    public make ( mixed $data ) : object
    $data mixed
    return object (instance)

    multiple() public method

    Multiple dropdown menu.
    public multiple ( ) : object
    return object (instance)

    openLi() public method

    Generate open li tag.
    public openLi ( array $li, $extra = '' ) : string
    $li array
    return string

    parent() public method

    Set the parent id for child elements.
    public parent ( integer $parent = false ) : object
    $parent integer
    return object (instance)

    renderAsArray() public method

    Pass to array of all data as nesting.
    public renderAsArray ( object $data = false, integer $parent ) : Recursion | array
    $data object Illuminate\Support\Collection
    $parent integer
    return Recursion | array

    renderAsDropdown() public method

    Convert to dropdown.
    public renderAsDropdown ( object $data = false, integer $parent, boolean $first = true, integer $level ) : string
    $data object Illuminate\Support\Collection
    $parent integer Current parent id
    $first boolean first run
    $level integer nest counter
    return string

    renderAsHtml() public method

    Pass to html (ul:li) as nesting.
    public renderAsHtml ( object $data = false, integer $parent, boolean $first = true ) : string
    $data object Illuminate\Support\Collection
    $parent integer Current parent id
    $first boolean First run
    return string

    renderAsJson() public method

    Pass to json string of all data as nesting.
    public renderAsJson ( object $data = false, integer $parent ) : Recursion | array
    $data object Illuminate\Support\Collection
    $parent integer
    return Recursion | array

    renderAsMultiple() public method

    public renderAsMultiple ( )

    renderAttr() protected method

    Render the attritues of html elements.
    protected renderAttr ( mixed $attributes = false, mixed $params = false ) : string
    $attributes mixed
    $params mixed
    return string

    route() public method

    Route generator.
    public route ( array $route )
    $route array

    save() public method

    Save the parameters.
    public save ( array $params )
    $params array

    selected() public method

    Save the will select values.
    public selected ( integer | array $values ) : object
    $values integer | array
    return object (instance)

    setParameters() protected method

    initialize parameters (toArray, toHtml, toDropdown).
    protected setParameters ( array $args )
    $args array

    ul() public method

    Generate open ul tag.
    public ul ( string $items = false, $parent_id ) : string
    $items string
    return string

    ulAttr() public method

    Add attribute to
      element.
    public ulAttr ( mixed $attr, mixed $value = '' ) : object
    $attr mixed
    $value mixed
    return object (instance)

    url() protected method

    URL Generator.
    protected url ( string $path, $label ) : string
    $path string
    return string

    Property Details

    $active protected property

    Selectable values for html output.
    protected mixed $active
    return mixed

    $config protected property

    configuration vars.
    protected array $config
    return array

    $data public property

    Collection data.
    public $data

    $dropdownAttr protected property

    Dropdown attributes.
    protected array $dropdownAttr
    return array

    $multiple protected property

    Multiple dropdown status.
    protected bool $multiple
    return boolean

    $optionAttr protected property

    Dropdown or Listbox item attributes.
    protected array $optionAttr
    return array

    $optionUlAttr protected property

    protected $optionUlAttr

    $parent protected property

    Parent key name.
    protected string $parent
    return string

    $parents protected property

    Parent idset of current process.
    protected array $parents
    return array

    $route protected property

    Route parameters.
    protected array $route
    return array

    $selected protected property

    Selectable values.
    protected mixed $selected
    return mixed