Repeater Fields

Repeater fields allow you to create dynamic, repeatable content blocks within your templates.

Basic Usage

Create a repeatable feature list:

blade
@frankenRepeater('features', [
    'label' => 'Features',
    'schema' => [
        ['name' => 'icon', 'type' => 'text', 'label' => 'Icon'],
        ['name' => 'title', 'type' => 'text', 'label' => 'Title'],
        ['name' => 'description', 'type' => 'textarea', 'label' => 'Description'],
    ],
    'min' => 1,
    'max' => 6,
])
    <div class="feature-card">
        <span class="icon">{{ $franken->icon }}</span>
        <h3>{{ $franken->title }}</h3>
        <p>{{ $franken->description }}</p>
    </div>
@endFrankenRepeater

Repeater Options

Option Type Description
label string Label shown in admin
schema array Array of field definitions
min int Minimum number of items
max int Maximum number of items
collapsed bool Start items collapsed
reorderable bool Allow drag-and-drop reordering

Schema Field Types

The schema array supports these field types:

php
'schema' => [
    ['name' => 'title', 'type' => 'text'],
    ['name' => 'description', 'type' => 'textarea'],
    ['name' => 'content', 'type' => 'richEditor'],
    ['name' => 'image', 'type' => 'image'],
    ['name' => 'link', 'type' => 'url'],
    ['name' => 'enabled', 'type' => 'toggle'],
    ['name' => 'style', 'type' => 'select', 'options' => [
        'light' => 'Light',
        'dark' => 'Dark',
    ]],
]

Accessing Repeater Data

Inside the Repeater

Use the $franken variable inside the repeater block:

blade
@frankenRepeater('team', [...])
    <div class="team-member">
        <img src="{{ $franken->photo }}" alt="{{ $franken->name }}">
        <h3>{{ $franken->name }}</h3>
        <p>{{ $franken->role }}</p>
    </div>
@endFrankenRepeater

Outside the Repeater

Access repeater data as an array:

blade
@php
    $features = frankenField('features');
@endphp

@foreach($features as $feature)
    <div>{{ $feature['title'] }}</div>
@endforeach

Nested Repeaters

Repeaters can be nested for complex data structures:

blade
@frankenRepeater('sections', [
    'schema' => [
        ['name' => 'title', 'type' => 'text'],
        ['name' => 'items', 'type' => 'repeater', 'schema' => [
            ['name' => 'name', 'type' => 'text'],
            ['name' => 'value', 'type' => 'text'],
        ]],
    ],
])
    <section>
        <h2>{{ $franken->title }}</h2>
        @foreach($franken->items as $item)
            <div>{{ $item['name'] }}: {{ $item['value'] }}</div>
        @endforeach
    </section>
@endFrankenRepeater

Real-World Examples

Testimonials

blade
@frankenRepeater('testimonials', [
    'label' => 'Testimonials',
    'schema' => [
        ['name' => 'quote', 'type' => 'textarea', 'label' => 'Quote'],
        ['name' => 'author', 'type' => 'text', 'label' => 'Author Name'],
        ['name' => 'role', 'type' => 'text', 'label' => 'Author Role'],
        ['name' => 'avatar', 'type' => 'image', 'label' => 'Avatar'],
    ],
    'min' => 1,
    'max' => 10,
])
    <blockquote class="testimonial">
        <p>"{{ $franken->quote }}"</p>
        <footer>
            <img src="{{ $franken->avatar }}" alt="{{ $franken->author }}">
            <cite>{{ $franken->author }}, {{ $franken->role }}</cite>
        </footer>
    </blockquote>
@endFrankenRepeater

Next Steps