feat(automations): add run-now test endpoint and sends log table

Enable immediate automation test runs without waiting for the scheduled hour, expose send history for debugging, and return all SuperAdmin overlay keys on refresh instead of only enable_automation.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-24 21:46:13 +03:30
co-authored by Cursor
parent 7e8979d78d
commit 995f6984ed
7 changed files with 127 additions and 17 deletions
@@ -80,7 +80,7 @@ class SettingsController extends Controller
/**
* پاک کردن کش overlay و خواندن دوباره از سوپرادمین
* (سوییچ‌هایی مثل enable_automation بعد از تغییر در پنل سوپرادمین).
* (همهٔ کلیدهای can_edit=0 مالک سوپرادمین — دسترسی مشتری به قابلیت‌ها).
*/
public function refreshSuperAdminOverlay()
{
@@ -91,14 +91,17 @@ class SettingsController extends Controller
'message' => 'ارتباط با سوپرادمین برقرار نشد؛ کش پاک شد و در درخواست بعدی دوباره تلاش می‌شود',
'ok' => false,
'count' => 0,
'items' => [],
], 502);
}
$count = (int) ($result['count'] ?? 0);
return response()->json([
'message' => 'تنظیمات پیشرفته از سوپرادمین همگام شد',
'message' => "همگام شد ({$count} کلید دسترسی از سوپرادمین)",
'ok' => true,
'count' => (int) ($result['count'] ?? 0),
'enable_automation' => $result['enable_automation'] ?? null,
'count' => $count,
'items' => $result['items'] ?? [],
'source' => $result['source'] ?? 'superadmin',
]);
}