FilamentF
Filament2y ago
1 reply
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(),
Was this page helpful?