In the checked package, you can get the identifiable name of the associated model by defining the identifiableName() method on the model, setting the display field instead of I would. For instance. 'name' or 'title'.
Is it possible to do this with an unrelated model. So say that I have all versions for a specific model. For instance.
$revisions = Venturecraft\Revisionable\Revision::where('revisionable_type', 'post')->get();
How can I get the identifiableName for the post for which each revision was done?
I can already get the message identifier with $revision->revisionable_id , but I cannot find a way to get the message name without something like Post::find($revision->revisionable_id)->name , which is expensive for a large list of fixes.
source share