class Head extends Component

Properties

protected array $except

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

from  Component
string|null $componentName

The component alias name.

from  Component
ComponentAttributeBag|null $attributes

The component attributes.

from  Component
static protected Factory|null $factory

The view factory instance, if any.

from  Component
static protected null|Closure(string, array): static $componentsResolver

The component resolver callback.

from  Component
static protected array<string, string> $bladeViewCache

The cache of blade view names, keyed by contents.

from  Component
static protected array $propertyCache

The cache of public property names, keyed by class.

from  Component
static protected array $methodCache

The cache of public method names, keyed by class.

from  Component
static protected array<class-string, array<int, string>> $constructorParametersCache

The cache of constructor parameters, keyed by class.

from  Component
static protected array $ignoredParameterNames

The cache of ignored parameter names.

from  Component
Response|null $response

Methods

render()

Render the component.

static Component
resolve(array $data)

Resolve the component instance with the given data.

static array
extractConstructorParameters()

Extract the constructor parameters for the component.

resolveView()

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

string
extractBladeViewFromString(string $contents)

Resolve and cache the Blade view for the given component string.

static string
bladeViewCacheKey(string $contents)

Get the cache key for the given Blade view contents.

string
createBladeViewFromString(Factory $factory, string $contents)

Create a Blade view with the raw component string content.

array
data()

Get the data that should be supplied to the view.

array
extractPublicProperties()

Extract the public properties for the component.

array
extractPublicMethods()

Extract the public methods for the component.

mixed
createVariableFromMethod(ReflectionMethod $method)

Create a callable variable from the given method.

createInvokableVariable(string $method)

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

bool
shouldIgnore(string $name)

Determine if the given property / method should be ignored.

array
ignoredMethods()

Get the methods that should be ignored.

withName(string $name)

Set the component alias name.

withAttributes(array $attributes)

Set the extra attributes that the component should make available.

newAttributeBag(array $attributes = [])

Get a new attribute bag instance.

bool
shouldRender()

Determine if the component should be rendered.

view(string|null $view, Arrayable|array $data = [], array $mergeData = [])

Get the evaluated view contents for the given view.

factory()

Get the view factory instance.

static array
ignoredParameterNames()

Get the cached set of anonymous component constructor parameter names to exclude.

static void
flushCache()

Flush the component's cached state.

static void
forgetBladeView(string $contents)

Forget the cached Blade view name for the given contents.

static void
forgetFactory()

Forget the component's factory instance.

static void
forgetComponentsResolver()

Forget the component's resolver callback.

static void
resolveComponentsUsing(Closure $resolver)

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

static void
flushState()

Flush all static state.

__construct()

Create a new Inertia head component.

Details

at line 26
View|Htmlable|Closure|string render()

Render the component.

Return Value

View|Htmlable|Closure|string

in Component at line 89
static Component resolve(array $data)

Resolve the component instance with the given data.

Parameters

array $data

Return Value

Component

in Component at line 111
static protected array extractConstructorParameters()

Extract the constructor parameters for the component.

Return Value

array

in Component at line 129
View|Htmlable|Closure|string resolveView()

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

Return Value

View|Htmlable|Closure|string

in Component at line 158
protected string extractBladeViewFromString(string $contents)

Resolve and cache the Blade view for the given component string.

Parameters

string $contents

Return Value

string

in Component at line 176
static protected string bladeViewCacheKey(string $contents)

Get the cache key for the given Blade view contents.

Parameters

string $contents

Return Value

string

in Component at line 184
protected string createBladeViewFromString(Factory $factory, string $contents)

Create a Blade view with the raw component string content.

Parameters

Factory $factory
string $contents

Return Value

string

in Component at line 204
array data()

Get the data that should be supplied to the view.

Return Value

array

in Component at line 214
protected array extractPublicProperties()

Extract the public properties for the component.

Return Value

array

in Component at line 239
protected array extractPublicMethods()

Extract the public methods for the component.

Return Value

array

in Component at line 263
protected mixed createVariableFromMethod(ReflectionMethod $method)

Create a callable variable from the given method.

Parameters

ReflectionMethod $method

Return Value

mixed

in Component at line 275
protected InvokableComponentVariable createInvokableVariable(string $method)

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

Parameters

string $method

Return Value

InvokableComponentVariable

in Component at line 285
protected bool shouldIgnore(string $name)

Determine if the given property / method should be ignored.

Parameters

string $name

Return Value

bool

in Component at line 294
protected array ignoredMethods()

Get the methods that should be ignored.

Return Value

array

in Component at line 320
Component withName(string $name)

Set the component alias name.

Parameters

string $name

Return Value

Component

in Component at line 332
Component withAttributes(array $attributes)

Set the extra attributes that the component should make available.

Parameters

array $attributes

Return Value

Component

in Component at line 344
protected ComponentAttributeBag newAttributeBag(array $attributes = [])

Get a new attribute bag instance.

Parameters

array $attributes

Return Value

ComponentAttributeBag

in Component at line 352
bool shouldRender()

Determine if the component should be rendered.

Return Value

bool

in Component at line 360
View view(string|null $view, Arrayable|array $data = [], array $mergeData = [])

Get the evaluated view contents for the given view.

Parameters

string|null $view
Arrayable|array $data
array $mergeData

Return Value

View

in Component at line 368
protected Factory factory()

Get the view factory instance.

Return Value

Factory

in Component at line 380
static array ignoredParameterNames()

Get the cached set of anonymous component constructor parameter names to exclude.

Return Value

array

in Component at line 406
static void flushCache()

Flush the component's cached state.

Clears the worker-wide reflection and view caches shared by every coroutine; next render rebuilds them. The view:clear command owns runtime invalidation.

Return Value

void

in Component at line 420
static void forgetBladeView(string $contents)

internal  
 

Forget the cached Blade view name for the given contents.

Parameters

string $contents

Return Value

void

in Component at line 431
static void forgetFactory()

Forget the component's factory instance.

Clears the worker-wide ViewFactory reference shared by every coroutine; next render re-resolves it from the container.

Return Value

void

in Component at line 445
static void forgetComponentsResolver()

internal  
 

Forget the component's resolver callback.

Clears the worker-wide resolver shared by every coroutine; next component resolution falls back to default behavior.

Return Value

void

in Component at line 461
static void resolveComponentsUsing(Closure $resolver)

internal  
 

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

The resolver persists in a static property for the worker lifetime and runs on every subsequent component resolution.

Parameters

Closure $resolver

Return Value

void

in Component at line 470
static void flushState()

Flush all static state.

Return Value

void

at line 18
__construct()

Create a new Inertia head component.