/home/kueuepay/public_html/app/Http/Controllers/Admin/CardMethodGatewayController.php
<?php
namespace App\Http\Controllers\Admin;
use Exception;
use Illuminate\Http\Request;
use App\Http\Helpers\Response;
use App\Http\Controllers\Controller;
use App\Models\Admin\CardMethodGateway;
use Illuminate\Support\Facades\Validator;
class CardMethodGatewayController extends Controller
{
/**
* Method for view the card method gateway page
* @return view
*/
public function index(){
$page_title = "Card Method Gateway";
$card_methods = CardMethodGateway::orderBy('id','desc')->get();
return view('admin.sections.card-method-gateway.index',compact(
'page_title',
'card_methods'
));
}
/**
* Method for view edit card method gateway page
* @return view $slug
* @param \Illuminate\Http\Request $request
*/
public function edit($slug){
$page_title = "Card Method Gateway Edit";
$data = CardMethodGateway::where('slug',$slug)->first();
if(!$data) return back()->with(['error' => ['Sorry! Data not found.']]);
return view('admin.sections.card-method-gateway.edit',compact(
'page_title',
'data'
));
}
/**
* Method for update send money gateway information
* @param $slug
* @param \Illuminate\Http\Request $request
*/
public function update(Request $request,$slug){
$data = CardMethodGateway::where('slug',$slug)->first();
if(!$data) return back()->with(['error' => ['Sorry! Data not found.']]);
$validator = Validator::make($request->all(),[
'slug' => 'required',
'name' => 'required',
'publishable_key' => 'required',
'secret_key' => 'required',
'image' => "nullable|mimes:png,jpg,jpeg,webp",
]);
if($validator->fails()) return back()->withErrors($validator)->withInput($request->all());
$update_data = array_filter($request->except('_token','image','slug','name','fileholder-image','_method','env'));
$data->name = $request->name;
$image = $data->image;
if($request->hasFile('image')) {
$image = get_files_from_fileholder($request,'image');
$upload_image = upload_files_from_path_dynamic($image,'send-money-gateway',$data->image);
$image = $upload_image;
}
$data->credentials = $update_data;
$data->update([
'credentials' => $update_data,
'image' => $image,
]);
return redirect()->route('admin.card.method.gateway.index')->with(['success' => ['Card Method Gateway Updated Successfully.']]);
}
/**
* Method for status update for Outside wallet
* @param string
* @param \Illuminate\Http\Request $request
*/
public function statusUpdate(Request $request) {
$validator = Validator::make($request->all(),[
'data_target' => 'required|numeric|exists:card_method_gateways,id',
'status' => 'required|boolean',
]);
if($validator->fails()) {
$errors = ['error' => $validator->errors() ];
return Response::error($errors);
}
$validated = $validator->validate();
$send_money = CardMethodGateway::find($validated['data_target']);
try{
$send_money->update([
'status' => ($validated['status']) ? false : true,
]);
}catch(Exception $e) {
$errors = ['error' => ['Something went wrong! Please try again.'] ];
return Response::error($errors,null,500);
}
$success = ['success' => [__('Card Method Gateway status updated successfully!')]];
return Response::success($success);
}
}
Run Command [Bypass]
Run Command
User Login
top
In the digital age, privacy concerns have become increasingly paramount, prompting the European Union to enact the General Data Protection Regulation (GDPR) in 2018. Among its many provisions, GDPR sets strict guidelines for the collection and processing of personal data, including the use of cookies on websites. Privacy Policy
Allow
Decline