Need to add some detail with the user_agent in audit table, sometime need to reduce the length of user_agent. How to configure or override it.
using - owen-it/laravel-auditing
Override the class OwenIt\Auditing\Resolvers\UserAgentResolver
,
audit.php
'resolver' => [
...
'user_agent' => App\Resolvers\UserAgentResolver::class,
...
],
App\Resolvers\UserAgentResolver.php
class UserAgentResolver implements \OwenIt\Auditing\Contracts\UserAgentResolver
{
/**
* {@inheritdoc}
*/
public static function resolve()
{
return 'Prefix-'.substr(
Request::header('User-Agent'), 0, 50
).'-Suffix';
}
}