0

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

nirvair
  • 4,001
  • 10
  • 51
  • 85

1 Answers1

0

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.

patricus
  • 59,488
  • 15
  • 143
  • 145
  • I am getting `null` when I output this: `$revision->old('stage_id'); => null` – nirvair Jun 06 '15 at 11:25
  • @phantomphoenix I would assume that would be the case if your stage has never changed from the first time it was set, or if the stage related to the old stage_id isn't found. – patricus Jun 06 '15 at 19:05