dev-partners / laravel-nova-auditable-log

A Laravel Nova resource tool for visualizing the audit log created by the Laravel Auditing package.
51 stars 22 forks source link

bugfix - fix softdelete detection #19

Closed NickBelhomme closed 3 years ago

NickBelhomme commented 3 years ago

in version 1.0.9 you rely on class_uses method in \Devpartners\AuditableLog\Http\Controllers\AuditController::loadRecord

class_uses ( mixed $class , bool $autoload = true ) : array
This function returns an array with the names of the traits that the given class uses. This does however not include any traits used by a parent class.

however my models are extending a base model which uses the soft delete trait. But the actual model in itself does not... So this uses_class is not very good.

method_exists on WithTrashed will also not yield any results as that method is a magic method... but not magic in the sense of is_callable. So we have to make the assumption that when the method trashed() exists the withTrashed will also be there...

recycledbeans commented 3 years ago

@NickBelhomme this seems like a logical change. Thanks for contributing!