class Illuminate / View / ComponentAttributeBag
You're browsing the documentation for an upcoming version of Laravel. The documentation and features of this release are subject to change.

ComponentAttributeBag

Implements

Uses

Properties

protected

$attributes array

The raw array of attributes.

Default: []

Methods

public

__construct ( array $attributes ) : void

Create a new component attribute bag instance.

Parameters

  • $attributes array
public

first ( $default ) : mixed

Get the first attribute's value.

Parameters

  • $default mixed
public

get ( $key , $default ) : mixed

Get a given attribute from the attribute array.

Parameters

  • $key string
  • $default mixed
public

has ( $key ) : bool

Determine if a given attribute exists in the attribute array.

Parameters

  • $key array|string
public

hasAny ( $key ) : bool

Determine if any of the keys exist in the attribute array.

Parameters

  • $key array|string
public

missing ( $key ) : bool

Determine if a given attribute is missing from the attribute array.

Parameters

  • $key string
public

only ( $keys ) : static

Only include the given attribute from the attribute array.

Parameters

  • $keys mixed
public

except ( $keys ) : static

Exclude the given attribute from the attribute array.

Parameters

  • $keys mixed|array
public

filter ( $callback ) : static

Filter the attributes, returning a bag of attributes that pass the filter.

Parameters

  • $callback callable
public

whereStartsWith ( $needles ) : static

Return a bag of attributes that have keys starting with the given value / pattern.

Parameters

  • $needles string|string[]
public

whereDoesntStartWith ( $needles ) : static

Return a bag of attributes with keys that do not start with the given value / pattern.

Parameters

  • $needles string|string[]
public

thatStartWith ( $needles ) : static

Return a bag of attributes that have keys starting with the given value / pattern.

Parameters

  • $needles string|string[]
public

onlyProps ( $keys ) : static

Only include the given attribute from the attribute array.

Parameters

  • $keys mixed|array
public

exceptProps ( $keys ) : static

Exclude the given attribute from the attribute array.

Parameters

  • $keys mixed|array
protected

extractPropNames ( $keys ) : array

Extract prop names from given keys.

Parameters

  • $keys mixed|array
public

class ( $classList ) : static

Conditionally merge classes into the attribute bag.

Parameters

  • $classList mixed|array
public

style ( $styleList ) : static

Conditionally merge styles into the attribute bag.

Parameters

  • $styleList mixed|array
public

merge ( array $attributeDefaults , $escape ) : static

Merge additional attributes / values into the attribute bag.

Parameters

  • $attributeDefaults array
  • $escape bool
protected

shouldEscapeAttributeValue ( $escape , $value ) : bool

Determine if the specific attribute value should be escaped.

Parameters

  • $escape bool
  • $value mixed
public

prepends ( $value ) : AppendableAttributeValue

Create a new appendable attribute value.

Parameters

  • $value mixed
protected

resolveAppendableAttributeDefault ( $attributeDefaults , $key , $escape ) : mixed

Resolve an appendable attribute value default value.

Parameters

  • $attributeDefaults array
  • $key string
  • $escape bool
public

getAttributes ( ) : array

Get all of the raw attributes.

public

setAttributes ( array $attributes ) : void

Set the underlying attributes.

Parameters

  • $attributes array
public

toHtml ( ) : string

Get content as a string of HTML.

public

__invoke ( array $attributeDefaults ) : HtmlString

Merge additional attributes / values into the attribute bag.

Parameters

  • $attributeDefaults array
public

offsetExists ( $offset ) : bool

Determine if the given offset exists.

Parameters

  • $offset string
public

offsetGet ( $offset ) : mixed

Get the value at the given offset.

Parameters

  • $offset string
public

offsetSet ( $offset , $value ) : void

Set the value at a given offset.

Parameters

  • $offset string
  • $value mixed
public

offsetUnset ( $offset ) : void

Remove the value at the given offset.

Parameters

  • $offset string
public

getIterator ( ) : ArrayIterator

Get an iterator for the items.

public

__toString ( ) : string

Implode the attributes into a single HTML ready string.