There is no option to set default connection in Logging model event while i am using multi-database
in setting it model __construct.
Kindly tell me how to define default connection from model or from session

Hey,
the package comes with a config value for the activity database connection.
https://github.com/spatie/laravel-activitylog/blob/469e78d6dd38baa7ef3a602f238f979afe2a4000/config/activitylog.php#L51
It's set in the activity model during construct. So you can update the config value on runtime, for example via middleware, and all activities created/retrieved from this point will use the configured connection.
https://github.com/spatie/laravel-activitylog/blob/469e78d6dd38baa7ef3a602f238f979afe2a4000/src/Models/Activity.php#L22-L24
Yes its working in middlware. Thanks
config(['activitylog.database_connection' => 'mysql2']);
Most helpful comment
Hey,
the package comes with a config value for the activity database connection.
https://github.com/spatie/laravel-activitylog/blob/469e78d6dd38baa7ef3a602f238f979afe2a4000/config/activitylog.php#L51
It's set in the activity model during construct. So you can update the config value on runtime, for example via middleware, and all activities created/retrieved from this point will use the configured connection.
https://github.com/spatie/laravel-activitylog/blob/469e78d6dd38baa7ef3a602f238f979afe2a4000/src/Models/Activity.php#L22-L24