some edits for pargar
This commit is contained in:
@@ -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