diff --git a/composer.json b/composer.json index d5aa03c..37d20ba 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,9 @@ "laravel/ui": "^4.6", "mpdf/mpdf": "^8.2", "phpoffice/phpword": "dev-master", + "pxlrbt/filament-activity-log": "^2.0", "ralphjsmit/laravel-filament-upload": "^1.1", + "spatie/laravel-activitylog": "^4.10", "spatie/laravel-medialibrary": "^11.17", "spatie/laravel-translatable": "^6.11", "stevebauman/location": "^7.6" diff --git a/composer.lock b/composer.lock index a36385e..1e0303f 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "28304e2033c8e05f63b010bb15ecec8e", + "content-hash": "a455f1fc2e2a48966554ea52ac362864", "packages": [ { "name": "abdulmajeed-jamaan/filament-translatable-tabs", @@ -6614,6 +6614,69 @@ }, "time": "2025-12-17T14:35:46+00:00" }, + { + "name": "pxlrbt/filament-activity-log", + "version": "v2.0.2", + "source": { + "type": "git", + "url": "https://github.com/pxlrbt/filament-activity-log.git", + "reference": "32f412b72b70d7ae61f54bd5e3df3ce18505505d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/pxlrbt/filament-activity-log/zipball/32f412b72b70d7ae61f54bd5e3df3ce18505505d", + "reference": "32f412b72b70d7ae61f54bd5e3df3ce18505505d", + "shasum": "" + }, + "require": { + "filament/filament": "^4.0", + "php": "^8.0", + "spatie/laravel-activitylog": "^4.7" + }, + "require-dev": { + "laravel/pint": "^1.5" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "\\pxlrbt\\FilamentActivityLog\\FilamentActivityLogServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "pxlrbt\\FilamentActivityLog\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Dennis Koch", + "email": "info@pixelarbeit.de" + } + ], + "description": "Spatie's Laravel Activity Log integrated into Filament", + "keywords": [ + "activity log", + "filament", + "laravel-filament" + ], + "support": { + "issues": "https://github.com/pxlrbt/filament-activity-log/issues", + "source": "https://github.com/pxlrbt/filament-activity-log/tree/v2.0.2" + }, + "funding": [ + { + "url": "https://github.com/pxlrbt", + "type": "github" + } + ], + "time": "2025-10-17T06:53:01+00:00" + }, { "name": "ralouphie/getallheaders", "version": "3.0.3", @@ -7358,6 +7421,97 @@ ], "time": "2024-05-17T09:06:10+00:00" }, + { + "name": "spatie/laravel-activitylog", + "version": "4.10.2", + "source": { + "type": "git", + "url": "https://github.com/spatie/laravel-activitylog.git", + "reference": "bb879775d487438ed9a99e64f09086b608990c10" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/spatie/laravel-activitylog/zipball/bb879775d487438ed9a99e64f09086b608990c10", + "reference": "bb879775d487438ed9a99e64f09086b608990c10", + "shasum": "" + }, + "require": { + "illuminate/config": "^8.0 || ^9.0 || ^10.0 || ^11.0 || ^12.0", + "illuminate/database": "^8.69 || ^9.27 || ^10.0 || ^11.0 || ^12.0", + "illuminate/support": "^8.0 || ^9.0 || ^10.0 || ^11.0 || ^12.0", + "php": "^8.1", + "spatie/laravel-package-tools": "^1.6.3" + }, + "require-dev": { + "ext-json": "*", + "orchestra/testbench": "^6.23 || ^7.0 || ^8.0 || ^9.0 || ^10.0", + "pestphp/pest": "^1.20 || ^2.0 || ^3.0" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Spatie\\Activitylog\\ActivitylogServiceProvider" + ] + } + }, + "autoload": { + "files": [ + "src/helpers.php" + ], + "psr-4": { + "Spatie\\Activitylog\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Freek Van der Herten", + "email": "freek@spatie.be", + "homepage": "https://spatie.be", + "role": "Developer" + }, + { + "name": "Sebastian De Deyne", + "email": "sebastian@spatie.be", + "homepage": "https://spatie.be", + "role": "Developer" + }, + { + "name": "Tom Witkowski", + "email": "dev.gummibeer@gmail.com", + "homepage": "https://gummibeer.de", + "role": "Developer" + } + ], + "description": "A very simple activity logger to monitor the users of your website or application", + "homepage": "https://github.com/spatie/activitylog", + "keywords": [ + "activity", + "laravel", + "log", + "spatie", + "user" + ], + "support": { + "issues": "https://github.com/spatie/laravel-activitylog/issues", + "source": "https://github.com/spatie/laravel-activitylog/tree/4.10.2" + }, + "funding": [ + { + "url": "https://spatie.be/open-source/support-us", + "type": "custom" + }, + { + "url": "https://github.com/spatie", + "type": "github" + } + ], + "time": "2025-06-15T06:59:49+00:00" + }, { "name": "spatie/laravel-medialibrary", "version": "11.17.7", diff --git a/config/activitylog.php b/config/activitylog.php new file mode 100644 index 0000000..f1262f5 --- /dev/null +++ b/config/activitylog.php @@ -0,0 +1,52 @@ + env('ACTIVITY_LOGGER_ENABLED', true), + + /* + * When the clean-command is executed, all recording activities older than + * the number of days specified here will be deleted. + */ + 'delete_records_older_than_days' => 365, + + /* + * If no log name is passed to the activity() helper + * we use this default log name. + */ + 'default_log_name' => 'default', + + /* + * You can specify an auth driver here that gets user models. + * If this is null we'll use the current Laravel auth driver. + */ + 'default_auth_driver' => null, + + /* + * If set to true, the subject returns soft deleted models. + */ + 'subject_returns_soft_deleted_models' => false, + + /* + * This model will be used to log activity. + * It should implement the Spatie\Activitylog\Contracts\Activity interface + * and extend Illuminate\Database\Eloquent\Model. + */ + 'activity_model' => \Spatie\Activitylog\Models\Activity::class, + + /* + * This is the name of the table that will be created by the migration and + * used by the Activity model shipped with this package. + */ + 'table_name' => env('ACTIVITY_LOGGER_TABLE_NAME', 'activity_log'), + + /* + * This is the database connection that will be used by the migration and + * the Activity model shipped with this package. In case it's not set + * Laravel's database.default will be used instead. + */ + 'database_connection' => env('ACTIVITY_LOGGER_DB_CONNECTION'), +]; diff --git a/database/migrations/2025_12_21_064059_create_activity_log_table.php b/database/migrations/2025_12_21_064059_create_activity_log_table.php new file mode 100644 index 0000000..7c05bc8 --- /dev/null +++ b/database/migrations/2025_12_21_064059_create_activity_log_table.php @@ -0,0 +1,27 @@ +create(config('activitylog.table_name'), function (Blueprint $table) { + $table->bigIncrements('id'); + $table->string('log_name')->nullable(); + $table->text('description'); + $table->nullableMorphs('subject', 'subject'); + $table->nullableMorphs('causer', 'causer'); + $table->json('properties')->nullable(); + $table->timestamps(); + $table->index('log_name'); + }); + } + + public function down() + { + Schema::connection(config('activitylog.database_connection'))->dropIfExists(config('activitylog.table_name')); + } +} diff --git a/database/migrations/2025_12_21_064100_add_event_column_to_activity_log_table.php b/database/migrations/2025_12_21_064100_add_event_column_to_activity_log_table.php new file mode 100644 index 0000000..7b797fd --- /dev/null +++ b/database/migrations/2025_12_21_064100_add_event_column_to_activity_log_table.php @@ -0,0 +1,22 @@ +table(config('activitylog.table_name'), function (Blueprint $table) { + $table->string('event')->nullable()->after('subject_type'); + }); + } + + public function down() + { + Schema::connection(config('activitylog.database_connection'))->table(config('activitylog.table_name'), function (Blueprint $table) { + $table->dropColumn('event'); + }); + } +} diff --git a/database/migrations/2025_12_21_064101_add_batch_uuid_column_to_activity_log_table.php b/database/migrations/2025_12_21_064101_add_batch_uuid_column_to_activity_log_table.php new file mode 100644 index 0000000..8f7db66 --- /dev/null +++ b/database/migrations/2025_12_21_064101_add_batch_uuid_column_to_activity_log_table.php @@ -0,0 +1,22 @@ +table(config('activitylog.table_name'), function (Blueprint $table) { + $table->uuid('batch_uuid')->nullable()->after('properties'); + }); + } + + public function down() + { + Schema::connection(config('activitylog.database_connection'))->table(config('activitylog.table_name'), function (Blueprint $table) { + $table->dropColumn('batch_uuid'); + }); + } +}