⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.142
Server IP:
217.76.53.76
Server:
Linux vmi1397931.contaboserver.net 5.4.0-105-generic #119-Ubuntu SMP Mon Mar 7 18:49:24 UTC 2022 x86_64
Server Software:
Apache
PHP Version:
8.2.27
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
www
/
wwwroot
/
softpos.com.ng
/
app
/
Http
/
Controllers
/
View File Name :
PlanRequestController.php
isSuperAdmin()) { $plan_requests = PlanRequest::all(); return view('plan_request.index', compact('plan_requests')); } else { return redirect()->back()->with('error', __('Permission Denied.')); } } /* *@plan_id = Plan ID encoded */ public function requestView($plan_id) { if (Auth::user()->type != 'super admin') { $planID = \Illuminate\Support\Facades\Crypt::decrypt($plan_id); $plan = Plan::find($planID); if (!empty($plan)) { return view('plan_request.show', compact('plan')); } else { return redirect()->back()->with('error', __('Something went wrong.')); } } else { return redirect()->back()->with('error', __('Permission Denied.')); } } /* * @plan_id = Plan ID encoded * @duration = what duration is selected by user while request */ public function userRequest($plan_id) { $objUser = Auth::user(); if ($objUser->plan_requests == 0) { $planID = \Illuminate\Support\Facades\Crypt::decrypt($plan_id); if (!empty($planID)) { PlanRequest::create( [ 'user_id' => $objUser->id, 'plan_id' => $planID, ] ); // Update User Table $data = User::find($objUser->id); $data->plan_requests = $planID; $data->update(); return redirect()->back()->with('success', __('Request Send Successfully.')); } else { return redirect()->back()->with('error', __('Something went wrong.')); } } else { return redirect()->back()->with('error', __('You already send request to another plan.')); } } /* * @id = Project ID * @response = 1(accept) or 0(reject) */ public function acceptRequest($id, $response) { if (Auth::user()->isSuperAdmin()) { $plan_request = PlanRequest::find($id); if (!empty($plan_request)) { $user = User::find($plan_request->user_id); if ($response == 1) { $user->plan_requests = '0'; $user->plan_id = $plan_request->plan_id; $user->save(); $plan = Plan::find($plan_request->plan_id); $assignPlan = $user->assignPlan($plan_request->plan_id, $plan_request->duration); $price = $plan->price; if ($assignPlan['is_success'] == true && !empty($plan)) { if (!empty($user->payment_subscription_id) && $user->payment_subscription_id != '') { try { $user->cancel_subscription($user->id); } catch (\Exception $exception) { \Log::debug($exception->getMessage()); } } $orderID = strtoupper(str_replace('.', '', uniqid('', true))); Order::create( [ 'order_id' => $orderID, 'name' => null, 'email' => null, 'card_number' => null, 'card_exp_month' => null, 'card_exp_year' => null, 'plan_name' => $plan->name, 'plan_id' => $plan->id, 'price' => $price, 'price_currency' => !empty(env('CURRENCY_CODE')) ? env('CURRENCY_CODE') : 'usd', 'txn_id' => '', 'payment_type' => __('Manually Upgrade By Super Admin'), 'payment_status' => 'succeeded', 'receipt' => null, 'user_id' => $user->id, ] ); $plan_request->delete(); return redirect()->back()->with('success', __('Plan successfully upgraded.')); } else { return redirect()->back()->with('error', __('Plan fail to upgrade.')); } } else { // $user->update(['plan_requests' => '0']); $user['plan_requests'] = '0'; $user->update(); $plan_request->delete(); return redirect()->back()->with('success', __('Request Rejected Successfully.')); } } else { return redirect()->back()->with('error', __('Something went wrong.')); } } else { return redirect()->back()->with('error', __('Permission Denied.')); } } /* * @id = User ID */ public function cancelRequest($id) { $user = User::find($id); $user['plan_requests'] = 0; $user->update(); PlanRequest::where('user_id', $id)->delete(); return redirect()->back()->with('success', __('Request Canceled Successfully.')); } }