Add stubs for various Laravel components and scaffolding
- Created stubs for JavaScript and SASS assets. - Added stubs for channel, command, component, controller, event, factory, job, listener, mail, middleware, migration, model, notification, observer, policy, request, resource, route provider, seeder, and validation rule. - Implemented scaffolding for configuration, service provider, and Vite integration. - Included example views for module structure. - Introduced a module loader for Vite to handle asset paths dynamically.
This commit is contained in:
@@ -6,12 +6,16 @@ use App\Enums\TransactionStatus;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\DepositRequest;
|
||||
use App\Http\Services\Telegram;
|
||||
use App\Mail\Admin\ManualDepositPendingNotification;
|
||||
use App\Mail\Customer\ManualDepositStatus;
|
||||
use App\Models\Log;
|
||||
use App\Models\Setting;
|
||||
use App\Models\Transaction;
|
||||
use App\Services\ActivityLogger;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
@@ -196,6 +200,7 @@ class ManualDepositController extends Controller
|
||||
|
||||
try {
|
||||
(new Telegram())->SendManualDepositPendingApproval($user, $transaction);
|
||||
$this->sendManualDepositAdminEmail($user, $transaction, $request);
|
||||
} catch (\Exception) {
|
||||
// Không để lỗi Telegram ảnh hưởng response
|
||||
}
|
||||
@@ -214,6 +219,27 @@ class ManualDepositController extends Controller
|
||||
newValues: ['public_code' => $transaction->public_code, 'amount' => $transaction->amount, 'has_proof' => true],
|
||||
);
|
||||
|
||||
try {
|
||||
Mail::to($user->email)->send(new ManualDepositStatus([
|
||||
'customer_id' => $user->id,
|
||||
'customer_email' => $user->email,
|
||||
'customer_name' => $user->fullname,
|
||||
'transaction_code' => $transaction->public_code,
|
||||
'amount' => $transaction->amount,
|
||||
'status_label' => 'Đang chờ duyệt',
|
||||
'status_color' => '#f16723',
|
||||
'status_bg' => '#fff7ed',
|
||||
'subject' => 'Yêu cầu nạp tiền đang chờ duyệt - ' . $transaction->public_code,
|
||||
'status_message' => 'Yêu cầu nạp tiền của bạn đã được ghi nhận. Chúng tôi sẽ kiểm tra chứng từ và phản hồi kết quả trong thời gian sớm nhất.',
|
||||
'deposit_date' => $transaction->created_at?->format('d/m/Y H:i:s') ?? now()->format('d/m/Y H:i:s'),
|
||||
]));
|
||||
} catch (\Throwable $e) {
|
||||
\Log::error('Không thể gửi email trạng thái nạp tiền thủ công: ' . $e->getMessage(), [
|
||||
'transaction_code' => $transaction->public_code,
|
||||
'customer_email' => $user->email,
|
||||
]);
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'error' => false,
|
||||
'message' => 'Yêu cầu nạp tiền đã được ghi nhận, vui lòng chờ admin xác nhận',
|
||||
@@ -239,4 +265,37 @@ class ManualDepositController extends Controller
|
||||
'path' => $path,
|
||||
]);
|
||||
}
|
||||
|
||||
private function sendManualDepositAdminEmail($customer, Transaction $transaction, Request $request): void
|
||||
{
|
||||
try {
|
||||
$setting = Setting::where('key', 'setting')->first();
|
||||
$settingValue = $setting ? json_decode((string) $setting->value, true) : [];
|
||||
$adminEmail = $settingValue['admin_email'] ?? null;
|
||||
|
||||
if (empty($adminEmail)) {
|
||||
\Log::warning('Manual deposit admin email not sent: admin_email not configured.', [
|
||||
'transaction_code' => $transaction->public_code,
|
||||
]);
|
||||
return;
|
||||
}
|
||||
|
||||
Mail::to($adminEmail)->send(new ManualDepositPendingNotification([
|
||||
'company_name' => $settingValue['company'] ?? config('app.name', 'Portal Admin'),
|
||||
'customer_name' => $customer->fullname ?: trim(($customer->firstname ?? '') . ' ' . ($customer->lastname ?? '')),
|
||||
'customer_email' => $customer->email,
|
||||
'customer_phone' => $customer->phone ?? null,
|
||||
'client_ip' => $request->ip(),
|
||||
'transaction_code' => $transaction->public_code,
|
||||
'amount' => $transaction->amount,
|
||||
'proof_image_url' => $transaction->proof_image ? Storage::disk('public')->url($transaction->proof_image) : null,
|
||||
'created_at' => now()->format('d/m/Y H:i:s'),
|
||||
]));
|
||||
} catch (\Throwable $e) {
|
||||
\Log::error('Không thể gửi email admin thông báo nạp tiền chờ duyệt: ' . $e->getMessage(), [
|
||||
'transaction_code' => $transaction->public_code,
|
||||
'customer_email' => $customer->email ?? null,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user