feat(admin): star/tags marks, service product-type filter, campaign bulk actions, SMTP test
- Star (is_starred) and colored tags for services, customers, orders, invoices:
Markable trait, tags/taggables tables, PATCH administrator/marks/{type}/{key},
tag CRUD, list filters starred / tag_ids[]
- GET administrator/services accepts product_type (falls back to product type
for legacy rows without services.type)
- Mail campaigns: bulk cancel / retry failed / delete; cancelled campaigns are
skipped by SendMailCampaignRecipient
- POST administrator/settings/test-smtp sends a test email through the saved
mail transport
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
46aa138eec
commit
40bf6b54f9
@@ -9,11 +9,13 @@ use App\Http\Facade\SignRSA;
|
||||
use App\Http\Services\Telegram;
|
||||
use App\Models\Setting;
|
||||
use App\Support\PublicSetting;
|
||||
use App\Support\AutoEmailGate;
|
||||
use App\Support\MailSettings;
|
||||
use App\Support\Turnstile;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
@@ -189,6 +191,42 @@ class SettingController extends Controller
|
||||
return response()->json(['error' => false, 'message' => 'Đã gửi tin nhắn test thành công.']);
|
||||
}
|
||||
|
||||
public function testSmtp(Request $request): JsonResponse
|
||||
{
|
||||
$data = $request->validate(['email' => 'required|email|max:255']);
|
||||
|
||||
if (!AutoEmailGate::mailEnabled()) {
|
||||
return response()->json([
|
||||
'error' => true,
|
||||
'message' => 'Hệ thống đang tắt gửi email (Mẫu email → Cài đặt). Bật lại rồi gửi test.',
|
||||
], 422);
|
||||
}
|
||||
|
||||
MailSettings::refresh(app('mail.manager'));
|
||||
$mailer = MailSettings::transport() ?? config('mail.default');
|
||||
|
||||
try {
|
||||
Mail::mailer($mailer)->html(
|
||||
'<p>Đây là email test từ Portal Admin.</p>'
|
||||
. '<p>Nếu bạn nhận được email này, cấu hình gửi email (' . e($mailer) . ') đang hoạt động.</p>'
|
||||
. '<p>Gửi lúc ' . now()->format('H:i:s d/m/Y') . '.</p>',
|
||||
fn ($message) => $message->to($data['email'])->subject('[Portal] Email test cấu hình SMTP'),
|
||||
);
|
||||
} catch (\Throwable $e) {
|
||||
return response()->json([
|
||||
'error' => true,
|
||||
'message' => 'Gửi email test thất bại: ' . $e->getMessage(),
|
||||
], 422);
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'error' => false,
|
||||
'message' => $mailer === 'log'
|
||||
? 'Driver đang là Log: email được ghi vào log, không gửi thật.'
|
||||
: "Đã gửi email test tới {$data['email']}.",
|
||||
]);
|
||||
}
|
||||
|
||||
public function uploadMedia(Request $request): JsonResponse
|
||||
{
|
||||
$request->validate([
|
||||
|
||||
Reference in New Issue
Block a user