Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Defect with revisionHistory ? #55

Closed
robsoncombr opened this issue Apr 11, 2014 · 1 comment
Closed

Defect with revisionHistory ? #55

robsoncombr opened this issue Apr 11, 2014 · 1 comment

Comments

@robsoncombr
Copy link

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.

    @duellsy
    Copy link
    Member

    duellsy commented May 18, 2014

    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.

    @duellsy duellsy closed this as completed May 18, 2014
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    None yet
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants