fix withdraw
This commit is contained in:
@@ -186,7 +186,7 @@ class WalletController extends Controller
|
||||
'active' => true
|
||||
], 7, $deposit, false, $gold_block);
|
||||
|
||||
//send to tahesan
|
||||
//send to tahesab
|
||||
if($this->Config('send_to_tahesab') == "true"){
|
||||
try {
|
||||
$data['direction'] = $deposit ? 1 : 0;
|
||||
@@ -359,25 +359,30 @@ class WalletController extends Controller
|
||||
|
||||
public function getWithdraw(Request $request, $id)
|
||||
{
|
||||
// پیدا کردن رکورد Withdraw با استفاده از شناسه
|
||||
return $withdraw = Withdraw::with(['customer', 'bank_account', 'Address', "Transaction"])->find($id);
|
||||
// بررسی وجود رکورد
|
||||
$withdraw = Withdraw::with(['customer', 'bank_account', 'Address', "Transaction"])->find($id);
|
||||
if (!$withdraw) {
|
||||
return response()->json(['error' => 'Withdraw not found'], 404);
|
||||
}
|
||||
$withdraw->sts = $request->sts;
|
||||
$withdraw->save();
|
||||
return response()->json(['message' => 'Withdraw updated successfully', 'withdraw' => $withdraw]);
|
||||
return response()->json($withdraw);
|
||||
}
|
||||
|
||||
public function completeWithdraw(Request $request)
|
||||
{
|
||||
$data = $request->all();
|
||||
$request->validate([
|
||||
'id' => 'required|integer|exists:withdraws,id',
|
||||
'tracked_number' => 'required|string|max:50',
|
||||
'date_at' => 'nullable|date',
|
||||
]);
|
||||
|
||||
$data = $request->only(['tracked_number', 'date_at']);
|
||||
$data['user_id'] = auth('user')->id();
|
||||
$data['sts'] = 2;
|
||||
$data['date_at'] = now();
|
||||
Withdraw::findOrFail($data['id'])->update($data);
|
||||
$withdraw = Withdraw::findOrFail($data['id']);
|
||||
$data['tracked_number'] = (string) $data['tracked_number'];
|
||||
if (empty($data['date_at'])) {
|
||||
$data['date_at'] = now();
|
||||
}
|
||||
|
||||
$withdraw = Withdraw::findOrFail($request->id);
|
||||
$withdraw->update($data);
|
||||
// $tahesab = new TahesabController();
|
||||
// $tahesab->wallet([
|
||||
|
||||
Reference in New Issue
Block a user