Skip to content

Question with how to do this on SPA apps #2

@denjaland

Description

@denjaland

Hi,

I was reading through the docs, and I see that for business transactions, you say that you can keep track of the lock version on the page.
But in your controller, I guess, you need to do the following?

class SomeController {
    public function update(Request $request, SomeModel $model) {

        // since $model is retrieved from the database, it will have the most recent lock...
        // am I right in thinking that we need to manually set the lock version here always?
        $model->lock_version = $request->get('lock_version');

        // This will then throw an exception when the lock version of the database differs from what I got from the $request
        $model->save();
    }
}

Is this correct, or is there a more intelligent way to pass this on?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions