![]() The performedOn()-function has a shorter alias name: on() #Setting a causer You can specify on which object the activity is performed by using performedOn(): activity () -> performedOn ($someContentModel) -> log ( 'edited' ) $lastActivity = Activity :: all () -> last () //returns the last logged activity $lastActivity -> subject //returns the model that was passed to `performedOn` $lastActivity = Activity :: all () -> last () //returns the last logged activity $lastActivity -> description //returns 'Look mum, I logged something' #Setting a subject You can retrieve the activity using the Spatie\Activitylog\Models\Activity model. This is the most basic way to log activity: activity () -> log ( 'Look mum, I logged something' )
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |