F
Filament9mo ago
Lim

How to save relationship first

I just want to know how to save the relationship first then get its ID to be save as foreign key
1 Reply
Lim
LimOP9mo ago
return $form
->schema([
Forms\Components\TextInput::make('integration_name') //this needs to be save last
->required()
->maxLength(100)
->columnSpanFull(),
Forms\Components\Fieldset::make('Shopify') //this needs to be save first
->relationship('tokens_shopify')
->schema([
Forms\Components\TextInput::make('url')
->label('URL')
->required()
->maxLength(255),
Forms\Components\TextInput::make('access_token')
->label('Access Token')
->required()
->maxLength(255),
Forms\Components\TextInput::make('api_key')
->label('API Key')
->required()
->maxLength(255),
Forms\Components\TextInput::make('api_secret')
->label('API Secret')
->required()
->maxLength(255),
])->columnSpan(1),

Forms\Components\Fieldset::make('eSuite') //this needs to be save first
->relationship('tokens_esuite')
->schema([
Forms\Components\TextInput::make('domain')
->required()
->maxLength(100),
Forms\Components\TextInput::make('database')
->required()
->maxLength(100),
Forms\Components\TextInput::make('password')
->required()
->maxLength(255),
])->columnSpan(1),
]);
}
return $form
->schema([
Forms\Components\TextInput::make('integration_name') //this needs to be save last
->required()
->maxLength(100)
->columnSpanFull(),
Forms\Components\Fieldset::make('Shopify') //this needs to be save first
->relationship('tokens_shopify')
->schema([
Forms\Components\TextInput::make('url')
->label('URL')
->required()
->maxLength(255),
Forms\Components\TextInput::make('access_token')
->label('Access Token')
->required()
->maxLength(255),
Forms\Components\TextInput::make('api_key')
->label('API Key')
->required()
->maxLength(255),
Forms\Components\TextInput::make('api_secret')
->label('API Secret')
->required()
->maxLength(255),
])->columnSpan(1),

Forms\Components\Fieldset::make('eSuite') //this needs to be save first
->relationship('tokens_esuite')
->schema([
Forms\Components\TextInput::make('domain')
->required()
->maxLength(100),
Forms\Components\TextInput::make('database')
->required()
->maxLength(100),
Forms\Components\TextInput::make('password')
->required()
->maxLength(255),
])->columnSpan(1),
]);
}
Want results from more Discord servers?
Add your server