diff --git a/src/HasIdentifier.php b/src/HasIdentifier.php index 7e13ea3..3521726 100644 --- a/src/HasIdentifier.php +++ b/src/HasIdentifier.php @@ -46,7 +46,7 @@ public static function getIdByIdentifier(string $identifier): mixed { static::getModelByIdentifier($identifier, ['id']); - return optional(static::$fetchedIdentifiers[static::class][$identifier])->id; + return optional(static::$fetchedIdentifiers[static::class][$identifier] ?? null)->id; } public static function checkIdentifier(mixed $id, string $identifier): bool