PHP Класс Caffeinated\Menus\Builder

Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$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