简体   繁体   中英

Revisionable presenters not working

First I find a ticket.

$tick = App\Tickets::find(14);

Then I find a revision for the same:

$rev = $tick->latestRevision;

But it gives me a error:

App\Presenters\Revisions\Tickets #0000000021ba4aef0000000179e23051 {}

When I see in database, the revisions table is updated with a revision.

And this is my Presenters code:

namespace App\Presenters\Revisions;

use Sofa\Revisionable\Laravel\Presenter;

class Tickets extends Presenter {

protected $passThrough = [
        'stage_id'        => 'stage.stage_name',

    ];
protected $actions = [
        'created'  => 'Created at',
        'updated'  => 'Updated at',
        'deleted'  => 'Deleted',
        'restored' => 'Restored',
    ];
}

So this is my relation from Tickets model.

public function stage() {
        return $this->hasOne('App\Stages');
    }

And I used stage.stage_name in passThrough, but still there is no result.

Also, when I do $revision->old('stage_id'); , I get null

I am using this package: https://github.com/jarektkaczyk/revisionable

That's not an error, that is the tinker output showing you your App\\Presenters\\Revisions\\Tickets object.

Do a $rev->getDiff() and it should work fine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM