trait ManagesFragments (View source)

Properties

protected array $fragments

All of the captured, rendered fragments.

protected array $fragmentStack

The stack of in-progress fragment renders.

Methods

void
startFragment(string $fragment)

Start injecting content into a fragment.

string
stopFragment()

Stop injecting content into a fragment.

mixed
getFragment(string $name, string|null $default = null)

Get the contents of a fragment.

array
getFragments()

Get the entire array of rendered fragments.

void
flushFragments()

Flush all of the fragments.

Details

void startFragment(string $fragment)

Start injecting content into a fragment.

Parameters

string $fragment

Return Value

void

string stopFragment()

Stop injecting content into a fragment.

Return Value

string

Exceptions

InvalidArgumentException

mixed getFragment(string $name, string|null $default = null)

Get the contents of a fragment.

Parameters

string $name
string|null $default

Return Value

mixed

array getFragments()

Get the entire array of rendered fragments.

Return Value

array

void flushFragments()

Flush all of the fragments.

Return Value

void

Laravel Cloud is the best place to deploy Laravel, Nuxt, Express, Hono, Node.js, Bun, Go, Flask, Python, and more, with dedicated infrastructure available on AWS through Laravel Private Cloud.