Reputation: 618
I checked the revisions table in the database and their are revision records for the record I'm trying to show the history for.
$record->revisionHistory returns an empty array though.
The same code for other models works fine, it is really strange.
This model code works:
namespace App\Models\Slack;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes as SoftDeletes;
class Channel extends Model
{
use SoftDeletes;
use \Venturecraft\Revisionable\RevisionableTrait;
protected $revisionEnabled = true;
protected $revisionCleanup = true;
protected $historyLimit = 10;
protected $revisionCreationsEnabled = true;
This controller code for the above model works:
$channel = Channel::find($id);
return $channel->revisionHistory;
This model code doesn't work (but there are records in the database):
namespace App\Models\Organization;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes as SoftDeletes;
class Organization extends Model
{
use SoftDeletes;
use \Venturecraft\Revisionable\RevisionableTrait;
protected $revisionEnabled = true;
protected $revisionCleanup = true;
protected $historyLimit = 10;
protected $revisionCreationsEnabled = true;
This controller code for the model above display an empty array ([]):
$organization = Organization::find($id);
return $organization->revisionHistory;
Upvotes: 0
Views: 261
Reputation: 618
I have a morphMap setup in my AppServiceProvider boot method that is firing when revisionable calls for the record so this is why nothing is being returned. I am going to close this and open a new question that is more relevant.
Upvotes: 0