0
I’m following the documentation of the site: https://docs.spatie.be/laravel-activitylog/v2/basic-usage/logging-activity, but I’m not able to implement the option below:
Setting a 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`;
The performedOn-function has a shorter alias name: on
When I try to pass the parameters in the controller it generates error in performedOn($someContentModel)
, would like to know what should I use instead of the $someContentModel variable.
It worked, I was passing the parameter ::all() so it didn’t work. Thanks friend!
– Rafael Meirim
Not to impose, but do you know how you use the -> Using the Causesactivity trait documentation? I’m not able to implement it, I believe it serves to monitor what each user did in the log system, it would be very useful.
– Rafael Meirim
You call l Trait inside your MODEL it gives the example here https://docs.spatie.be/laravel-activitylog/v2/advanced-usage/logging-model-events#ignoring-Attributes-from-logging
– Lucas Macedo