Repeater: Get current form id
I have this task table where fields are
I added Repeater on my $form , my goal is I want create sub task, which is determine by
How to get the
idid, titletitle, descriptiondescription, creator_idcreator_id, due_datedue_date, parent_idparent_id, typetypeI added Repeater on my $form , my goal is I want create sub task, which is determine by
typetype and also under what main task parent_idparent_id.How to get the
idid and assign it as default on my TextInput::make('parent_id')TextInput::make('parent_id')return $form
->schema([
TextInput::make('title')
->required()
->autofocus(),
Forms\Components\MultiSelect::make('user_id')
->label('Assigned to')
->relationship('assignees','user_id')
->multiple()
->options(User::pluck('name','id')->toArray()),
DatePicker::make('due_date')
->label('Due Date')
->minDate(now()),
TextInput::make('creator_name')
->label('Created by')
->default(auth()->user()->name)
->disabled()
->hint('Creator: '.auth()->user()->name)
->hintIcon('tabler-info-circle'),
TextInput::make('creator_id')
->default(auth()->user()->id)
->hidden(),
Textarea::make('description')->required(),
Forms\Components\Repeater::make('subtask')
->schema([
TextInput::make('title')->required(),
Textarea::make('description')->required(),
TextInput::make('parent_id')
->default() // this id of the task
->hidden(),
])
->createItemButtonLabel('Add subtask')
->collapsed()
]);return $form
->schema([
TextInput::make('title')
->required()
->autofocus(),
Forms\Components\MultiSelect::make('user_id')
->label('Assigned to')
->relationship('assignees','user_id')
->multiple()
->options(User::pluck('name','id')->toArray()),
DatePicker::make('due_date')
->label('Due Date')
->minDate(now()),
TextInput::make('creator_name')
->label('Created by')
->default(auth()->user()->name)
->disabled()
->hint('Creator: '.auth()->user()->name)
->hintIcon('tabler-info-circle'),
TextInput::make('creator_id')
->default(auth()->user()->id)
->hidden(),
Textarea::make('description')->required(),
Forms\Components\Repeater::make('subtask')
->schema([
TextInput::make('title')->required(),
Textarea::make('description')->required(),
TextInput::make('parent_id')
->default() // this id of the task
->hidden(),
])
->createItemButtonLabel('Add subtask')
->collapsed()
]);