File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,23 @@ You can keep track of a lock version during a business transaction by informing
4949``` html
5050<input type =" hidden" name =" lock_version" value =" {{$blogPost->lock_version}}"
5151```
52-
52+ and in controller:
53+ ```php
54+ <?php
55+
56+ // Explicitly setting the lock version
57+ class PostController {
58+ public function update($id)
59+ {
60+ $post = Post::findOrFail($id);
61+ $post- >lock_version = request('lock_version');
62+ $post->save();
63+ // You can also define more implicit reusable methods in your model like Model::saveWithVersion(...$args);
64+ // or just override the default Model::save(...$args); method which accepts $options
65+ // Then automatically read the lock version from Request and set into the model.
66+ }
67+ }
68+ ```
5369
5470So if two authors are editing the same content concurrently,
5571you can keep track of your ** Read State** , and ask the second
You can’t perform that action at this time.
0 commit comments