/home/kueuepay/public_html/app/Http/Controllers/Admin/ExtensionsController.php
<?php

namespace App\Http\Controllers\Admin;

use Exception;
use Illuminate\Http\Request;
use App\Models\Admin\Extension;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Validator;
use App\Http\Helpers\Response;


class ExtensionsController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        $page_title = "Extensions";
        $extensions = Extension::orderBy('id', 'desc')->paginate(8);
        return view('admin.sections.extensions.index', compact(
            'page_title',
            'extensions',
        ));
    }

    public function update(Request $request, $id)
    {
        $extension = Extension::findOrFail($id);
        $validation_rule = [];
        foreach ($extension->shortcode as $key => $val) {
            $validation_rule[$key] = "required";
        }

        $request->validate($validation_rule);
        $shortcode = json_decode(json_encode($extension->shortcode), true);
        foreach ($shortcode as $key => $code) {
            $shortcode[$key]['value'] = $request->$key;
        }
        $extension->shortcode = $shortcode;
        $extension->update();
        return back()->with(['success' => ['Extension has been udpate successfully']]);
    }


    public function statusUpdate(Request $request)
    {

        $validator = Validator::make($request->all(), [
            'status'                    => 'required|boolean',
            'data_target'               => 'required|string',
        ]);
        if ($validator->stopOnFirstFailure()->fails()) {
            $error = ['error' => $validator->errors()];
            return Response::error($error,null,400);
        }
        $validated = $validator->validate();
        $item_id = $validated['data_target'];

        $extension = Extension::find($item_id);
        if (!$extension) {
            $error = ['error' => [__('Extension is not found!')]];
            return Response::error($error,null,404);
        }

        try {
            $extension->update([
                'status' => ($validated['status'] == true) ? false : true,
            ]);
        } catch (Exception $e) {
            $error = ['error' => ['Something went worng!. Please try again.']];
            return Response::error($error,null,500);
        }

        $success = ['success' => [__('Extension status is updated successfully!')]];
        return Response::success($success,null,200);
    }
}
Payment System
top

Simple Steps to Complete Your Payment Securely and Efficiently

Making a payment on our website is quick and secure. Start by logging in or creating an account. Select your preferred payment method, input the required details, and review the information. Once you confirm everything is correct, click on the "Submit Payment" button. You’ll receive instant confirmation and can track your payment status through your account dashboard. It’s an easy and secure process.

  • Go to the Payment Section: Access the payment area on our website or app.
  • Choose Your Payment Method: Select your preferred payment option.
  • Enter Payment Details: Provide the necessary payment information.
  • Verify Your Information: Check that all details are correct.
  • Confirm Your Payment: Click "Submit Payment" to complete the transaction.
img