<?php
namespace App\Http\Controllers\Agencies;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Mail;
use App\Http\Controllers\Controller;
use App\User;
use App\Fun\Fun;
use Auth;
use DB;
use App\FundsRegisterModel;
use App\ItemModel;
use App\BranchModel;
use App\FundsTransactionModel;
use Illuminate\Support\Facades\Crypt;
use Spatie\Permission\Models\Role;
use App\CategoryModel;
use App\ProjectModel;
use App\AgencyBankModel;
use App\AccessoriesModel;
use App\AgencyLevelModel;
use App\BankAccountModel;
use App\BankAgencyModel;
use DataTables;
use Hash;
use GuzzleHttp\Client;
use App\PositionModel;
use App\BankModel;

class FundsTransactionController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {

        return view('agencies.funds-transaction.index');
    }
    /**
     *
     *  Get funds transaction for each user / agency
     *
     */
    public function datatable_get_funds_transactions()
    {


        $user_id = Auth::user()->id;
        $get_funds = FundsRegisterModel::where('user_id', $user_id)->get();
        $account_number = $get_funds[0]->account_number;
        $data = DB::select("
            SELECT 
                               nso007_funds_transaction.id,
                               nso007_funds_transaction.operation_type,
                               nso007_funds_transaction.balance,
                               nso007_funds_transaction.request_date,
                               nso007_funds_transaction.app_rej_date,
                               nso007_funds_transaction.account_number,
                               nso007_funds_transaction.amount,
                               nso007_funds_transaction.remark,
                               nso007_funds_transaction.status,
                               nso007_funds_transaction.transaction_code,
                               nso007_funds_transaction.created_at,
                               nso007_funds_transaction.updated_at
                               FROM nso007_funds_transaction 
                               
            WHERE (
                    (account_number =  $account_number AND operation_type = 4)
                    OR (account_number =  $account_number AND operation_type = 5)
                )
                OR (
                    (account_number =  $account_number AND operation_type = 1)
                    OR (account_number =  $account_number AND operation_type = 1)
                )
                OR (
                    (account_number =  $account_number AND operation_type = 6)
                )
                OR (
                    (account_number = $account_number AND operation_type = 2)
                )
                OR (
                    (account_number = $account_number AND operation_type = 3)
                )
                OR (
                    (account_number = $account_number AND operation_type = 7)
                )
            ORDER BY id ASC
        ");
        return  Datatables::of($data)
            ->addIndexColumn()
            ->addColumn('created_at', function ($data) {
                return date('d-m-Y H:i:s A', strtotime($data->created_at));
            })
            ->addColumn('operation_type', function ($data) {
                switch ($data->operation_type) {
                    case '1':
                        return "Add Funds";
                        break;
                    case '2':
                        return "Payment";
                        break;
                    case '3':
                        return "Revenue";
                        break;
                    case '4':
                        return "Send Funds";
                        break;
                    case '5':
                        return "Received Funds";
                        break;
                    case '6':
                        return "Withdraw Funds";
                        break;
                    case '7':
                        return 'Refund';
                        break;
                    case '8':
                        return 'Booking';
                        break;
                }
            })
            ->addColumn('credit', function ($data) {
                if (($data->operation_type % 2) !== 0) {
                    return "$ " . number_format($data->amount, 2);
                }
            })
            ->addColumn('debit', function ($data) {
                if (($data->operation_type % 2) == 0) {
                    return "$ " . number_format($data->amount, 2);
                }
            })
            ->addColumn('balance', function ($data) {
                return "$ " . number_format($data->balance, 2);
            })
            ->addColumn('request_date', function ($data) {
                return $data->request_date;
            })
            ->addColumn('status', function ($data) {
                if ($data->status == 0) {
                    return '<strong class="text-warning"><span class="fa fa-spinner"></span> Pedding</strong>';
                } elseif ($data->status == 1) {
                    if ($data->operation_type == 7) {
                        return '<strong class="text-dank"><span class="fa fa-check"></span> Refund / ' . date('d-m-Y H:i:s A', strtotime($data->updated_at)) . '</strong>';
                    } else {
                        return '<strong class="text-success"><span class="fa fa-check"></span> Done / ' . date('d-m-Y H:i:s A', strtotime($data->updated_at)) . '</strong>';
                    }
                } elseif ($data->status == 2) {
                    return '<strong class="text-danger"><span class="fa fa-close"></span> Rejected / ' . date('d-m-Y H:i:s A', strtotime($data->updated_at)) . '</strong>';
                } else {
                    return '<strong class="text-primary"><span class="fa fa-spinner"></span> Proccessing</strong>';
                }
            })
            ->addIndexColumn()
            ->rawColumns([
                'created_at' => 'created_at',
                'operation_type' => 'operation_type',
                'credit' => 'credit',
                'debit' => 'debit',
                'balance' => 'balance',
                'status' => 'status'
            ])
            ->make(true);
    }

    public function funds_transaction_print()
    {


        $user_id = Auth::user()->id;
        $get_funds = FundsRegisterModel::where('user_id', $user_id)->get();
        $account_number = $get_funds[0]->account_number;
        $data = DB::select("
            SELECT 
                               nso007_funds_transaction.id,
                               nso007_funds_transaction.operation_type,
                               nso007_funds_transaction.balance,
                               nso007_funds_transaction.request_date,
                               nso007_funds_transaction.app_rej_date,
                               nso007_funds_transaction.account_number,
                               nso007_funds_transaction.amount,
                               nso007_funds_transaction.remark,
                               nso007_funds_transaction.status,
                               nso007_funds_transaction.transaction_code,
                               nso007_funds_transaction.created_at,
                               nso007_funds_transaction.updated_at
                               FROM nso007_funds_transaction 
                               
            WHERE (
                    (account_number =  $account_number AND operation_type = 4)
                    OR (account_number =  $account_number AND operation_type = 5)
                )
                OR (
                    (account_number =  $account_number AND operation_type = 1)
                    OR (account_number =  $account_number AND operation_type = 1)
                )
                OR (
                    (account_number =  $account_number AND operation_type = 6)
                )
                OR (
                    (account_number = $account_number AND operation_type = 2)
                )
                OR (
                    (account_number = $account_number AND operation_type = 3)
                )
                OR (
                    (account_number = $account_number AND operation_type = 7)
                )
            ORDER BY id ASC
        ");
        $branch = BranchModel::where('id', \Branch::branch_id())->first();

        return view('agencies.funds-transaction.report-view-print', compact('data', 'branch'));
    }
    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function send_funds()
    {
        $user_id = Auth::user()->id;
        $data = FundsRegisterModel::where('user_id', $user_id)->get();
        return view('agencies.funds-transaction.send', compact('data'));
    }

    public function add_funds($agency_id = null)
    {
//        $bank_data = BankModel::select('id', 'name', 'cash_flow_type')
//            ->where('status', 1)
//            ->orderBy('id', 'DESC')
//            ->pluck('name', 'id')
//            ->prepend('Please Select', '');
//        $bank_account = BankAccountModel::select(DB::raw('group_concat(bank_id) as bank'))->where('agency_id', Auth::user()->id)->first();
//        $bank_list = BankAgencyModel::whereIn('id', explode(',', $bank_account->bank))->pluck('name', 'id')->prepend('Please Select', '');
        if (empty($agency_id)) $user_id = Auth::user()->id;//sokrann
        else $user_id = $agency_id;
        $funds_account = FundsRegisterModel::where('user_id', $user_id)->get();

        if (empty($funds_account) || count($funds_account) <= 0) return \back()->with("danger", "This agency doesn't have account fund.");//sokrann

        return view('agencies.funds-transaction.create', compact('funds_account'), ['agency_id' => $user_id]);
    }


    public function withdraw_funds()
    {

        $user_id = Auth::user()->id;

        $funds_account = FundsRegisterModel::where('user_id', $user_id)->get();
        $bank_account  = DB::table('nso007_bank_agency AS bank')
            ->join('nso007_bank_account as account', 'account.bank_id', 'bank.id')
            ->where('account.agency_id', Auth::user()->id)
            ->pluck('bank.name', 'bank.id')
            ->prepend('Please Select', '');
        return view('agencies.funds-transaction.funds-withdraw', compact('funds_account', 'bank_account'));
    }
    public function getBankAccount($id)
    {
        // dd($id,Auth::user()->id);
        $account = BankAccountModel::where([['bank_id', $id], ['agency_id', Auth::user()->id]])->first();
        return response()->json(['data' => $account, 'status' => 200]);
    }
    public function get_accountname(Request $request)
    {
        $search_code    = $request->get('term', '');
        $user_log       = Auth::user()->id;
        $log_account    = FundsRegisterModel::where('user_id', $user_log)->select('account_number')->first();
        $gets = FundsRegisterModel::where('account_number', $search_code)->whereNotIn('account_number', $log_account)->get();
        $data = array();
        foreach ($gets as $g) {
            $data[] = array(
                'account_name' => $g->account_name,
            );
        }
        if (count($data))
            return $data;
        else
            return ['value' => 'no-result', 'id' => ''];
    }

    public function send_funds_store(Request $request)
    {
        $this->validate($request, [
            'from_account'  => 'required',
            'account_name'  => 'required',
            'avaible_amount'  => 'required|numeric',
            'amount'  => 'required|numeric',
            'password'  => 'required',
            'account_number'  => 'required',
            'to_account'   => 'required',
            'to_account_name'    => 'required',
            'amount'    => 'required',
        ]);
        // $user_id = Auth::user()->id;
        // $account_number = FundsRegisterModel::where('user_id', $user_id)->select('account_number')->first();
        // if($account_number->account_number == $request->to_account){
        //     \LogActivity::addToLog('Information not corrrected !');
        //     return back()->with('danger','Information not corrrected !');
        // }else{
        $confirm_accounts = FundsRegisterModel::where("account_number", $request->account_number)->get();
        $confirm_number = isset($confirm_accounts[0]->account_number);
        $increas = 'TS-' . date('YmdHis');
        if ($confirm_number >= 1 && $request->avaible_amount > $request->amount) {

            $confirm_password = $confirm_accounts[0]->password;
            $decrypt_password = $confirm_password;
            if ($decrypt_password == $request->password) {

                FundsRegisterModel::where('account_number', $request->from_account)->decrement('balance', $request->amount);
                FundsRegisterModel::where('account_number', $request->to_account)->increment('balance', $request->amount);
                FundsRegisterModel::where('account_number', $request->to_account)->increment('received​_balance', $request->amount);

                $sender_balance = FundsRegisterModel::where('account_number', $request->from_account)
                    ->first()->balance;
                $receiver_balance = FundsRegisterModel::where('account_number', $request->to_account)
                    ->first()->balance;

                $trans = new FundsTransactionModel;
                $trans->operation_type  = 4;
                $trans->account_number  = $request->from_account;
                $trans->amount          = $request->amount;
                $trans->balance         = $sender_balance;
                $trans->transaction_code = $increas;
                $trans->remark          = "You was transferred to " . $request->to_account_name . "(" . $request->to_account . ") / (" . $request->remark . ")";
                $trans->request_date    = date('Y-m-d H:i:s A');
                $trans->user_log        = Auth::user()->id;
                $trans->status          = 1;
                $trans->save();

                $trans = new FundsTransactionModel;
                $trans->operation_type  = 5;
                $trans->account_number  = $request->to_account;
                $trans->amount          = $request->amount;
                $trans->balance         = $receiver_balance;
                $trans->transaction_code = $increas;
                $trans->remark          = "You was received from " . $request->account_name . " (" . $request->from_account . ")";
                $trans->request_date    = date('Y-m-d H:i:s A');
                $trans->user_log        = Auth::user()->id;
                $trans->status          = 1;
                $trans->save();
                \LogActivity::addToLog('You have transferred successfully!');
                return back()->with('success', 'You have transferred successfully!');
            } else {
                \LogActivity::addToLog('Information not corrected !');
                return back()->with('danger', 'Information not corrected !');
            }
        } else {
            \LogActivity::addToLog('Information not corrrected !');
            return back()->with('danger', 'Information not corrrected !');
        }
        \LogActivity::addToLog('You have transferred successfully!');
        return redirect()->route('funds-transaction.index')
            ->with('success', 'You have transferred successfully!');
        // }
    }

    /**
     *  Store funds deposit
     */
    public function add_funds_store(Request $request, FundsTransactionModel $user)
    {
        $rules = [
            'amount'       => 'required|numeric',
            'avaible_amount'       => 'required|numeric',
            'account_number'       => 'required',
            'password'       => 'required',
            'my_account'       => 'required',
            'account_name'       => 'required',
            'image' =>  'image|max:2048|mimes:jpeg,jpg,png,JPG,PNG'
        ];
        $customMessages = [
            'image.max' => 'Maximum file size to upload is 2MB'
        ];

        $this->validate($request, $rules, $customMessages);
        $increas = 'TS-' . date('YmdHis');

        $user_id = Auth::user()->id;
        // my_account = account_number
        $add_funds = new FundsTransactionModel;
        $confirm_accounts = FundsRegisterModel::where("user_id", $user_id)->first();
        $confirm_number = isset($confirm_accounts->account_number);
        if ($confirm_number >= 1) {
            $confirm_password = $confirm_accounts->password;
            $decrypt_password = $confirm_password;
            if ($decrypt_password == $request->password) {

                $ArrayStoreImage = array();
                if ($request->hasFile('image')) {
                    $file = $request->file('image');

                    $ArrayStoreImage = Fun::uploadImage($file, [

                        [300, 300, 'assets/images/resize/300x300'],
                        [768, 768, 'assets/images/resize/768x768'],

                    ]);
                } else {
                    $ArrayStoreImage = " ";
                }

                $fileImage = Fun::convertToStringSingle($ArrayStoreImage);

                $add_funds->add_funds_bank = $request->bank_id;
                $add_funds->operation_type = 1;
                $add_funds->account_number = $request->my_account;
                $add_funds->amount = $request->amount;
                $add_funds->remark = $request->remark;
                $add_funds->reference = $fileImage;
                $add_funds->request_date    = date('Y-m-d H:i:s A');
                $add_funds->balance = $request->avaible_amount;
                $add_funds->transaction_code = $increas;
                $add_funds->user_log = $user_id;
                $add_funds->status = 0;

                $add_funds->save();


                date_default_timezone_set('Asia/Bangkok');

                /*Select Agency Information When Admin Add Fund (sokrann)*/
                if (!empty($request->agency_id)) {
                    $agency_data = DB::table('users')->where("id", $request->agency_id)->first();
                    if (!empty($agency_data))
                        $data = array(
                            'user_code' => $agency_data->user_code,
                            'user_name' => $agency_data->user_firstname . ' ' . $agency_data->user_lastname,
                            'remark' => $request->remark,
                            'amount' => $request->amount,
                            'to_account' => $request->my_account,
                            'email' => $agency_data->email,
                            'account_name' => $confirm_accounts->account_name,
                            'created_at' => date('Y-m-d H:i:s A')
                        );
                    else {

                        \LogActivity::addToLog('Whoops! There were some problems with your input.');
                        return back()->with('danger', 'Whoops! There were some problems with your input.');
                    }
                } else /*End*/
                    $data = array(
                        'user_code' => Auth::user()->user_code,
                        'user_name' => Auth::user()->user_firstname . ' ' . Auth::user()->user_lastname,
                        'remark' => $request->remark,
                        'amount' => $request->amount,
                        'to_account' => $request->my_account,
                        'email' => Auth::user()->email,
                        'account_name' => $confirm_accounts->account_name,
                        'created_at' => date('Y-m-d H:i:s A')
                    );

                Mail::send(
                    'agencies.funds-transaction.mail-add-fund',
                    compact('request', 'user', 'data'),
                    function ($message) use ($request, $user, $data) {
                        $message->to('nso.webteam.info@gmail.com', 'Tutorials Point');
                        $message->cc('nso.webteam.info@gmail.com', 'Mr. Example');
                        $message->bcc('nso.webteam.info@gmail.com', 'Mr. Example');
                        $message->replyTo('nso.webteam.info@gmail.com', 'Mr. Example');
                        $message->priority(2);
                        $message->subject('Request Deposit');
                        $message->to('nso.webteam.info@gmail.com');
                        $message->subject('Add Funds');
                    }
                );

                DB::commit();
                \LogActivity::addToLog('You have requested successfully!');
                return redirect()->route('funds-register.index')->with('success', 'You have requested successfully!');
            } else {
                \LogActivity::addToLog('Whoops! There were some problems with your input.');
                return back()->with('danger', 'Whoops! There were some problems with your input.');
            }
        } else {
            \LogActivity::addToLog('Whoops! There were some problems with your input.');
            return back()->with('danger', 'Whoops! There were some problems with your input.');
        }
    }

    /**
     *  Store funds withdraw
     */

    public function withdraw_funds_store(Request $request)
    {
        $this->validate($request, [
            'my_account'        => 'required',
            'account_name'      => 'required',
            'avaible_amount'    => 'required|numeric',
            'amount'            => 'required|numeric',
            'account_number'    => 'required',
            'password'          => 'required',
            'bank_id'           => 'required'
        ]);

        $user_id = Auth::user()->id;

        $find_agency = FundsRegisterModel::where('user_id', $user_id)->first();
        $bank_account_number = $find_agency->account_number;
        $bank_account_name  = $find_agency->account_name;

        $add_funds = new FundsTransactionModel;
        $increas = 'TS-' . date('YmdHis');
        $confirm_accounts = FundsRegisterModel::where("account_number", $request->account_number)->get();
        $confirm_number = isset($confirm_accounts[0]->account_number);

        if ($confirm_number >= 1 &&  $request->avaible_amount >= $request->amount) {
            $confirm_password = $confirm_accounts[0]->password;
            $decrypt_password = $confirm_password;
            if ($decrypt_password == $request->password) {
                DB::table('nso007_funds')->where('account_number', $request->account_number)->decrement('balance', $request->amount);
                $balance                        = $request->avaible_amount - $request->amount;
                $balance                        = FundsRegisterModel::where('account_number', $request->account_number)->first()->balance;
                $add_funds->operation_type      = 6;
                $add_funds->account_number      = $request->my_account;
                $add_funds->amount              = $request->amount;
                $add_funds->remark              = $request->remark;
                $add_funds->balance             = $balance;
                $add_funds->user_log            = $user_id;
                $add_funds->status              = 0;
                $add_funds->transaction_code    = $increas;
                $add_funds->request_date        = date('Y-m-d H:i:s A');

                $add_funds->bank_id             = $request;
                $add_funds->bank_account_number = $request->bank_account;
                $add_funds->bank_account_name   = $request->accountbank_name;
                $add_funds->bank_id             = $request->bank_id;
                $add_funds->bank_account        = BankAccountModel::where([['bank_id', $request->bank_id], ['agency_id', Auth::user()->id]])->first()->account_number;
                $add_funds->save();

                \LogActivity::addToLog('You have requested successfully.');
                return back()->with('success', 'You have requested successfully.');
            } else {
                \LogActivity::addToLog('Information not conrrected !');
                return back()->with('danger', 'Information not conrrected !');
            }
        } else {
            \LogActivity::addToLog('Information not conrrected !');
            return back()->with('danger', 'Information not conrrected !');
        }
    }

    /**
     *
     *  Get add funds requested
     *
     */

    public function add_funds_request()
    {
        return view('administrator.funds-transaction.index');
    }

    public function datatable_get_funds_request_add()
    {
        $transac = FundsTransactionModel::with(['get_users'])
            ->where('operation_type', 1)
            ->get();

        return Datatables::of($transac)
            ->addColumn('status', function ($transac) {
                if ($transac->status == 1) {
                    return ' <strong class="text-success"><span class="fa fa-check"></span> Approved</strong>
                    ';
                } elseif ($transac->status == 2) {
                    return ' <strong class="text-danger"><span class="fa fa-close"></span> Rejected</strong>
                    ';
                } else {
                    return ' 
                    <a href="#" class="viewPopLinkApprove" role="button" data-toggle="modal tooltip" data-target="#popUpApprove" data-placement="top" data-id="' . $transac->id . '" data-amount="' . $transac->amount . '" data-to_account="' . $transac->account_number . '"><strong class=" text-primary"><span class="fa fa-check"></span> Approve</strong></a>
                    <a href="#" class="viewPopLinkReject" role="button" data-toggle="modal tooltip" data-target="#popUpReject" data-placement="top" data-id="' . $transac->id . '"><strong class=" text-danger"><span class="fa fa-close"></span> Reject</strong></a>
                    ';
                }
            })
            ->addColumn('created_at', function ($transac) {
                return date_format($transac->created_at, "d-m-Y");
            })
            ->addColumn('operation_type', function ($transac) {
                switch ($transac->operation_type) {
                    case '1':
                        return 'Add Funds';
                        break;
                    case '2':
                        return 'Payment';
                        break;
                    case '3':
                        return 'Revenue';
                        break;
                    case '4':
                        return 'Send Funds';
                        break;
                    case '5':
                        return 'Received Funds';
                        break;
                    case '6':
                        return 'Withdraw Funds';
                        break;
                    case '7':
                        return 'Refund';
                        break;
                }
            })
            ->addColumn('from_account', function ($transac) {
                return $transac['get_users']->user_firstname . ' ' . $transac['get_users']->user_lastname;
            })
            ->addColumn('amount', function ($transac) {
                return '$ ' . number_format($transac->amount, 2);
            })
            ->addColumn('reference', function ($transac) {
                return $transac->reference;
            })
            ->rawColumns(['status' => 'status'])
            ->make(true);
    }

    /**
     *
     *  Approve _funds_request_add
     *
     */
    public function approve_funds_request_add($id, $amount, $to_account)
    {
        DB::table('nso007_funds')->where('account_number', $to_account)->increment('balance', $amount);
        $get_balance = FundsRegisterModel::select('balance')
            ->where('account_number', $to_account)
            ->get();

        $add_funds = FundsTransactionModel::find($id);
        $add_funds->status = 1;
        $add_funds->balance = $get_balance[0]->balance;
        $add_funds->update();

        return redirect()->route('requested.add_funds')
            ->with('success', 'You have approved successfully!');
    }
    /**
     *
     *  Reject _funds_request_add
     *
     */
    public function reject_funds_request_add($id)
    {
        FundsTransactionModel::where('id', $id)->update(array('status' => 2));

        return redirect()->route('requested.add_funds')
            ->with('success', 'You have rejected successfully!');
    }

    /**
     *
     *  Get account funds requested
     *
     */

    public function account_funds_request()
    {
        return view('administrator.funds-transaction.register');
    }

    public function datatable_get_funds_request_account()
    {
        $acc_funds = FundsRegisterModel::all();
        return Datatables::of($acc_funds)
            ->addColumn('status', function ($acc_funds) {
                if ($acc_funds->status == 1) {
                    return ' <strong class="text-success"><span class="fa fa-check"></span> Approved</strong>
                    <a href="#" class="viewPopUpReject" role="button" data-toggle="modal tooltip" data-target="#popUpReject" data-placement="top" data-id="' . $acc_funds->id . '"><strong class="text-danger"><span class="fa fa-close"></span> Reject</strong></a>
                    ';
                } elseif ($acc_funds->status == 2) {
                    return ' 
                    <strong class="text-danger"><span class="fa fa-close"></span> Rejected</strong>
                    <a href="#" class="viewPopUpApprove" role="button" data-toggle="modal tooltip" data-target="#popUpApprove" data-placement="top" data-id="' . $acc_funds->id . '"><strong class="text-info"><span class="fa fa-check"></span> Approve</strong></a>
                    ';
                }
            })
            ->addColumn('action', function ($acc_funds) {
                return '
                    <a href="#" class="viewPopUpApprove" role="button" data-toggle="modal tooltip" data-target="#popUpApprove" data-placement="top" data-id="' . $acc_funds->id . '"><strong class="text-info"><span class="fa fa-check"></span> Approve</strong></a>
                    ';
            })

            ->addColumn('created_at', function ($acc_funds) {
                return date_format($acc_funds->created_at, "d-m-Y");
            })
            ->rawColumns(['status' => 'status', 'action' => 'action', 'balance' => 'balance'])
            ->make(true);
    }
    /**
     *
     *  Approve Funds Register
     *
     */
    public function approve_funds_register($id)
    {
        $funds_regis = FundsRegisterModel::find($id);
        $funds_regis->status = 1;
        $funds_regis->update();

        return redirect()->route('requested.account_funds')
            ->with('success', 'You have approved successfully!');
    }
    /**
     *
     *  Reject Funds Register
     *
     */
    public function reject_funds_register($id)
    {
        $funds_regis = FundsRegisterModel::find($id);
        $funds_regis->status = 2;
        $funds_regis->update();

        return redirect()->route('requested.account_funds')
            ->with('success', 'You have rejected successfully!');
    }
}
