Содержит все Базовые методы.
Поле Fieldset позволяет группировать поля при отображении в предварительном просмотре, а в форме оборачивает в HTML тег fieldset.
make(
string|Closure|null $label = null,
iterable|Closure|FieldsContract $fields = []
)
make(
string|Closure|null $label = null,
iterable|Closure|FieldsContract $fields = []
)
make(
string|Closure|null $label = null,
iterable|Closure|FieldsContract $fields = []
)
make(
string|Closure|null $label = null,
iterable|Closure|FieldsContract $fields = []
)
make(
string|Closure|null $label = null,
iterable|Closure|FieldsContract $fields = []
)
$label - заголовок,
$fields - поля для группировки.
Так же, поля для группировки можно указать с помощью метода fields().
use MoonShine\UI\Fields\Fieldset;
use MoonShine\UI\Fields\Slug;
use MoonShine\UI\Fields\Text;
Fieldset::make('Title', [
Text::make('Title'),
Slug::make('Slug'),
]),
Fieldset::make()
->fields([
Text::make('Title'),
Slug::make('Slug'),
]),
namespaces
use MoonShine\UI\Fields\Fieldset;
use MoonShine\UI\Fields\Slug;
use MoonShine\UI\Fields\Text;
Fieldset::make('Title', [
Text::make('Title'),
Slug::make('Slug'),
]),
Fieldset::make()
->fields([
Text::make('Title'),
Slug::make('Slug'),
]),
use MoonShine\UI\Fields\Fieldset;
use MoonShine\UI\Fields\Slug;
use MoonShine\UI\Fields\Text;
Fieldset::make('Title', [
Text::make('Title'),
Slug::make('Slug'),
]),
Fieldset::make()
->fields([
Text::make('Title'),
Slug::make('Slug'),
]),
namespaces
use MoonShine\UI\Fields\Fieldset;
use MoonShine\UI\Fields\Slug;
use MoonShine\UI\Fields\Text;
Fieldset::make('Title', [
Text::make('Title'),
Slug::make('Slug'),
]),
Fieldset::make()
->fields([
Text::make('Title'),
Slug::make('Slug'),
]),
use MoonShine\UI\Fields\Fieldset;
use MoonShine\UI\Fields\Slug;
use MoonShine\UI\Fields\Text;
Fieldset::make('Title', [
Text::make('Title'),
Slug::make('Slug'),
]),
Fieldset::make()
->fields([
Text::make('Title'),
Slug::make('Slug'),
]),
Вы можете кастомизировать отображение для Fieldset с помощью компонентов.
Fieldset::make('Title', [
Text::make('Title'),
LineBreak::make(),
Slug::make('Slug'),
])
Fieldset::make('Title', [
Text::make('Title'),
LineBreak::make(),
Slug::make('Slug'),
])
Fieldset::make('Title', [
Text::make('Title'),
LineBreak::make(),
Slug::make('Slug'),
])
Fieldset::make('Title', [
Text::make('Title'),
LineBreak::make(),
Slug::make('Slug'),
])
Fieldset::make('Title', [
Text::make('Title'),
LineBreak::make(),
Slug::make('Slug'),
])
Чтобы при определенных условия изменялся набор компонентов у Fieldset, необходимо передать условие и наборы компонентов с помощью callback функции.
Fieldset::make('Stack', fn(Fieldset $ctx) => $ctx->getData()?->getOriginal()->id === 3 ? [
Date::make('Creation date', 'created_at'),
] : [
Date::make('Creation date', 'created_at'),
LineBreak::make(),
Email::make('Email', 'email'),
]
)
Fieldset::make('Stack', fn(Fieldset $ctx) => $ctx->getData()?->getOriginal()->id === 3 ? [
Date::make('Creation date', 'created_at'),
] : [
Date::make('Creation date', 'created_at'),
LineBreak::make(),
Email::make('Email', 'email'),
]
)
Fieldset::make('Stack', fn(Fieldset $ctx) => $ctx->getData()?->getOriginal()->id === 3 ? [
Date::make('Creation date', 'created_at'),
] : [
Date::make('Creation date', 'created_at'),
LineBreak::make(),
Email::make('Email', 'email'),
]
)
Fieldset::make('Stack', fn(Fieldset $ctx) => $ctx->getData()?->getOriginal()->id === 3 ? [
Date::make('Creation date', 'created_at'),
] : [
Date::make('Creation date', 'created_at'),
LineBreak::make(),
Email::make('Email', 'email'),
]
)
Fieldset::make('Stack', fn(Fieldset $ctx) => $ctx->getData()?->getOriginal()->id === 3 ? [
Date::make('Creation date', 'created_at'),
] : [
Date::make('Creation date', 'created_at'),
LineBreak::make(),
Email::make('Email', 'email'),
]
)