You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please, I need some assistance here, not sure if this can be a defect.
I select my objects based on its owner, becase I have a 'multiple-user-shared' database, so it is a hasMany relationship.
Also, I'm using Ardent, so I'm including/using Revisionable as Traits.
When I run:
foreach (Auth::user()->db_owner()->coreusers as $coreuser)
{
echo " Changes for user: ".$coreuser->id." ";
foreach ($coreuser->revisionHistory as $history)
{
echo "
on ".date_format(date_create($history->created_at), "d-m-Y H:i:s")."
user ".$history->userResponsible()->morph->imodpessoa->nome_razao."
changed field ".$history->fieldName()."
from ".$history->oldValue()."
to ".$history->newValue()."
";
}
}
It does not work, returns an empty/null revisionHistory result.
Now, if I change foreach loop:
from -> foreach ($coreuser->revisionHistory as $history)
to -> foreach (CoreUser::find($coreuser->id)->revisionHistory as $history)
However, I can not change my Application and I need it to work with the first foreach loop, would someone know to confirm if this is a issue, or if maybe I'm doing something wrong?
I really appreciate any assistance.
Thank you very much,
Robson.
The text was updated successfully, but these errors were encountered:
Apologies for the delayed response, this package relies on working on an Eloquent based model, your loop looks like it's giving a simple object, not an Eloquent object.
Hello,
Please, I need some assistance here, not sure if this can be a defect.
I select my objects based on its owner, becase I have a 'multiple-user-shared' database, so it is a hasMany relationship.
Also, I'm using Ardent, so I'm including/using Revisionable as Traits.
When I run:
foreach (Auth::user()->db_owner()->coreusers as $coreuser)
{
echo "
Changes for user: ".$coreuser->id."
";
foreach ($coreuser->revisionHistory as $history)
{
echo "
on ".date_format(date_create($history->created_at), "d-m-Y H:i:s")."
user ".$history->userResponsible()->morph->imodpessoa->nome_razao."
changed field ".$history->fieldName()."
from ".$history->oldValue()."
to ".$history->newValue()."
}
}
It does not work, returns an empty/null revisionHistory result.
Now, if I change foreach loop:
from -> foreach ($coreuser->revisionHistory as $history)
to -> foreach (CoreUser::find($coreuser->id)->revisionHistory as $history)
However, I can not change my Application and I need it to work with the first foreach loop, would someone know to confirm if this is a issue, or if maybe I'm doing something wrong?
I really appreciate any assistance.
Thank you very much,
Robson.
The text was updated successfully, but these errors were encountered: