HOW TO USE DB TRANSACTION
i have a wizard form in 3 steps each steps have a different relationship
i try dd() on last tab and save it but first step and second step saved into db
thx u dev
5 Replies
@anyone
did you find the solution of the transaction or a similar solution
For resource create take a look at https://filamentphp.com/docs/3.x/panels/resources/creating-records#using-a-wizard
For action model take a look at : https://filamentphp.com/docs/3.x/actions/modals#using-a-wizard-as-a-modal-form
class CreateSalesOrder extends CreateRecord
{
use HasWizard;
protected static string $resource = SalesOrderResource::class;
public function form(Form $form): Form
{
return parent::form($form)
->schema([
Wizard::make($this->getSteps())
->startOnStep($this->getStartStep())
->cancelAction($this->getCancelFormAction())
->submitAction($this->getSubmitFormAction())
->skippable($this->hasSkippableSteps())
->contained(false),
])
->columns(null);
}
/** @return Step[] */
protected function getSteps(): array
{
return [
Step::make('Order Details')
->schema([
Section::make()->schema(SalesOrderResource::getDetailsFormSchema())->columns(),
]),
Step::make('Order Items')
->schema([
Section::make()->schema([
SalesOrderResource::getItemsRepeater(),
]),
]),
];
} how to use tha transaction on here ?
ya bro