PHP 클래스 Caffeinated\Menus\Builder

파일 보기 프로젝트 열기: caffeinated/menus 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$config array
$html Collective\Html\HtmlBuilder
$items array
$lastId integer
$name string
$reserved array
$url Illuminate\Routing\UrlGenerator

공개 메소드들

메소드 설명
__call ( string $method, array $args ) : Item | boolean Dynamic search method against a menu attribute.
__construct ( string $name, array $config, HtmlBuilder $html, UrlGenerator $url ) Create a new Builder instance.
__get ( string $property ) : Item Returns menu item by name.
active ( ) : Caffeinated\Menus\Collection Fetches and returns all active state menu items.
add ( string $title, array | string $options = '' ) : Item Add an item to the defined menu.
all ( ) : Caffeinated\Menus\Collection Fetches and returns all menu items.
asUl ( array $attributes = [] ) : string Renders the menu as an unordered list.
attributes ( array $attributes = [] ) : string Converts the defined attributes into HTML.
config ( string $key ) : string Return the configuration value by key.
dispatch ( array $options ) : string Get the action type from the options.
divide ( array $attributes = [] ) : void Insert a divider after the item.
extractAttributes ( array $options = [] ) : array Extract the valid attributes from the passed options.
filter ( callable $callback ) : Builder Filter menu items through a callback.
filterRecursively ( string $attribute, mixed $value ) : Caffeinated\Menus\Collection Filter menu items recursively.
find ( integer $id ) : Item Fetches and returns a menu item by it's ID.
first ( ) : Item Fetches and returns the first menu item.
formatGroupClass ( $new, $old ) : mixed Format the groups class.
get ( string $slug ) : Item Fetches and returns a menu item by it's slug.
getLastGroupPrefix ( ) : mixed Get the prefix from the last group of the stack.
guard ( ) : Builder Filter menu items based on Shinobi permissions.
isAbsolute ( string $url ) : boolean Determines if the given URL is absolute.
item ( string $slug ) : Item Facade method for the get() method.
last ( ) : Item Fetches and returns the last menu item.
roots ( ) : Caffeinated\Menus\Collection Returns all items with no parents.
sortBy ( string $key ) : Builder Sorts the menu based on key given in ascending order.
sortByDesc ( string $key ) : Builder Sorts the menu based on key given in descending order.

보호된 메소드들

메소드 설명
getAction ( array | string $action ) : string Get the controller action for a "action" option.
getRoute ( array | string $route ) : string Get the route action for a "route" option.
getUrl ( array | string $options ) : string Get the action for a "url" option.
id ( ) : integer Generate a unique ID for every item added to the menu.
render ( string $type = 'ul', integer $parent = null ) : string Generate the menu items as list items, recursively.

메소드 상세

__call() 공개 메소드

Dynamic search method against a menu attribute.
public __call ( string $method, array $args ) : Item | boolean
$method string
$args array
리턴 Item | boolean

__construct() 공개 메소드

Create a new Builder instance.
public __construct ( string $name, array $config, HtmlBuilder $html, UrlGenerator $url )
$name string
$config array
$html Collective\Html\HtmlBuilder
$url Illuminate\Routing\UrlGenerator

__get() 공개 메소드

Returns menu item by name.
public __get ( string $property ) : Item
$property string
리턴 Item

active() 공개 메소드

Fetches and returns all active state menu items.
public active ( ) : Caffeinated\Menus\Collection
리턴 Caffeinated\Menus\Collection

add() 공개 메소드

Add an item to the defined menu.
public add ( string $title, array | string $options = '' ) : Item
$title string
$options array | string
리턴 Item

all() 공개 메소드

Fetches and returns all menu items.
public all ( ) : Caffeinated\Menus\Collection
리턴 Caffeinated\Menus\Collection

asUl() 공개 메소드

Renders the menu as an unordered list.
public asUl ( array $attributes = [] ) : string
$attributes array
리턴 string

attributes() 공개 메소드

Converts the defined attributes into HTML.
public attributes ( array $attributes = [] ) : string
$attributes array
리턴 string

