diff --git a/src/Services/Helper.php b/src/Services/Helper.php index 777a741..7875b8a 100644 --- a/src/Services/Helper.php +++ b/src/Services/Helper.php @@ -3,6 +3,7 @@ namespace Noxo\FilamentActivityLog\Services; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\Relation; use Noxo\FilamentActivityLog\Loggers\Logger; use Noxo\FilamentActivityLog\Loggers\Loggers; use UnitEnum; @@ -31,6 +32,10 @@ public static function resolveLogger(null | string | Model $record, bool $force $name = is_string($record) ? $record : get_class($record); + $name = is_string($record) + ? (Relation::getMorphedModel($record) ?: $record) + : get_class($record); + return Loggers::getLoggerByModel($name, $force); }