芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/tblonline.org/app/Http/Controllers/TransferRequestController.php
with('user') ->with('currency') ->with('other_bank') ->where('type', 'Wire_Transfer') ->orderBy("transactions.id", "desc"); return Datatables::eloquent($transactions) ->filter(function ($query) use ($request) { $status = $request->has('status') ? $request->status : 1; $query->where('status', $status); }, true) ->editColumn('user.name', function ($transaction) { return '
' . $transaction->user->name . '
' . $transaction->user->email; }) ->editColumn('amount', function ($transaction) { return decimalPlace($transaction->amount, currency($transaction->currency->name)); }) ->editColumn('status', function ($transaction) { return transaction_status($transaction->status); }) ->addColumn('action', function ($transaction) { $actions = '
'; $actions .= '
' . _lang('Details') . '
'; $actions .= $transaction->status != 2 ? '
' . _lang('Approve') . '
' : ''; $actions .= $transaction->status != 0 ? '
' . _lang('Reject') . '
' : ''; $actions .= csrf_field(); $actions .= '
'; $actions .= '
' . _lang('Delete') . '
'; $actions .= '
'; return $actions; }) ->setRowId(function ($transaction) { return "row_" . $transaction->id; }) ->rawColumns(['user.name', 'status', 'action']) ->make(true); } /** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show(Request $request, $id) { $transaction = Transaction::find($id); if (!$request->ajax()) { return back(); } else { return view('backend.transfer_request.modal.view', compact('transaction', 'id')); } } /** * Approve Wire Transfer * * @param int $id * @return \Illuminate\Http\Response */ public function approve($id) { $transaction = Transaction::find($id); $transaction->status = 2; $transaction->save(); try { $transaction->user->notify(new ApprovedWireTransfer($transaction)); } catch (\Exception $e) {} return redirect()->route('transfer_requests.index')->with('success', _lang('Wire Transfer Approved')); } /** * Reject Wire Transfer * * @param int $id * @return \Illuminate\Http\Response */ public function reject($id) { $transaction = Transaction::find($id); $transaction->status = 0; $transaction->save(); try { $transaction->user->notify(new RejectWireTransfer($transaction)); } catch (\Exception $e) {} return redirect()->route('transfer_requests.index')->with('success', _lang('Wire Transfer Rejected')); } /** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $transaction = Transaction::find($id); $transaction->delete(); return redirect()->route('transfer_requests.index')->with('success', _lang('Deleted Successfully')); } }