W3cubDocs

/Laravel 5.8

ManagesEvents

trait ManagesEvents (View source)

Methods

array creator(array|string $views, Closure|string $callback)

Register a view creator event.

array composers(array $composers)

Register multiple view composers via an array.

array composer(array|string $views, Closure|string $callback)

Register a view composer event.

Closure|null addViewEvent(string $view, Closure|string $callback, string $prefix = 'composing: ')

Add an event for a given view.

Closure addClassEvent(string $view, string $class, string $prefix)

Register a class based view composer.

Closure buildClassEventCallback(string $class, string $prefix)

Build a class based container callback Closure.

array parseClassEvent(string $class, string $prefix)

Parse a class based composer name.

string classEventMethodForPrefix(string $prefix)

Determine the class event method based on the given prefix.

void addEventListener(string $name, Closure $callback)

Add a listener to the event dispatcher.

void callComposer(View $view)

Call the composer for a given view.

void callCreator(View $view)

Call the creator for a given view.

Details

array creator(array|string $views, Closure|string $callback)

Register a view creator event.

Parameters

array|string $views
Closure|string $callback

Return Value

array

array composers(array $composers)

Register multiple view composers via an array.

Parameters

array $composers

Return Value

array

array composer(array|string $views, Closure|string $callback)

Register a view composer event.

Parameters

array|string $views
Closure|string $callback

Return Value

array

protected Closure|null addViewEvent(string $view, Closure|string $callback, string $prefix = 'composing: ')

Add an event for a given view.

Parameters

string $view
Closure|string $callback
string $prefix

Return Value

Closure|null

protected Closure addClassEvent(string $view, string $class, string $prefix)

Register a class based view composer.

Parameters

string $view
string $class
string $prefix

Return Value

Closure

protected Closure buildClassEventCallback(string $class, string $prefix)

Build a class based container callback Closure.

Parameters

string $class
string $prefix

Return Value

Closure

protected array parseClassEvent(string $class, string $prefix)

Parse a class based composer name.

Parameters

string $class
string $prefix

Return Value

array

protected string classEventMethodForPrefix(string $prefix)

Determine the class event method based on the given prefix.

Parameters

string $prefix

Return Value

string

protected void addEventListener(string $name, Closure $callback)

Add a listener to the event dispatcher.

Parameters

string $name
Closure $callback

Return Value

void

void callComposer(View $view)

Call the composer for a given view.

Parameters

View $view

Return Value

void

void callCreator(View $view)

Call the creator for a given view.

Parameters

View $view

Return Value

void

© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/5.8/Illuminate/View/Concerns/ManagesEvents.html