spatie / laravel-activitylog

Log activity inside your Laravel app

Home Page:https://docs.spatie.be/laravel-activitylog

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Logs not populated when running db:seed

DiarQoroviqi opened this issue · comments

Describe the bug
When running the db:seed command from terminal it does not save the logs, it only save the logs when running a seed for a specific seeder.

To Reproduce
I have a model that already uses the trait LogsActivity;

class ContentEntry extends Model
{
	use HasFactory;
	use SoftDeletes;
	use LogsActivity;

    public function getActivitylogOptions(): LogOptions
	{
		return LogOptions::defaults()
			->logAll()
			->logOnlyDirty()
			->dontSubmitEmptyLogs();
	}
}

and a seeder for it ContentEntrySeeder. So when running directly the seeder php artisan db:seed --class=ContentEntrySeeder it works fine and adds the logs, but when running only db:seed(there a other seeders) without specifying the --class it do not add logs for ContentEntry model

Versions (please complete the following information)

  • PHP: 8.1
  • Database: Mysql
  • Laravel: 10
  • Package:
commented

Hi, @DiarQoroviqi ,

I tried to reproduce the issue with steps mentioned and some simple data but I was not able to reproduce it.

May be you can help me to reproduce it by sharing your use case data.

Following are my system technical specifications:

php => 8.1.18
laravel => 10.10
spatie/laravel-activitylog => "^4.7"

Following is my code, let me know if I am missing anything or may be you can create a repository for demonstrating the issue.

Model

image

Seeder

image
image

Running Seeder

image

DB entries

image

Dear contributor,

because this issue seems to be inactive for quite some time now, I've automatically closed it. If you feel this issue deserves some attention from my human colleagues feel free to reopen it.