This commit is contained in:
2026-06-14 21:09:43 +03:30
parent 6f86e8242c
commit b84b2df01a
9 changed files with 287 additions and 66 deletions
@@ -181,21 +181,27 @@ class RequestsController extends Controller
// $this->send($admin->mobile, $messageExam);
// });
$wallet = Wallet::where('owner', $data['customer_id'])->whereNull('fund_id')->first();
$wallet = Wallet::where('owner', $data['customer_id'])
->whereNull('fund_id')
->whereNull('product_id')
->first();
if($data['method'] == 'cash') {
$pricePerGram = $data['total_price'];
}elseif ($data['method'] == 'gold') {
$pricePerGram = $data['total_price'] / $data['amount'];
}
$goldBalance = $wallet ? ($wallet->gold ?? 0) : 0;
$cashBalance = $wallet ? ($wallet->cash ?? 0) : 0;
if($data['method'] == 'cash') {
$customerMessage = "$companyName\nبرداشت ریالی \nمبلغ: {$data['amount']}\n" .
"\nموجودی طلایی: {$wallet->gold}\n" .
"مانده ریالی: " . number_format($wallet->cash) . "\n" . $this->Config('app_url');
"\nموجودی طلایی: {$goldBalance}\n" .
"مانده ریالی: " . number_format($cashBalance) . "\n" . $this->Config('app_url');
}elseif ($data['method'] == 'gold') {
$customerMessage = "$companyName\nبرداشت طلایی \nگرم: {$data['amount']}\nقیمت گرم: " . number_format($pricePerGram) .
"\nمبلغ کل: " . number_format($data['total_price']) . "\nموجودی طلایی: {$wallet->gold}\n" .
"مانده ریالی: " . number_format($wallet->cash) . "\n" . $this->Config('app_url');
"\nمبلغ کل: " . number_format($data['total_price']) . "\nموجودی طلایی: {$goldBalance}\n" .
"مانده ریالی: " . number_format($cashBalance) . "\n" . $this->Config('app_url');
}