Add migration to clear password from auth:fail logs (#1533)

This commit is contained in:
Boy132
2025-07-19 16:47:49 +02:00
committed by GitHub
parent 4d03d6b948
commit 61098b11f2

View File

@@ -0,0 +1,29 @@
<?php
use App\Models\ActivityLog;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
DB::transaction(function () {
$logs = ActivityLog::where('event', 'auth:fail')->get();
foreach ($logs as $log) {
$log->update(['properties' => collect($log->properties)->except(['password'])->toArray()]);
}
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
// Not needed
}
};