| Q | A
| ----------------- | ---
| Bug? | yes
| New Feature? | no
| Framework | Laravel
| Framework version | 5.5
| Package version | 5.0.0
| PHP version | 7.1
When editing a model, all audits are correctly getting saved in the database, however I am unable to retrieve any audits back using the relation from the model (public function audits(): MorphMany on the Auditable trait I believe?). The result that is returned is always an empty array.
I would expect when getting all associated audits it would return one or more results.
Setup according to latest documentation on the website. The only non-standard configuration is the use of MongoDB using the MongoAudit implementation.
I am unsure how to debug an issue with morphMany.
Hi @sptdigital, I'll try to reproduce the issue locally, at some point this week.
I am also getting this behavior, the audit record is saved in the database but Model ->audits is always null. Laravel 5.5
Sorry @paulocr, I haven't had the time yet to try to reproduce this issue.
Can you tell me what are the auditable_id and auditable_type values that get saved for each of the Audit records? Are they null ?
I'll ask you the same question, @sptdigital. Can you confirm if the auditable_* column values are null ?
Time is scarce and I don't use MongoDB, so I haven't had the time to properly test this, yet.
Can I see the models/configuration you're using?
@quetzyg I will reproduce this again today and provide this information
@sptdigital, @paulocr can any of you give any update on the issue?
Hi @quetzyg I checked again today and could not reproduce so there might have been something in my original setup causing the issue. I do see the information in the DB and also in the audits relation.
Thanks for checking again @paulocr. Glad all is fine now.
@sptdigital, now it's up to you mate. If you're still having this issue, let me know and try to include more information so I can try to understand what exactly is happening.
I'll keep this ticket open a few more days, but I'll be closing it if no more information is provided.
It appears to be working fine now when using a different Eloquent model, so it might be an issue with the way I have added the traits in the other model. Thanks for your time on this.
No problem mate, glad all is working fine.
I work with mysql, i can save audit in mongo? When try i had the MOngoDB\Driver\Manager not found because my models extends the eloquent default