芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/myvyralapp.com/bck/app/Http/Controllers/User/WalletController.php
whereHas("currency",function($q) { return $q->where("type",GlobalConst::FIAT); })->orderByDesc("balance")->get(); $crypto_wallets = UserWallet::auth()->whereHas("currency",function($q) { return $q->where("type",GlobalConst::CRYPTO); })->orderByDesc("balance")->get(); return view('user.sections.wallets.index',compact("page_title","fiat_wallets","crypto_wallets")); } public function balance(Request $request) { $validator = Validator::make($request->all(),[ 'target' => "required|string", ]); if($validator->fails()) { return Response::error($validator->errors(),null,400); } $validated = $validator->validate(); try{ $wallet = UserWallet::auth()->whereHas("currency",function($q) use ($validated) { $q->where("code",$validated['target']); })->first(); }catch(Exception $e) { $error = ['error' => ['Something went worng!. Please try again.']]; return Response::error($error,null,500); } if(!$wallet) { $error = ['error' => ['Your '.($validated['target']).' wallet not found.']]; return Response::error($error,null,404); } $success = ['success' => ['Data collected successfully!']]; return Response::success($success,$wallet->balance,200); } }