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

namespace App\Http\Controllers\Admin;

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

class PaymentGatewayCurrencyController extends Controller
{
    public function paymentGatewayCurrencyRemove(Request $request) {
        $validator = Validator::make($request->all(),[
            'data_target'       => 'required|numeric',
        ]);

        if($validator->stopOnFirstFailure()->fails()) {
            return Response::error($validator->errors());
        }

        $validated = $validator->validate();

        // find terget Item
        $gateway_currency = PaymentGatewayCurrency::find($validated['data_target']);
        if(!$gateway_currency) {
            $error = ['error' => ['Payment gateway currency not found!']];
            return Response::error($error,null,404);
        }

        try{
            if($gateway_currency->image != null) {
                $image_link     = get_files_path('payment-gateways') . "/" . $gateway_currency->image;
                delete_file($image_link);
            }
            $gateway_currency->delete();
        }catch(Exception $e) {
            $error = ['error' => ['Something went worng! Please try again.']];
            return Response::error($error,null,500);
        }

        $success = ['success' => ['Payment gateway currency deleted successfully!']];
        return Response::success($success);

    }

    
}
Contact
top

Get in Touch with Us for Any Questions or Support

We’d love to hear from you! Whether you have questions, feedback, or need support, our team is here to help. Reach out to us via email, phone, or visit our office. We’re committed to providing you with exceptional service and ensuring your experience with NFC Pay is seamless and satisfying. Let’s connect!

icon

Our Location

20-22 Wenlock Road, England, N1 7GU
icon

Call us on: +03601 885399

Our office hours Monday–Friday, 9am - 9pm
icon

Email us directly

support@example.com