Spatie Laravel-activitylog problem with relationship

190 Views Asked by At

I'm using Laravel 10 and Laravel-activitylog with PHP 8.1

I have a problem when I do $post->comments()->create([...]);, it doesn't create the activity log.

I need to do:

Comment::create([
 'post_id' => $post->id,
  ... 
]);

Exist a way to avoid it and start saving activity from relationship like BelongTo, ManyToMany, etc?

Thanks

0

There are 0 best solutions below