Laravel-activitylog: Customizing the (login / logout) log name

Created on 18 May 2018  路  5Comments  路  Source: spatie/laravel-activitylog

Other question please,

How to customize the (login / logout) log name?
I alredy customized the user Model but still have 'default' when login/logout activity.

THanks

Most helpful comment

use ... activity( 'CustomName' )-> ... if you want to change 'default' to 'CustomName'

If you want to change default for all logs to another value, change it in the config/activitylog.php file, under 'default_log_name'. You must have published the config file for this, see https://docs.spatie.be/laravel-activitylog/v1/installation-and-setup#installation-and-setup

All 5 comments

Which login/logout (auth) event do you mean? So far I know there is no auth-event logging by default!?

Yes I mean auth event.
this is my code in AuthenticatesUsers.php

protected function authenticated(Request $request, $user) { activity() ->causedBy($user) ->performedOn($user) ->withProperties(['type' => 'info']) ->log('Connexion'); }
The log name stored in db is 'default'

use ... activity( 'CustomName' )-> ... if you want to change 'default' to 'CustomName'

If you want to change default for all logs to another value, change it in the config/activitylog.php file, under 'default_log_name'. You must have published the config file for this, see https://docs.spatie.be/laravel-activitylog/v1/installation-and-setup#installation-and-setup

Hello, I am having a project with Laravel 5.6 and I want to register the login and logout of the users but I do not know where to use activity ().

@peric0 Laravel fires off an event when a user logs in / out: https://laravel.com/api/5.6/Illuminate/Auth/Events/Login.html

You can listen for those events.

If you have more questions, please open up a new issue.

Was this page helpful?
0 / 5 - 0 ratings