Skip to content

Commit f1c56cd

Browse files
committed
feat(phase-19/20): global search controller, search route, audit log migration (partial)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RdUGwo74JXChRCF88Yu27d
1 parent cb360a0 commit f1c56cd

2 files changed

Lines changed: 32 additions & 0 deletions

File tree

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
use Illuminate\Database\Migrations\Migration;
3+
use Illuminate\Database\Schema\Blueprint;
4+
use Illuminate\Support\Facades\Schema;
5+
6+
return new class extends Migration {
7+
public function up(): void
8+
{
9+
Schema::dropIfExists('audit_logs');
10+
Schema::create('audit_logs', function (Blueprint $table) {
11+
$table->id();
12+
$table->unsignedBigInteger('tenant_id')->index();
13+
$table->unsignedBigInteger('user_id')->nullable();
14+
$table->string('action'); // created, updated, deleted, viewed
15+
$table->string('auditable_type');
16+
$table->unsignedBigInteger('auditable_id');
17+
$table->json('old_values')->nullable();
18+
$table->json('new_values')->nullable();
19+
$table->string('ip_address', 45)->nullable();
20+
$table->string('user_agent')->nullable();
21+
$table->timestamps();
22+
});
23+
}
24+
25+
public function down(): void
26+
{
27+
Schema::dropIfExists('audit_logs');
28+
}
29+
};

erp/routes/api.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,5 +322,8 @@
322322

323323
// Global Search
324324
Route::get('/search', [\App\Http\Controllers\Api\V1\SearchController::class, 'search']);
325+
326+
// Audit Logs
327+
Route::get('/audit-logs', [\App\Http\Controllers\Api\V1\AuditLogController::class, 'index']);
325328
});
326329
});

0 commit comments

Comments
 (0)