Prevents update conflicts in Laravel
Prevents update conflicts using the optimistic lock pattern in Laravel
This package can work independently of the Enso ecosystem.
For live examples and demos, you may visit laravel-enso.com
composer require laravel-enso/versioning
Versionable
trait on the models you want versioning on.By default, the version value is kept in a 'version' attribute, but this can be customized (see below).
versionings
table where it holds versions for all the versionable modelsVersionable
trait on a model, versioning is handled automaticallyversion
attribute after the model is retrieved, used for tracking versions and expects the same attribute to be present on the model when the update is calledprotected $versioningAttribute = 'customVersionAttribte'
on the modelSoftDeletes
, the versioning is not deleted, unless doing a forceDelete
ConflictHttpException
if the version does not match on updateBe sure to check out the full documentation for this package available at docs.laravel-enso.com
are welcome. Pull requests are great, but issues are good too.
This package is released under the MIT license.