F
Filament8mo ago
core

Modify Create Another Functions in a Modal Relationsmanager

I have a StepsRelationsManager, the step is incremented per title, it works fine when I use create . how do I add this functionality to create another button?
protected static string $relationship = 'steps';

public function form(Form $form): Form
{

return $form
->schema([
Forms\Components\TextInput::make('title')
->default(
Step::where('recipe_id', $this->ownerRecord->id)
->orderBy('id', 'desc')
->value('title')
)
->required()
->maxLength(255),
Forms\Components\TextInput::make('step_number')
->default(
Step::where('recipe_id', $this->ownerRecord->id)
->max('step_number') + 1
)
->numeric()
->required(),
protected static string $relationship = 'steps';

public function form(Form $form): Form
{

return $form
->schema([
Forms\Components\TextInput::make('title')
->default(
Step::where('recipe_id', $this->ownerRecord->id)
->orderBy('id', 'desc')
->value('title')
)
->required()
->maxLength(255),
Forms\Components\TextInput::make('step_number')
->default(
Step::where('recipe_id', $this->ownerRecord->id)
->max('step_number') + 1
)
->numeric()
->required(),
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server