Fix activity log event filter query and add missing timestamp index (#2429)

This commit is contained in:
execsuroot
2026-07-03 03:15:20 +03:00
committed by GitHub
parent 6614ae5ea1
commit 7f14a72002
2 changed files with 29 additions and 1 deletions

View File

@@ -133,7 +133,7 @@ class ActivityResource extends Resource
])
->filters([
SelectFilter::make('event')
->options(fn (Table $table) => $table->getQuery()->pluck('event', 'event')->unique()->sort())
->options(fn (Table $table) => $table->getQuery()->select('event')->distinct()->orderBy('event')->pluck('event', 'event'))
->searchable()
->preload(),
]);

View File

@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('activity_logs', function (Blueprint $table) {
$table->index('timestamp');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('activity_logs', function (Blueprint $table) {
$table->dropIndex(['timestamp']);
});
}
};