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

namespace App\Http\Controllers\Admin;

use App\Http\Controllers\Controller;
use App\Providers\Admin\BasicSettingsProvider;
use Exception;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;

class BroadcastingController extends Controller
{

    public function configUpdate(Request $request) {
        $validator = Validator::make($request->all(),[
            'broadcast_method'      => 'required|string|in:pusher',

            'broadcast_app_id'      => 'required_if:broadcast_method,pusher|string|max:255',
            'broadcast_primary_key' => 'required_if:broadcast_method,pusher|string|max:255',
            'broadcast_secret_key'  => 'required_if:broadcast_method,pusher|string|max:255',
            'broadcast_cluster'     => 'required_if:broadcast_method,pusher|string|max:50',
        ]);

        $validated = $validator->validate();

        $validated = replace_array_key($validated,"broadcast_");

        $basic_setting = BasicSettingsProvider::get();

        try{
            $basic_setting->update([
                'broadcast_config'  => $validated,
            ]);

            modifyEnv([
                "BROADCAST_DRIVER"      => remove_spaces($validated['method']),
                "PUSHER_APP_ID"         => remove_spaces($validated['app_id']),
                "PUSHER_APP_KEY"        => remove_spaces($validated['primary_key']),
                "PUSHER_APP_SECRET"     => remove_spaces($validated['secret_key']),
                "PUSHER_APP_CLUSTER"    => remove_spaces($validated['cluster']),
            ]);
        }catch(Exception $e) {  
            return back()->with(['error' => ['Something went worng! Please try again.']]);
        }

        return back()->with(['success' => ['Broadcast configuration updated successfully!']]);

    }

    
}
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