Laravel-Backpack / revise-operation

An admin interface for venturecraft/revisionable - audit log for your Eloquent entries.
Other
42 stars 10 forks source link

MethodCrudPanel::listRevisions does not exist #2

Closed robertotcestari closed 4 years ago

robertotcestari commented 4 years ago

Just updated from 4.0 to 4.1. When I try to restore a previous revision, the ajax response comes with error and shows that this method does not exist.

The line that is getting error is this one (in ReviseOperation.php)

$this->data['revisions'] = $this->crud->listRevisions($id)

Maybe this should be changed to $this->data['revisions'] = $this->listRevisions($id) ? Tried that too, but it then throws another error.

ghost commented 4 years ago

I've had the same problem. I've attached my error log. error.log

ghost commented 4 years ago

@tabacitu I'm starting to think this might be the wrong place to post this because there are no other issues and very little activity. Should we move this to the CRUD repo?

mariovillani commented 4 years ago

Same problem on my side too. Tried to change as @robertotcestari did, it fixes that error but another one is given:

Invalid argument supplied for foreach() (View: <mypath>/vendor/backpack/revise- 
operation/resources/views/revision_timeline.blade.php)

Seems like the $revisions object returned is not OK for the foreach loop (line 2 of revision_timeline.blade.php):

@foreach($revisions as $revisionDate => $dateRevisions)
    <h5 class="text-primary">
    {{ Carbon\Carbon::parse($revisionDate)->isoFormat(config('backpack.base.default_date_format')) }}
</h5>

@tabacitu

tabacitu commented 4 years ago

Thanks a lot @MarioVillani & @brannie19 for bumping this! Indeed since this is a very specific package it, with few installs, sometimes it gets less attention from us than CRUD - but that's not intentional. It's actually much easier to fix stuff specifically because everything's separated here. So it's the right place to post, definitely!

@robertotcestari - I didn't see this issue, must have slipped through the cracks, sorry for that. I can confirm the error happened in the background (in PHP) even though the Undo process actually completed. So you had to hit Refresh to actually see it - bad UX!

I've been able to replicate it and solve it. I've just pushed PR #3 that fixes this problem, and released it as v1.0.3, so a composer update backpack/revise-operation should fix it for you. Let me know if it doesn't and we'll reopen it.

Thanks a lot for bringing this to our attention, you guys. Had no idea it was happening. Cheers!

ghost commented 4 years ago

Short update: everything seems to be working again. Sorry for the late reply, and thank you for the quick fix!