Reputation: 4180
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
Upvotes: 0
Views: 387
Reputation: 62278
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.
Upvotes: 0