class Illuminate / View / Component
abstract

Component

Properties

protected

$except array

The properties / methods that should not be exposed to the component.

Default: []
public

$componentName string

The component alias name.

Default: null
public

$attributes ComponentAttributeBag

The component attributes.

Default: null
protected static

$factory Factory |null

The view factory instance, if any.

Default: null
protected static

$componentsResolver callable|null

The component resolver callback.

Default: null
protected static

$bladeViewCache array

The cache of blade view names, keyed by contents.

Default: []
protected static

$propertyCache array

The cache of public property names, keyed by class.

Default: []
protected static

$methodCache array

The cache of public method names, keyed by class.

Default: []
protected static

$constructorParametersCache array>

The cache of constructor parameters, keyed by class.

Default: []

Methods

public abstract

render ( ) : View |Htmlable |Closure |string

Get the view / view contents that represent the component.

public static

resolve ( $data ) : static

Resolve the component instance with the given data.

Parameters

  • $data array
protected static

extractConstructorParameters ( ) : array

Extract the constructor parameters for the component.

public

resolveView ( ) : View |Htmlable |Closure |string

Resolve the Blade view or view file that should be used when rendering the component.

protected

extractBladeViewFromString ( $contents ) : string

Create a Blade view with the raw component string content.

Parameters

  • $contents string
protected

createBladeViewFromString ( $factory , $contents ) : string

Create a Blade view with the raw component string content.

Parameters

public

data ( ) : array

Get the data that should be supplied to the view.

protected

extractPublicProperties ( ) : array

Extract the public properties for the component.

protected

extractPublicMethods ( ) : array

Extract the public methods for the component.

protected

createVariableFromMethod ( ReflectionMethod $method ) : mixed

Create a callable variable from the given method.

Parameters

protected

createInvokableVariable ( string $method ) : InvokableComponentVariable

Create an invokable, toStringable variable for the given component method.

Parameters

  • $method string
protected

shouldIgnore ( $name ) : bool

Determine if the given property / method should be ignored.

Parameters

  • $name string
protected

ignoredMethods ( ) : array

Get the methods that should be ignored.

public

withName ( $name ) : $this

Set the component alias name.

Parameters

  • $name string
public

withAttributes ( array $attributes ) : $this

Set the extra attributes that the component should make available.

Parameters

  • $attributes array
protected

newAttributeBag ( array $attributes ) : ComponentAttributeBag

Get a new attribute bag instance.

Parameters

  • $attributes array
public

shouldRender ( ) : bool

Determine if the component should be rendered.

public

view ( $view , $data , $mergeData ) : View

Get the evaluated view contents for the given view.

Parameters

  • $view string|null
  • $data Illuminate\...\Arrayable|array
  • $mergeData array
protected

factory ( ) : Factory

Get the view factory instance.

public static

flushCache ( ) : void

Flush the component's cached state.

public static

forgetFactory ( ) : void

Forget the component's factory instance.

public static

forgetComponentsResolver ( ) : void

Forget the component's resolver callback.

public static

resolveComponentsUsing ( $resolver ) : void

Set the callback that should be used to resolve components within views.

Parameters