Component
abstract class Component
Properties
| protected array | $except | The properties / methods that should not be exposed to the component. |
|
| string|null | $componentName | The component alias name. |
|
| ComponentAttributeBag|null | $attributes | The component attributes. |
|
| static protected Factory|null | $factory | The view factory instance, if any. |
|
| static protected null|Closure(string, array): static | $componentsResolver | The component resolver callback. |
|
| static protected array<string, string> | $bladeViewCache | The cache of blade view names, keyed by contents. |
|
| static protected array | $propertyCache | The cache of public property names, keyed by class. |
|
| static protected array | $methodCache | The cache of public method names, keyed by class. |
|
| static protected array<class-string, array<int, string>> | $constructorParametersCache | The cache of constructor parameters, keyed by class. |
|
| static protected array | $ignoredParameterNames | The cache of ignored parameter names. |
Methods
Extract the constructor parameters for the component.
Resolve the Blade view or view file that should be used when rendering the component.
Create a Blade view with the raw component string content.
Create a Blade view with the raw component string content.
Get the data that should be supplied to the view.
Extract the public properties for the component.
Extract the public methods for the component.
Create a callable variable from the given method.
Create an invokable, toStringable variable for the given component method.
Determine if the given property / method should be ignored.
Get the methods that should be ignored.
Set the extra attributes that the component should make available.
Get a new attribute bag instance.
Determine if the component should be rendered.
Get the cached set of anonymous component constructor parameter names to exclude.
Flush the component's cached state.
Forget the component's factory instance.
Forget the component's resolver callback.
Set the callback that should be used to resolve components within views.
Details
at line 79
abstract View|Htmlable|Closure|string
render()
Get the view / view contents that represent the component.
at line 84
static Component
resolve(array $data)
Resolve the component instance with the given data.
at line 106
static protected array
extractConstructorParameters()
Extract the constructor parameters for the component.
at line 124
View|Htmlable|Closure|string
resolveView()
Resolve the Blade view or view file that should be used when rendering the component.
at line 153
protected string
extractBladeViewFromString(string $contents)
Create a Blade view with the raw component string content.
at line 171
protected string
createBladeViewFromString(Factory $factory, string $contents)
Create a Blade view with the raw component string content.
at line 192
array
data()
Get the data that should be supplied to the view.
at line 202
protected array
extractPublicProperties()
Extract the public properties for the component.
at line 228
protected array
extractPublicMethods()
Extract the public methods for the component.
at line 252
protected mixed
createVariableFromMethod(ReflectionMethod $method)
Create a callable variable from the given method.
at line 262
protected InvokableComponentVariable
createInvokableVariable(string $method)
Create an invokable, toStringable variable for the given component method.
at line 272
protected bool
shouldIgnore(string $name)
Determine if the given property / method should be ignored.
at line 281
protected array
ignoredMethods()
Get the methods that should be ignored.
at line 302
Component
withName(string $name)
Set the component alias name.
at line 312
Component
withAttributes(array $attributes)
Set the extra attributes that the component should make available.
at line 324
protected ComponentAttributeBag
newAttributeBag(array $attributes = [])
Get a new attribute bag instance.
at line 332
bool
shouldRender()
Determine if the component should be rendered.
at line 340
View
view(string|null $view, Arrayable|array $data = [], array $mergeData = [])
Get the evaluated view contents for the given view.
at line 348
protected Factory
factory()
Get the view factory instance.
at line 360
static array
ignoredParameterNames()
Get the cached set of anonymous component constructor parameter names to exclude.
at line 385
static void
flushCache()
Flush the component's cached state.
Boot or tests only. Clears the worker-wide reflection and view caches shared by every coroutine; next render rebuilds them.
at line 399
static void
forgetFactory()
Forget the component's factory instance.
Boot or tests only. Clears the worker-wide ViewFactory reference shared by every coroutine; next render re-resolves it from the container.
at line 412
static void
forgetComponentsResolver()
| internal |
Forget the component's resolver callback.
Boot or tests only. Clears the worker-wide resolver shared by every coroutine; next component resolution falls back to default behavior.
at line 427
static void
resolveComponentsUsing(Closure $resolver)
| internal |
Set the callback that should be used to resolve components within views.
Boot-only. The resolver persists in a static property for the worker lifetime and runs on every subsequent component resolution.