Decoration Fragment

# Make

Sometimes you need to return only part of a template in your HTTP response. For this you can use Blade Fragments .
The Fragment decorator allows you to create corresponding blocks.

You can create a Fragment using the static make() method.

make(array $fields = [])

Method name() sets the name for the fragment.

use MoonShine\Decorations\Fragment;
use MoonShine\Fields\Text;
public function components(): array
return [
Text::make('Name', 'first_name')

# Asynchronous event

You can incorporate an area in a Fragment and set an event on this area, by calling which it will be possible to update the fragment


And as an example, let's call an event for successful submission of the form

FormBuilder::make()->async(asyncEvents: 'fragment-updated-fragment-name')

You can also pass additional parameters with the request via an array

->updateAsync(['resourceItem' => request('resourceItem')]),