Heddy
Heddy
TCTwill CMS
Created by Heddy on 2/5/2025 in #👊support
Repeater not shown in admin
Hi, I followed this tutorial: https://twillcms.com/guides/json-repeaters.html#content-updating-the-migration But in the Admin-Area the Repeater-Block is not shown... I don't know what is wrong with my code.
// FormController.php
<?php

namespace ClickfoodBasicCms\Twill\Capsules\Forms\Http\Controllers;

use A17\Twill\Models\Contracts\TwillModelContract;
use A17\Twill\Services\Listings\Columns\Text;
use A17\Twill\Services\Listings\TableColumns;
use A17\Twill\Services\Forms\Fields\Input;
use A17\Twill\Services\Forms\Form;
use A17\Twill\Http\Controllers\Admin\ModuleController as BaseModuleController;
use A17\Twill\Services\Forms\Fields\Repeater;

class FormController extends BaseModuleController
{
// .....
public function getForm(TwillModelContract $model): Form
{
$form = parent::getForm($model);

$form->add(
Input::make()->name('description')->label('Description')->translatable()
)->add(
Repeater::make()->type('fields'),
);

return $form;
}

// ...
}
// FormController.php
<?php

namespace ClickfoodBasicCms\Twill\Capsules\Forms\Http\Controllers;

use A17\Twill\Models\Contracts\TwillModelContract;
use A17\Twill\Services\Listings\Columns\Text;
use A17\Twill\Services\Listings\TableColumns;
use A17\Twill\Services\Forms\Fields\Input;
use A17\Twill\Services\Forms\Form;
use A17\Twill\Http\Controllers\Admin\ModuleController as BaseModuleController;
use A17\Twill\Services\Forms\Fields\Repeater;

class FormController extends BaseModuleController
{
// .....
public function getForm(TwillModelContract $model): Form
{
$form = parent::getForm($model);

$form->add(
Input::make()->name('description')->label('Description')->translatable()
)->add(
Repeater::make()->type('fields'),
);

return $form;
}

// ...
}
// resources/views/admin/repeaters/fields.blade.php
@twillRepeaterTitle('Field')
@twillRepeaterTrigger('Add field')
@twillRepeaterGroup('app')

@formField('input', [
'name' => 'label',
'label' => 'Label',
'required' => true,
])

@formField('input', [
'name' => 'handle',
'label' => 'Handle',
'required' => true,
])

@formField('select', [
'name' => 'type',
'label' => 'Type',
'required' => true,
'options' => [
[
'value' => 'text',
'label' => 'Text'
], [
'value' => 'number',
'label' => 'Number'
], [
'value' => 'email',
'label' => 'Email'
]
]
])

@formField('checkbox', [
'name' => 'required',
'label' => 'Required'
])
// resources/views/admin/repeaters/fields.blade.php
@twillRepeaterTitle('Field')
@twillRepeaterTrigger('Add field')
@twillRepeaterGroup('app')

@formField('input', [
'name' => 'label',
'label' => 'Label',
'required' => true,
])

@formField('input', [
'name' => 'handle',
'label' => 'Handle',
'required' => true,
])

@formField('select', [
'name' => 'type',
'label' => 'Type',
'required' => true,
'options' => [
[
'value' => 'text',
'label' => 'Text'
], [
'value' => 'number',
'label' => 'Number'
], [
'value' => 'email',
'label' => 'Email'
]
]
])

@formField('checkbox', [
'name' => 'required',
'label' => 'Required'
])
1 replies