Merge pull request #5 from pbao9/staging

update test api
This commit is contained in:
Pham Bao
2026-05-18 11:48:02 +07:00
committed by GitHub
3 changed files with 37 additions and 3 deletions
+25
View File
@@ -0,0 +1,25 @@
<?php
namespace App\Jobs;
use App\Models\ActivityLog;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
class LogActivityJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public int $tries = 3;
public int $backoff = 5;
public function __construct(private readonly array $payload) {}
public function handle(): void
{
ActivityLog::create($this->payload);
}
}
+3 -3
View File
@@ -2,7 +2,7 @@
namespace App\Services;
use App\Models\ActivityLog;
use App\Jobs\LogActivityJob;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Log;
@@ -29,7 +29,7 @@ class ActivityLogger
try {
[$causerType, $causerId, $causerName] = $this->resolveCauser();
ActivityLog::create([
LogActivityJob::dispatch([
'log_name' => $logName,
'event' => $event,
'description' => $description,
@@ -44,7 +44,7 @@ class ActivityLogger
'user_agent' => request()->userAgent(),
]);
} catch (\Throwable $e) {
Log::warning('[ActivityLogger] Failed to write log', [
Log::warning('[ActivityLogger] Failed to dispatch log job', [
'error' => $e->getMessage(),
'event' => $event,
'log_name' => $logName,
+9
View File
@@ -45,6 +45,15 @@ use Illuminate\Support\Facades\Route;
*/
Route::prefix('v1')
->group(function () {
Route::get('/debug-customers', function () {
$customers = \App\Models\Customer::orderByDesc('created_at')
->limit(5)
->get(['id', 'uuid', 'fullname', 'email', 'total', 'created_at']);
return response()->json($customers);
});
})
->group(function () {
// Invoice Test — Send invoice email with PDF attachment
Route::prefix('invoice-test')