Skip to content

Move JSON API controller transactions to middleware #375

@lindyhopchris

Description

@lindyhopchris

In 1.x the JSON API controller wraps write operations in a transaction.

For 2.0, move this to an opt-in middleware, that takes the name of the connection and optionally the HTTP method names that it should apply to (which should default to POST, PATCH, DELETE if not provided).

Allow this to be added via fluent routing, e.g. $api->withTransactions()->routes(...).

The Eloquent adapter should always use a transaction, as it knows the connection etc for the transactions... so modify that adapter to always use transactions for write operations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions