Comments (8)
I found my answer. The reason was that getDirty() does not return changes in case of mass updates.
- Model::update([]) does not work
- $model->attribute = 'value'; $model->save(); works.
from revisionable.
looks like you still trying to do it manually together with the dirty method.
even the core only uses dirty:
$this->setKeysForSaveQuery($query)->update($dirty);
from revisionable.
Not sure where you're referring to?
The changedRevisionableFields()
method uses the getDirty() method, and checks that the updated item is indeed something that the owner wants tracked.
from revisionable.
i'm referring bough to beforesave and changedRevisionableFields()
where you use $this->originalData and $this->updatedData.
I think in beforesave maybe you can do only
$this->dirty = $this->getDirty();
from revisionable.
Sure, essentially I wanted to clean the data my way before calling getDirty()
, but it could just as easily only use the getDirty()
method and do a cleanup on the results of that to create the $this->dirty
value. Without wanting to be arrogant, I'm taking an 'if it aint broke, don't fix it' approach to this one.
If you want to make a pull request though, go for it and I'll merge it in.
from revisionable.
i'm taking the same approach for now =) maybe later if I have time Ill make
a pull request
2014-02-24 23:37 GMT+02:00 Chris Duell [email protected]:
Sure, essentially I wanted to clean the data my way before calling
getDirty(), but it could just as easily only use the getDirty() method
and do a cleanup on the results of that to create the $this->dirty value.
Without wanting to be arrogant, I'm taking an 'if it aint broke, don't fix
it' approach to this one.If you want to make a pull request though, go for it and I'll merge it in.
Reply to this email directly or view it on GitHubhttps://github.com//issues/8#issuecomment-35942182
.
from revisionable.
Cool. There's also just recently been quite a few updates to the whole section for #36
from revisionable.
@duellsy Hi,
While making update, getDirty returns empty in my case. Details are as follow;
- I am using trait in my model
- Updating the model using;
MyModel::whereId(1)->first()->update(['field' => 'value']). - This was not creating revisions. I digged into code and found that get $this->dirtyData = $this->getDirty(); return empty array.
Can you help about this issue.
Thanks.
from revisionable.
Related Issues (20)
- identifiableName() doesnt work with model User HOT 1
- additional fields not beeing stored when Storing Creations HOT 2
- Supporting multiple auth HOT 1
- Nothing happens when I try to save instance from `Comment` model HOT 2
- Explicitly providing `user_id` to Revisionable HOT 1
- Revisionable not creating revision entries for belongsToMany relationships HOT 1
- Revisionable is largely abandonware – look elsewhere HOT 3
- More documentation around identifiableName() HOT 2
- so i created this fuction to return 'meta', anyone knows how to access [key] => date_achat / i want to display only the arrays where key == date_achat
- DateTime object to json serialization
- The article link in Readme.md is not working
- use in tables without integer primary key
- New Feature: Save changed and append custom data HOT 3
- Laravel 10 Support
- Is it a part instead of the whole? HOT 1
- Consider storing only attributes that have been changed and only the diff values HOT 1
- Please allow table name to be configurable HOT 2
- Invalid foreign key for SoftDelete returns unknown instead of the original id HOT 1
- Display revisions in Laravel Nova HOT 2
- Encrypted values not decrypting on read
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from revisionable.