IMMREX7

aku nok ndi : /home/spdtg/www/schoolmis/app/Http/Controllers/
File Up :
aku nok ndi : /home/spdtg/www/schoolmis/app/Http/Controllers/PaymentLinkController.php

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use DB;
use Carbon\Carbon;
use Session;
use App\Http\SendSmsApi;
use PDF;

class PaymentLinkController extends Controller {


    function specialChars($str) {
        return preg_match('/[^a-zA-Z0-9-]/', $str) > 0;
    }
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index($id) {
        if ($this->specialChars($id)){
            return view('onlinereg.error-links');
        } 
        $order =  DB::table('order_receipts')->where('payment_id',$id)->first();
        if ($order == null){
            return view('onlinereg.error-links');
        } 
        $school = \App\School::where('idSchool', '=', $order->idSchool)->first();
        $paymentDate = Carbon::now()->format('d-m-Y');
        $financialYear =  \App\FinancialYear::where('idFinancialYear', '=', $order->idFinancialYear)->first();
        $student =  \App\AdmEntry::where('idStudent', '=', $order->idStudent)->first();
        $keyService = DB::table('pg_keys')->where('purpose',$order->purpose)->where('idSchool',$order->idSchool)->first();
        return view('onlinereg.payment-links',compact('school','order','financialYear','student','paymentDate','keyService'));
    }

    public function fetchPayments($id){
        if ($this->specialChars($id)){
            return view('onlinereg.error-links');
        } 
        $order =  DB::table('student_payment_session')->where('uhid',$id)->first();
        if ($order == null){
            return view('onlinereg.error-links');
        } 
        $school = \App\School::where('idSchool', '=', $order->idSchool)->first();
        $student =  \App\AdmEntry::where('idStudent', '=', $order->idStudent)->first();
        $paymentDate = Carbon::now()->format('d-m-Y');
        $financialYear =  \App\FinancialYear::where('idFinancialYear', '=', $student->idFinancialYear)->first();
        return view('onlinereg.payment-overview',compact('school','order','financialYear','student','paymentDate'));
    }

    /**
     * Display the specified resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function show() {
        return view('onlinereg.payment-success');
    }

    public function validatePayment(Request $request) {
        if($request->get("order_id") != null){
            $orderInfo = DB::table('order_receipts')->where('idOrder', $request->get('order_id'))->first();
            if($orderInfo->isSaved == 'Y')  return response()->json(['message' => 'Payment Done']);
            DB::table('order_receipts')->where('idOrder', $request->get('order_id'))->update(['isSaved'=>'Y']);
            $response = Cashfree::verifyEasebuzzTransaction($orderInfo);
            if ($response->status == "success") {                
                return response()->json(['message' => 'Payment Done']);
            }
        }
        else{
            return response()->json(['message' => 'Failed to verify your payment.']);
        }
    }

}

Copyright © 2021 - 2025 IMMREX7