config() 공개 메소드

Return the configuration value by key.
public config ( string $key ) : string
$key string
리턴 string

dispatch() 공개 메소드

Get the action type from the options.
public dispatch ( array $options ) : string
$options array
리턴 string

divide() 공개 메소드

Insert a divider after the item.
public divide ( array $attributes = [] ) : void
$attributes array
리턴 void

extractAttributes() 공개 메소드

Extract the valid attributes from the passed options.
public extractAttributes ( array $options = [] ) : array
$options array
리턴 array

filter() 공개 메소드

Since menu items are stored as a collection, this will simply forward the callback to the Laravel Collection filter() method and return the results.
public filter ( callable $callback ) : Builder
$callback callable
리턴 Builder

filterRecursively() 공개 메소드

Filter menu items recursively.
public filterRecursively ( string $attribute, mixed $value ) : Caffeinated\Menus\Collection
$attribute string
$value mixed
리턴 Caffeinated\Menus\Collection

find() 공개 메소드

Fetches and returns a menu item by it's ID.
public find ( integer $id ) : Item
$id integer
리턴 Item

first() 공개 메소드

Fetches and returns the first menu item.
public first ( ) : Item
리턴 Item

formatGroupClass() 공개 정적인 메소드

Format the groups class.
public static formatGroupClass ( $new, $old ) : mixed
리턴 mixed

get() 공개 메소드

Fetches and returns a menu item by it's slug.
public get ( string $slug ) : Item
$slug string
리턴 Item

getAction() 보호된 메소드

Get the controller action for a "action" option.
protected getAction ( array | string $action ) : string
$action array | string
리턴 string

getLastGroupPrefix() 공개 메소드

Get the prefix from the last group of the stack.
public getLastGroupPrefix ( ) : mixed
리턴 mixed

getRoute() 보호된 메소드

Get the route action for a "route" option.
protected getRoute ( array | string $route ) : string
$route array | string
리턴 string

getUrl() 보호된 메소드

Get the action for a "url" option.
protected getUrl ( array | string $options ) : string
$options array | string
리턴 string

guard() 공개 메소드

Filter menu items based on Shinobi permissions.
public guard ( ) : Builder
리턴 Builder

id() 보호된 메소드

Generate a unique ID for every item added to the menu.
protected id ( ) : integer
리턴 integer

isAbsolute() 공개 정적인 메소드

Determines if the given URL is absolute.
public static isAbsolute ( string $url ) : boolean
$url string
리턴 boolean

item() 공개 메소드

Facade method for the get() method.
public item ( string $slug ) : Item
$slug string
리턴 Item

last() 공개 메소드

Fetches and returns the last menu item.
public last ( ) : Item
리턴 Item

render() 보호된 메소드

Generate the menu items as list items, recursively.
protected render ( string $type = 'ul', integer $parent = null ) : string
$type string
$parent integer
리턴 string

roots() 공개 메소드

Returns all items with no parents.
public roots ( ) : Caffeinated\Menus\Collection
리턴 Caffeinated\Menus\Collection

sortBy() 공개 메소드

Sorts the menu based on key given in ascending order.
public sortBy ( string $key ) : Builder
$key string
리턴 Builder

sortByDesc() 공개 메소드

Sorts the menu based on key given in descending order.
public sortByDesc ( string $key ) : Builder
$key string
리턴 Builder

프로퍼티 상세

$config 보호되어 있는 프로퍼티

protected array $config
리턴 array

$html 보호되어 있는 프로퍼티

protected HtmlBuilder,Collective\Html $html
리턴 Collective\Html\HtmlBuilder

$items 보호되어 있는 프로퍼티

protected array $items
리턴 array

$lastId 보호되어 있는 프로퍼티

protected int $lastId
리턴 integer

$name 보호되어 있는 프로퍼티

protected string $name
리턴 string

$reserved 보호되어 있는 프로퍼티

protected array $reserved
리턴 array

$url 보호되어 있는 프로퍼티

protected UrlGenerator,Illuminate\Routing $url
리턴 Illuminate\Routing\UrlGenerator