feat: install and configure jacobtims/filament-logger for activity tracking
This commit is contained in:
parent
1bc2528256
commit
3908e027ef
@ -28,6 +28,7 @@
|
||||
use Illuminate\Session\Middleware\StartSession;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\View\Middleware\ShareErrorsFromSession;
|
||||
use Jacobtims\FilamentLogger\FilamentLoggerPlugin;
|
||||
use Swindon\FilamentHashids\Middleware\FilamentHashidsMiddleware;
|
||||
use Swis\Filament\Backgrounds\FilamentBackgroundsPlugin;
|
||||
use Swis\Filament\Backgrounds\ImageProviders\MyImages;
|
||||
@ -126,6 +127,8 @@ public function panel(Panel $panel): Panel
|
||||
->navigationUrl('/system/logs')
|
||||
->pollingTime(null)
|
||||
->authorize(fn (): bool => Filament::auth()->user()?->can('View:LogTable') ?? false),
|
||||
|
||||
FilamentLoggerPlugin::make(),
|
||||
])
|
||||
->authMiddleware([
|
||||
Authenticate::class,
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
"filament/filament": "^4.0",
|
||||
"filament/spatie-laravel-media-library-plugin": "^4.0",
|
||||
"filament/spatie-laravel-settings-plugin": "^4.4",
|
||||
"jacobtims/filament-logger": "^1.2",
|
||||
"joaopaulolndev/filament-pdf-viewer": "^2.0",
|
||||
"laravel/framework": "^12.0",
|
||||
"laravel/tinker": "^2.10.1",
|
||||
|
||||
309
composer.lock
generated
309
composer.lock
generated
@ -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": "b29f415e8e8d01a4f83dfbf06c166e32",
|
||||
"content-hash": "46a618a4a0e12edde9901dc672648e58",
|
||||
"packages": [
|
||||
{
|
||||
"name": "achyutn/filament-log-viewer",
|
||||
@ -4104,6 +4104,86 @@
|
||||
},
|
||||
"time": "2023-02-23T15:00:54+00:00"
|
||||
},
|
||||
{
|
||||
"name": "jacobtims/filament-logger",
|
||||
"version": "v1.2.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Jacobtims/filament-logger.git",
|
||||
"reference": "7a559d44a2e35e36fa37262584860c8fb4151173"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Jacobtims/filament-logger/zipball/7a559d44a2e35e36fa37262584860c8fb4151173",
|
||||
"reference": "7a559d44a2e35e36fa37262584860c8fb4151173",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"filament/filament": "^4.0|^5.0",
|
||||
"illuminate/contracts": "^11.0 | ^12.0 | ^13.0",
|
||||
"laravel/pint": "^1.0",
|
||||
"php": "^8.2",
|
||||
"spatie/laravel-activitylog": "^4.5",
|
||||
"spatie/laravel-package-tools": "^1.13.5"
|
||||
},
|
||||
"require-dev": {
|
||||
"larastan/larastan": "^3.0",
|
||||
"nunomaduro/collision": "^8.1",
|
||||
"orchestra/testbench": "^9.0 | ^10.0",
|
||||
"pestphp/pest": "^2.34 | ^3.7",
|
||||
"pestphp/pest-plugin-laravel": "^2.3 | ^3.1",
|
||||
"phpstan/extension-installer": "^1.1",
|
||||
"phpstan/phpstan-deprecation-rules": "^2.0",
|
||||
"phpstan/phpstan-phpunit": "^2.0",
|
||||
"phpunit/phpunit": "^11.5.3",
|
||||
"spatie/laravel-ray": "^1.26"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"aliases": {
|
||||
"FilamentLogger": "Jacobtims\\FilamentLogger\\Facades\\FilamentLogger"
|
||||
},
|
||||
"providers": [
|
||||
"Jacobtims\\FilamentLogger\\FilamentLoggerServiceProvider"
|
||||
]
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Jacobtims\\FilamentLogger\\": "src",
|
||||
"Jacobtims\\FilamentLogger\\Database\\Factories\\": "database/factories"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Ziyaan Hassan",
|
||||
"email": "ziyaan2010@gmail.com",
|
||||
"role": "Developer"
|
||||
},
|
||||
{
|
||||
"name": "Jacobtims",
|
||||
"email": "jacobtimmer04@gmail.com",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "Activity logger for filament",
|
||||
"homepage": "https://github.com/jacobtims/filament-logger",
|
||||
"keywords": [
|
||||
"Jacobtims",
|
||||
"Z3d0X",
|
||||
"filament-logger",
|
||||
"laravel"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/Jacobtims/filament-logger/tree/v1.2.0"
|
||||
},
|
||||
"time": "2026-03-25T08:05:51+00:00"
|
||||
},
|
||||
{
|
||||
"name": "joaopaulolndev/filament-pdf-viewer",
|
||||
"version": "v2.1.3",
|
||||
@ -4459,6 +4539,74 @@
|
||||
},
|
||||
"time": "2026-03-10T20:25:56+00:00"
|
||||
},
|
||||
{
|
||||
"name": "laravel/pint",
|
||||
"version": "v1.29.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/laravel/pint.git",
|
||||
"reference": "bdec963f53172c5e36330f3a400604c69bf02d39"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/laravel/pint/zipball/bdec963f53172c5e36330f3a400604c69bf02d39",
|
||||
"reference": "bdec963f53172c5e36330f3a400604c69bf02d39",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-json": "*",
|
||||
"ext-mbstring": "*",
|
||||
"ext-tokenizer": "*",
|
||||
"ext-xml": "*",
|
||||
"php": "^8.2.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"friendsofphp/php-cs-fixer": "^3.94.2",
|
||||
"illuminate/view": "^12.54.1",
|
||||
"larastan/larastan": "^3.9.3",
|
||||
"laravel-zero/framework": "^12.0.5",
|
||||
"mockery/mockery": "^1.6.12",
|
||||
"nunomaduro/termwind": "^2.4.0",
|
||||
"pestphp/pest": "^3.8.6",
|
||||
"shipfastlabs/agent-detector": "^1.1.0"
|
||||
},
|
||||
"bin": [
|
||||
"builds/pint"
|
||||
],
|
||||
"type": "project",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"App\\": "app/",
|
||||
"Database\\Seeders\\": "database/seeders/",
|
||||
"Database\\Factories\\": "database/factories/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nuno Maduro",
|
||||
"email": "enunomaduro@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "An opinionated code formatter for PHP.",
|
||||
"homepage": "https://laravel.com",
|
||||
"keywords": [
|
||||
"dev",
|
||||
"format",
|
||||
"formatter",
|
||||
"lint",
|
||||
"linter",
|
||||
"php"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/laravel/pint/issues",
|
||||
"source": "https://github.com/laravel/pint"
|
||||
},
|
||||
"time": "2026-03-12T15:51:39+00:00"
|
||||
},
|
||||
{
|
||||
"name": "laravel/prompts",
|
||||
"version": "v0.3.14",
|
||||
@ -8440,6 +8588,97 @@
|
||||
],
|
||||
"time": "2024-05-17T09:06:10+00:00"
|
||||
},
|
||||
{
|
||||
"name": "spatie/laravel-activitylog",
|
||||
"version": "4.12.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/spatie/laravel-activitylog.git",
|
||||
"reference": "2a2024fcac05628b0d1bfdbb1b94dda8b0661dc0"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/spatie/laravel-activitylog/zipball/2a2024fcac05628b0d1bfdbb1b94dda8b0661dc0",
|
||||
"reference": "2a2024fcac05628b0d1bfdbb1b94dda8b0661dc0",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"illuminate/config": "^8.0 || ^9.0 || ^10.0 || ^11.0 || ^12.0 || ^13.0",
|
||||
"illuminate/database": "^8.69 || ^9.27 || ^10.0 || ^11.0 || ^12.0 || ^13.0",
|
||||
"illuminate/support": "^8.0 || ^9.0 || ^10.0 || ^11.0 || ^12.0 || ^13.0",
|
||||
"php": "^8.1",
|
||||
"spatie/laravel-package-tools": "^1.6.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"ext-json": "*",
|
||||
"orchestra/testbench": "^6.23 || ^7.0 || ^8.0 || ^9.6 || ^10.0 || ^11.0",
|
||||
"pestphp/pest": "^1.20 || ^2.0 || ^3.0 || ^4.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.12.3"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://spatie.be/open-source/support-us",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/spatie",
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2026-03-24T12:33:53+00:00"
|
||||
},
|
||||
{
|
||||
"name": "spatie/laravel-medialibrary",
|
||||
"version": "11.21.0",
|
||||
@ -14035,74 +14274,6 @@
|
||||
},
|
||||
"time": "2026-02-09T13:44:54+00:00"
|
||||
},
|
||||
{
|
||||
"name": "laravel/pint",
|
||||
"version": "v1.29.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/laravel/pint.git",
|
||||
"reference": "bdec963f53172c5e36330f3a400604c69bf02d39"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/laravel/pint/zipball/bdec963f53172c5e36330f3a400604c69bf02d39",
|
||||
"reference": "bdec963f53172c5e36330f3a400604c69bf02d39",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-json": "*",
|
||||
"ext-mbstring": "*",
|
||||
"ext-tokenizer": "*",
|
||||
"ext-xml": "*",
|
||||
"php": "^8.2.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"friendsofphp/php-cs-fixer": "^3.94.2",
|
||||
"illuminate/view": "^12.54.1",
|
||||
"larastan/larastan": "^3.9.3",
|
||||
"laravel-zero/framework": "^12.0.5",
|
||||
"mockery/mockery": "^1.6.12",
|
||||
"nunomaduro/termwind": "^2.4.0",
|
||||
"pestphp/pest": "^3.8.6",
|
||||
"shipfastlabs/agent-detector": "^1.1.0"
|
||||
},
|
||||
"bin": [
|
||||
"builds/pint"
|
||||
],
|
||||
"type": "project",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"App\\": "app/",
|
||||
"Database\\Seeders\\": "database/seeders/",
|
||||
"Database\\Factories\\": "database/factories/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nuno Maduro",
|
||||
"email": "enunomaduro@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "An opinionated code formatter for PHP.",
|
||||
"homepage": "https://laravel.com",
|
||||
"keywords": [
|
||||
"dev",
|
||||
"format",
|
||||
"formatter",
|
||||
"lint",
|
||||
"linter",
|
||||
"php"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/laravel/pint/issues",
|
||||
"source": "https://github.com/laravel/pint"
|
||||
},
|
||||
"time": "2026-03-12T15:51:39+00:00"
|
||||
},
|
||||
{
|
||||
"name": "laravel/sail",
|
||||
"version": "v1.53.0",
|
||||
|
||||
60
config/filament-logger.php
Normal file
60
config/filament-logger.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
use Jacobtims\FilamentLogger\Loggers\AccessLogger;
|
||||
use Jacobtims\FilamentLogger\Loggers\ModelLogger;
|
||||
use Jacobtims\FilamentLogger\Loggers\NotificationLogger;
|
||||
use Jacobtims\FilamentLogger\Loggers\ResourceLogger;
|
||||
use Jacobtims\FilamentLogger\Resources\ActivityResource;
|
||||
|
||||
return [
|
||||
'datetime_format' => 'l, d F Y H:i:s',
|
||||
'date_format' => 'l, d F Y',
|
||||
|
||||
'activity_resource' => ActivityResource::class,
|
||||
'scoped_to_tenant' => true,
|
||||
'navigation_sort' => null,
|
||||
|
||||
'resources' => [
|
||||
'enabled' => true,
|
||||
'log_name' => 'Resource',
|
||||
'logger' => ResourceLogger::class,
|
||||
'color' => 'success',
|
||||
|
||||
'exclude' => [
|
||||
// App\Filament\Resources\UserResource::class,
|
||||
],
|
||||
'cluster' => null,
|
||||
'navigation_group' => 'Sistem',
|
||||
],
|
||||
|
||||
'access' => [
|
||||
'enabled' => true,
|
||||
'logger' => AccessLogger::class,
|
||||
'color' => 'danger',
|
||||
'log_name' => 'Access',
|
||||
],
|
||||
|
||||
'notifications' => [
|
||||
'enabled' => true,
|
||||
'logger' => NotificationLogger::class,
|
||||
'color' => null,
|
||||
'log_name' => 'Notification',
|
||||
],
|
||||
|
||||
'models' => [
|
||||
'enabled' => true,
|
||||
'log_name' => 'Model',
|
||||
'color' => 'warning',
|
||||
'logger' => ModelLogger::class,
|
||||
'register' => [
|
||||
// App\Models\User::class,
|
||||
],
|
||||
],
|
||||
|
||||
'custom' => [
|
||||
// [
|
||||
// 'log_name' => 'Custom',
|
||||
// 'color' => 'primary',
|
||||
// ]
|
||||
],
|
||||
];
|
||||
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateActivityLogTable extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::connection(config('activitylog.database_connection'))->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'));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddEventColumnToActivityLogTable extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::connection(config('activitylog.database_connection'))->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');
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddBatchUuidColumnToActivityLogTable extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::connection(config('activitylog.database_connection'))->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');
|
||||
});
|
||||
}
|
||||
}
|
||||
31
lang/vendor/filament-logger/en/filament-logger.php
vendored
Normal file
31
lang/vendor/filament-logger/en/filament-logger.php
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Navigation & Resource
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
'nav.group' => 'Sistem',
|
||||
'nav.log.label' => 'Activity Log',
|
||||
'nav.log.icon' => 'heroicon-o-archive-box-x-mark',
|
||||
'resource.label.log' => 'Activity log',
|
||||
'resource.label.logs' => 'Activity logs',
|
||||
'resource.label.user' => 'User',
|
||||
'resource.label.subject' => 'Subject',
|
||||
'resource.label.subject_type' => 'Subject type',
|
||||
'resource.label.description' => 'Description',
|
||||
'resource.label.type' => 'Type',
|
||||
'resource.label.event' => 'Event',
|
||||
'resource.label.logged_at' => 'Logged At',
|
||||
'resource.label.properties' => 'Properties',
|
||||
'resource.label.old' => 'Old',
|
||||
'resource.label.new' => 'New',
|
||||
'resource.label.old_value' => 'Old Value',
|
||||
'resource.label.new_value' => 'New Value',
|
||||
'resource.label.properties_hint' => 'Can be key or value',
|
||||
'resource.label.old_attributes' => 'Old Attribute or Value: ',
|
||||
'resource.label.new_attributes' => 'New Attribute or Value: ',
|
||||
];
|
||||
28
lang/vendor/filament-logger/id/filament-logger.php
vendored
Normal file
28
lang/vendor/filament-logger/id/filament-logger.php
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Navigation & Resource
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
'nav.group' => 'Sistem',
|
||||
'nav.log.label' => 'Catatan Aktivitas',
|
||||
'nav.log.icon' => 'heroicon-o-archive-box-x-mark',
|
||||
'resource.label.log' => 'Catatan aktivitas',
|
||||
'resource.label.logs' => 'Catatan aktivitas',
|
||||
'resource.label.user' => 'Pengguna',
|
||||
'resource.label.subject' => 'Subjek',
|
||||
'resource.label.subject_type' => 'Tipe Subjek',
|
||||
'resource.label.description' => 'Deskripsi',
|
||||
'resource.label.type' => 'Jenis',
|
||||
'resource.label.event' => 'Kegiatan',
|
||||
'resource.label.logged_at' => 'Tercatat pada',
|
||||
'resource.label.properties' => 'Properti',
|
||||
'resource.label.old' => 'Lama',
|
||||
'resource.label.new' => 'Baru',
|
||||
'resource.label.old_value' => 'Nilai Lama',
|
||||
'resource.label.new_value' => 'Nilai Baru',
|
||||
];
|
||||
Loading…
Reference in New Issue
Block a user