some edits for pargar
This commit is contained in:
@@ -691,7 +691,7 @@ class WalletController extends Controller
|
||||
|
||||
public function indexWithdraw(Request $request)
|
||||
{
|
||||
$records = Withdraw::with(['customer', 'bank_account', 'Address', "Transaction"]);
|
||||
$records = Withdraw::with(['customer', 'bank_account', 'address', "Transaction"]);
|
||||
Withdraw::applyFlowFilter($records, $request->input('flow_type', 'all'));
|
||||
TableEngine::create($records, $request->all())
|
||||
->initSearch(['customer.name'])
|
||||
@@ -874,7 +874,7 @@ class WalletController extends Controller
|
||||
|
||||
public function getWithdraw(Request $request, $id)
|
||||
{
|
||||
$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);
|
||||
}
|
||||
@@ -883,7 +883,7 @@ class WalletController extends Controller
|
||||
|
||||
public function indexPhysicalWithdraw(Request $request)
|
||||
{
|
||||
$records = Withdraw::with(['customer', 'Address', 'Transaction.product']);
|
||||
$records = Withdraw::with(['customer', 'address', 'Transaction.product']);
|
||||
Withdraw::scopePhysicalWithdrawals($records);
|
||||
|
||||
TableEngine::create($records, $request->all())
|
||||
|
||||
@@ -473,14 +473,19 @@ class WalletController extends Controller
|
||||
$data['customer'] = Customer::with([/*"wallet"*/])->where('id', auth('customer')->id())->first();
|
||||
$data['customer']['wallet_interface'] = new WalletInterface(auth('customer')->id(), auth('customer')->user()->type);
|
||||
|
||||
if (!isset($data['address_id'])) {
|
||||
if (!isset($data['address_id']) || (int) $data['address_id'] <= 0) {
|
||||
return response()->json(['message' => 'آدرس انتخاب نشده است'], 422);
|
||||
}
|
||||
|
||||
$data['adress'] = Address::find($data['address_id']);
|
||||
if (!$data['adress'] || $data['adress']->customer_id != $data['customer']->id) {
|
||||
$addressId = (int) $data['address_id'];
|
||||
$data['adress'] = Address::query()
|
||||
->where('id', $addressId)
|
||||
->where('customer_id', $data['customer']->id)
|
||||
->first();
|
||||
if (! $data['adress']) {
|
||||
return response()->json(['message' => 'آدرس معتبر نیست یا متعلق به شما نمیباشد'], 403);
|
||||
}
|
||||
$data['address_id'] = $addressId;
|
||||
$assetSummaryService = app(AssetSummaryService::class);
|
||||
foreach ($data['wallets'] as $key => $wallet) {
|
||||
$data['wallets'][$key]['wallet'] = Wallet::with(["product"])->find($wallet['wallet_id']);
|
||||
@@ -580,7 +585,7 @@ class WalletController extends Controller
|
||||
return response()->json($data['withdraw']['id']);
|
||||
}
|
||||
public function indexWithdraw(Request $request){
|
||||
$records = Withdraw::with(['customer','bank_account','Address',"Transaction"])->where("customer_id",auth('customer')->id());
|
||||
$records = Withdraw::with(['customer','bank_account','address',"Transaction"])->where("customer_id",auth('customer')->id());
|
||||
TableEngine::create($records, $request->all())
|
||||
->initSearch(['customer.name'])
|
||||
->select([
|
||||
@@ -589,7 +594,7 @@ class WalletController extends Controller
|
||||
return response()->json($records);
|
||||
}
|
||||
public function index_withdraw_physical(Request $request){
|
||||
$records = Withdraw::with(['customer','bank_account','Address',"Transaction.product.file"])->where("customer_id",auth('customer')->id())->whereBetween('sts', [49, 70]);
|
||||
$records = Withdraw::with(['customer','bank_account','address',"Transaction.product.file"])->where("customer_id",auth('customer')->id())->whereBetween('sts', [49, 70]);
|
||||
TableEngine::create($records, $request->all())
|
||||
->initSearch(['customer.name'])
|
||||
->select([
|
||||
|
||||
Reference in New Issue
Block a user