Skip to content

Lte3 facade

Fomvasss\Lte3\Facades\Lte, registered under the alias Lte3, so Blade views use Lte3::... without an import. In PHP:

use Fomvasss\Lte3\Facades\Lte as Lte3;

The facade resolves Fomvasss\Lte3\Lte, bound as a scoped singleton (one instance per request, reset between Octane requests and queue jobs).

Lte3::<component>(...$vars): string

Any key of view.components in the config is a method: Lte3::text(), Lte3::select2(), Lte3::mediaImage(), your own components. The arguments are the vars of the component in order; the last one is $attrs. An unknown name throws Exception("Lte3 method or component '<name>' not found!"). See Fields overview.

MethodReturnsDescription
field(array $params, array $params2 = [])stringRenders the component $params['type'] (default text) from an array. Forms
formOpen(array $attrs = [])stringOpens a form and binds $attrs['model']. form
formClose()string</form>, unbinds the model
formHiddenUsing(?callable $resolver)voidStatic. Extra hidden fields for every non-GET form; null removes the resolver. Forms
formHiddenFields($model = null, array $attrs = [])arrayThe fields the resolver returns for a form, without null and '' values
pagination($paginator)stringPagination links with the current query except page. Layout
user(?string $column = null)mixedThe authenticated user, one of its attributes, or null
backUrl(?string $key = null)string_back from the request or the session, else the session value under $key, else ''. Back URL
getValueAttribute($name, $value = null, $default = null)mixedThe value a field with this name would show: old(), request, $value, bound model, $default. Forms

getValueAttribute() is useful in your own component views:

@php($value = Lte3::getValueAttribute($name, $value ?? null))

A view registered in view.components receives:

VariableDescription
each name from varsthe positional arguments of the call ($name, $value, $options, …)
$attrsthe attributes: config default merged with the call attributes, false / null values of field_attrs removed
$modelthe model argument if the component has it in vars (like mediaFile), else the model of the open form
$field_attrsthe view.field_attrs list — print Arr::only($attrs, $field_attrs) as HTML attributes

If the component has both name and value in vars, $value is already resolved by getValueAttribute() and passed through formatter.