Файловый менеджер - Редактировать - /home/c7lekhnath/silverray.com.au/Modules/Language/database/seeders/68334/Subscription.tar
Назад
lang/.gitkeep 0000644 00000000000 15012227353 0007104 0 ustar 00 module.json 0000644 00000000362 15012227353 0006725 0 ustar 00 { "name": "Subscription", "alias": "subscription", "description": "", "keywords": [], "priority": 0, "providers": [ "Modules\\Subscription\\app\\Providers\\SubscriptionServiceProvider" ], "files": [] } tests/Unit/.gitkeep 0000644 00000000000 15012227353 0010244 0 ustar 00 tests/Feature/.gitkeep 0000644 00000000000 15012227353 0010720 0 ustar 00 vite.config.js 0000644 00000001316 15012227353 0007316 0 ustar 00 import { defineConfig } from 'vite'; import laravel from 'laravel-vite-plugin'; export default defineConfig({ build: { outDir: '../../public/build-subscription', emptyOutDir: true, manifest: true, }, plugins: [ laravel({ publicDirectory: '../../public', buildDirectory: 'build-subscription', input: [ __dirname + '/resources/assets/sass/app.scss', __dirname + '/resources/assets/js/app.js' ], refresh: true, }), ], }); //export const paths = [ // 'Modules/$STUDLY_NAME$/resources/assets/sass/app.scss', // 'Modules/$STUDLY_NAME$/resources/assets/js/app.js', //]; wsus.json 0000644 00000000633 15012227353 0006442 0 ustar 00 { "name": "Subscription Addon", "is_default": true, "description": "This is Subscription Addon", "author": { "name": "Websolutionsus", "email": "websolutionus1@gmail.com", "website": "https://websolutionus.com" }, "license": "Proprietary", "url": "", "options" : { "route" : "home" }, "last_update": "2024-03-31", "version": "1.0.0" } routes/.gitkeep 0000644 00000000000 15012227353 0007504 0 ustar 00 routes/error_log 0000644 00000001126 15012227353 0010002 0 ustar 00 [07-May-2025 17:12:57 UTC] PHP Fatal error: Uncaught Error: Class "Illuminate\Support\Facades\Route" not found in /home/lekhnath/silverray.com.au/Modules/Subscription/routes/web.php:10 Stack trace: #0 {main} thrown in /home/lekhnath/silverray.com.au/Modules/Subscription/routes/web.php on line 10 [07-May-2025 21:52:29 UTC] PHP Fatal error: Uncaught Error: Class "Illuminate\Support\Facades\Route" not found in /home/lekhnath/silverray.com.au/Modules/Subscription/routes/api.php:5 Stack trace: #0 {main} thrown in /home/lekhnath/silverray.com.au/Modules/Subscription/routes/api.php on line 5 routes/web.php 0000644 00000007327 15012227353 0007364 0 ustar 00 <?php use Illuminate\Support\Facades\Route; use Modules\Subscription\app\Http\Controllers\PaymentController; use Modules\BasicPayment\app\Http\Controllers\FrontPaymentController; use Modules\Subscription\app\Http\Controllers\SubscriptionController; use Modules\Subscription\app\Http\Controllers\Admin\PurchaseController; use Modules\Subscription\app\Http\Controllers\Admin\SubscriptionPlanController; Route::group(['as' => 'admin.', 'prefix' => 'admin', 'middleware' => ['auth:admin', 'translation']], function () { Route::resource('subscription-plan', SubscriptionPlanController::class)->names('subscription-plan'); Route::controller(PurchaseController::class)->group(function () { Route::get('/plan-transaction-history', 'index')->name('plan-transaction-history'); Route::get('/pending-plan-transaction', 'pending_payment')->name('pending-plan-transaction'); Route::get('/subscription-history', 'subscription_history')->name('subscription-history'); Route::put('/plan-renew/{id}', 'plan_renew')->name('plan-renew'); Route::get('/assign-plan', 'create')->name('assign-plan'); Route::post('/store-assign-plan', 'store')->name('store-assign-plan'); Route::get('/purchase-history-show/{id}', 'show')->name('purchase-history-show'); Route::put('/approved-plan-payment/{id}', 'approved_plan_payment')->name('approved-plan-payment'); Route::delete('/delete-plan-payment/{id}', 'delete_plan_payment')->name('delete-plan-payment'); }); }); Route::group(['as' => 'subscription.', 'prefix' => 'subscription', 'middleware' => ['auth:web', 'translation', 'verified']], function () { Route::controller(PaymentController::class)->group(function () { Route::post('place-order/{method}', 'placeOrder')->name('place.order'); Route::get('/payment', 'index')->name('payment'); Route::post('pay-via-stripe/', 'stripe_pay')->name('pay-via-stripe'); Route::get('pay-via-stripe', 'stripe_success')->name('stripe-success'); Route::get('/pay-via-paypal', 'pay_via_paypal')->name('pay-via-paypal'); Route::get('paypal-success-payment', 'paypal_success')->name('paypal-success-payment'); Route::post('/pay-via-bank', 'pay_via_bank')->name('pay-via-bank'); Route::post('/pay-via-razorpay', 'pay_via_razorpay')->name('pay-via-razorpay'); Route::get('pay-via-mollie', 'pay_via_mollie')->name('pay-via-mollie'); Route::get('mollie-payment-success', 'mollie_payment_success')->name('mollie-payment-success'); Route::get('pay-via-instamojo', 'pay_via_instamojo')->name('pay-via-instamojo'); Route::get('instamojo-success', 'instamojo_success')->name('instamojo-success'); Route::post('pay-via-flutterwave', 'flutterwave_payment')->name('pay-via-flutterwave'); Route::get('pay-via-paystack', 'paystack_payment')->name('pay-via-paystack'); Route::get('/payment-addon-success', [PaymentController::class, 'payment_addon_success'])->name('payment-addon-success'); Route::get('/payment-addon-faild', [PaymentController::class, 'payment_addon_faild'])->name('payment-addon-faild'); }); Route::get('/pricing-plan', [SubscriptionController::class, 'index'] )->name('pricing.plan'); Route::get('purchase-package/{id}', [SubscriptionController::class, 'payment_page'] )->name('purchase.package'); Route::get('renew-package/{id}', [SubscriptionController::class, 'renewPackage'] )->name('renew.package'); Route::get( 'subscription-history', [SubscriptionController::class, 'subscription_history'] )->name( 'subscription-history' ); Route::get( 'show-subscription-history/{id}', [SubscriptionController::class, 'show_subscription_history'] )->name( 'show-subscription-history' ); }); routes/api.php 0000644 00000000214 15012227353 0007344 0 ustar 00 <?php use Illuminate\Support\Facades\Route; Route::middleware(['auth:sanctum'])->prefix('v1')->name('api.')->group(function () { }); composer.json 0000644 00000001333 15012227353 0007266 0 ustar 00 { "name": "nwidart/subscription", "description": "", "authors": [ { "name": "Nicolas Widart", "email": "n.widart@gmail.com" } ], "extra": { "laravel": { "providers": [], "aliases": { } } }, "autoload": { "psr-4": { "Modules\\Subscription\\": "", "Modules\\Subscription\\App\\": "app/", "Modules\\Subscription\\Database\\Factories\\": "database/factories/", "Modules\\Subscription\\Database\\Seeders\\": "database/seeders/" } }, "autoload-dev": { "psr-4": { "Modules\\Subscription\\Tests\\": "tests/" } } } config/config.php 0000644 00000000061 15012227353 0007764 0 ustar 00 <?php return [ 'name' => 'Subscription', ]; config/.gitkeep 0000644 00000000000 15012227353 0007430 0 ustar 00 package.json 0000644 00000000410 15012227353 0007025 0 ustar 00 { "private": true, "type": "module", "scripts": { "dev": "vite", "build": "vite build" }, "devDependencies": { "axios": "^1.1.2", "laravel-vite-plugin": "^0.7.5", "sass": "^1.69.5", "postcss": "^8.3.7", "vite": "^4.0.0" } } app/Http/Controllers/.gitkeep 0000644 00000000000 15012227353 0012170 0 ustar 00 app/Http/Controllers/Admin/PurchaseController.php 0000644 00000030177 15012227353 0016140 0 ustar 00 <?php namespace Modules\Subscription\app\Http\Controllers\Admin; use App\Models\User; use Illuminate\Http\Request; use App\Http\Controllers\Controller; use Modules\Property\app\Models\Property; use Modules\Subscription\app\Models\SubscriptionPlan; use Modules\Subscription\app\Models\SubscriptionHistory; class PurchaseController extends Controller { public function index(Request $request) { checkAdminHasPermissionAndThrowException('subscription.view'); $query = SubscriptionHistory::query(); $query->with('user')->where(['payment_status' => 'success'])->orWhere('payment_method', 'bank'); $query->when($request->filled('keyword'), function ($q) use ($request) { $q->where('plan_name', 'like', '%'.$request->keyword.'%') ->orWhere('plan_price', 'like', '%'.$request->keyword.'%') ->orWhere('expiration_date', 'like', '%'.$request->keyword.'%') ->orWhere('expiration', 'like', '%'.$request->keyword.'%') ->orWhere('payment_method', 'like', '%'.$request->keyword.'%') ->orWhere('transaction', 'like', '%'.$request->keyword.'%'); }); $query->when($request->filled('status'), function ($q) use ($request) { $q->where('status', $request->status); }); $query->when($request->filled('user'), function ($q) use ($request) { $q->where('user_id', $request->user); }); $orderBy = $request->filled( 'order_by' ) && $request->order_by == 1 ? 'asc' : 'desc'; if ($request->filled('par-page')) { $histories = $request->get('par-page') == 'all' ? $query->orderBy( 'id', $orderBy )->get() : $query->orderBy( 'id', $orderBy )->paginate($request->get('par-page'))->withQueryString(); } else { $histories = $query->orderBy( 'id', $orderBy )->paginate()->withQueryString(); } $title = __('Transaction History'); $users = User::select('name', 'id')->get(); return view('subscription::admin.purchase_history', compact('histories', 'title', 'users')); } public function pending_payment(Request $request) { checkAdminHasPermissionAndThrowException('subscription.view'); $query = SubscriptionHistory::query(); $query->with('user')->where(['payment_status' => 'pending', 'payment_method' => 'bank']); $query->when($request->filled('keyword'), function ($q) use ($request) { $q->where('plan_name', 'like', '%'.$request->keyword.'%') ->orWhere('plan_price', 'like', '%'.$request->keyword.'%') ->orWhere('expiration_date', 'like', '%'.$request->keyword.'%') ->orWhere('expiration', 'like', '%'.$request->keyword.'%') ->orWhere('payment_method', 'like', '%'.$request->keyword.'%') ->orWhere('transaction', 'like', '%'.$request->keyword.'%'); }); $query->when($request->filled('user'), function ($q) use ($request) { $q->where('user_id', $request->user); }); $orderBy = $request->filled( 'order_by' ) && $request->order_by == 1 ? 'asc' : 'desc'; if ($request->filled('par-page')) { $histories = $request->get('par-page') == 'all' ? $query->orderBy( 'id', $orderBy )->get() : $query->orderBy( 'id', $orderBy )->paginate($request->get('par-page'))->withQueryString(); } else { $histories = $query->orderBy( 'id', $orderBy )->paginate()->withQueryString(); } $title = __('Pending Transaction'); $users = User::select('name', 'id')->get(); return view('subscription::admin.purchase_history', compact('histories', 'title', 'users')); } public function subscription_history() { checkAdminHasPermissionAndThrowException('subscription.view'); $histories = SubscriptionHistory::with('user')->orderBy('id', 'desc')->where('status', 'active')->paginate(30); return view('subscription::admin.subscription_history', compact('histories')); } public function create() { checkAdminHasPermissionAndThrowException('subscription.view'); $plans = SubscriptionPlan::where('status', 'active')->orderBy('serial', 'asc')->get(); $users = User::all(); return view('subscription::admin.assign_plan', compact('plans', 'users')); } public function store(Request $request) { checkAdminHasPermissionAndThrowException('subscription.view'); $request->validate([ 'user_id' => 'required', 'plan_id' => 'required', ], [ 'user_id.required' => __('User is required'), 'plan_id.required' => __('Plan is required'), ]); $plan = SubscriptionPlan::find($request->plan_id); if ($plan->expiration_date == 'monthly') { $expiration_date = date('Y-m-d', strtotime('30 days')); } elseif ($plan->expiration_date == 'yearly') { $expiration_date = date('Y-m-d', strtotime('365 days')); } elseif ($plan->expiration_date == 'lifetime') { $expiration_date = date('Y-m-d', strtotime('+100 years')); } $this->store_pricing_plan($request->user_id, $plan, $expiration_date); $notification = __('Assign Successfully'); $notification = ['messege' => $notification, 'alert-type' => 'success']; return redirect()->back()->with($notification); } public function show($id) { checkAdminHasPermissionAndThrowException('subscription.view'); $history = SubscriptionHistory::with('user')->where('id', $id)->first(); return view('subscription::admin.purchase_history_show', compact('history')); } public function approved_plan_payment(Request $request, $id) { checkAdminHasPermissionAndThrowException('subscription.view'); $history = SubscriptionHistory::where('id', $id)->first(); SubscriptionHistory::where('user_id', $history->user_id)->update(['status' => 'expired']); $history = SubscriptionHistory::findOrFail($id); $history->payment_status = 'success'; if ($request->has('paid_amount')) { $history->paid_amount = $request->paid_amount; $history->payable_currency = 'USD'; $history->gateway_charge = 0; $history->payable_with_charge = $history->plan_price; } $history->status = 'active'; $history->save() ? SubscriptionHistory::whereNotIn('id', [$id])->where('user_id', $history->user_id)->update(['status' => 'expired']) : null; $plan = SubscriptionPlan::where('id', $history->subscription_plan_id)->first(); $userProperties=Property::where('user_id',$history->user_id)->orderBy('id','desc')->get(); if($userProperties->count() !=0){ if($plan->number_of_property !=-1){ foreach($userProperties as $index => $property){ if(++$index <= $plan->number_of_property){ $property->expired_date=$history->expiration_date; $property->save(); }else{ $property->expired_date='expired'; $property->save(); } } }elseif($plan->number_of_property ==-1){ foreach($userProperties as $index => $property){ $property->expired_date=$history->expiration_date; $property->save(); } } } $notification = __('Approved Successfully'); $notification = ['messege' => $notification, 'alert-type' => 'success']; return redirect()->back()->with($notification); } public function plan_renew($id) { checkAdminHasPermissionAndThrowException('subscription.view'); $current_plan = SubscriptionHistory::where('id', $id)->first(); if ($current_plan->expiration_date <= date('Y-m-d')) { $plan = SubscriptionPlan::find($current_plan->subscription_plan_id); if ($plan->expiration_date == 'monthly') { $expiration_date = date('Y-m-d', strtotime('30 days')); } elseif ($plan->expiration_date == 'yearly') { $expiration_date = date('Y-m-d', strtotime('365 days')); } elseif ($plan->expiration_date == 'lifetime') { $expiration_date = date('Y-m-d', strtotime('+100 years')); } } else { $plan = SubscriptionPlan::find($current_plan->subscription_plan_id); if ($plan->expiration_date == 'monthly') { $expiration_date = date('Y-m-d', strtotime($current_plan->expiration_date.' +30 days')); } elseif ($plan->expiration_date == 'yearly') { $expiration_date = date('Y-m-d', strtotime($current_plan->expiration_date.' +365 days')); } elseif ($plan->expiration_date == 'lifetime') { $expiration_date = date('Y-m-d', strtotime('+100 years')); } } $this->store_pricing_plan($current_plan->user_id, $plan, $expiration_date); $notification = __('Subscription renew successfully'); $notification = ['messege' => $notification, 'alert-type' => 'success']; return redirect()->back()->with($notification); } public function delete_plan_payment($id) { checkAdminHasPermissionAndThrowException('subscription.view'); $history = SubscriptionHistory::where('id', $id)->first(); if ($history->status == 'active') { $notification = trans('You can not delete user current plan.'); $notification=array('messege'=>$notification,'alert-type'=>'error'); return redirect()->back()->with($notification); } $history->delete(); $notification = __('Delete Successfully'); $notification = ['messege' => $notification, 'alert-type' => 'success']; return redirect()->route('admin.plan-transaction-history')->with($notification); } public function store_pricing_plan($user_id, $plan, $expiration_date) { checkAdminHasPermissionAndThrowException('subscription.view'); SubscriptionHistory::where('user_id', $user_id)->update(['status' => 'expired']); $purchase = new SubscriptionHistory(); $purchase->order_id='#'.rand(22,44).date('Ydmis'); $purchase->user_id = $user_id; $purchase->subscription_plan_id = $plan->id; $purchase->plan_name = $plan->plan_name; $purchase->plan_price = $plan->plan_price; $purchase->expiration = $plan->expiration_date; $purchase->expiration_date = $expiration_date; // write your logics here $purchase->number_of_property = $plan->number_of_property; $purchase->number_of_feature_property = $plan->number_of_feature_property; $purchase->number_of_top_property = $plan->number_of_top_property; $purchase->number_of_urgent_property = $plan->number_of_urgent_property; $purchase->is_featured = $plan->is_featured; $purchase->is_top = $plan->is_top; $purchase->is_urgent = $plan->is_urgent; //end write your logics here $purchase->status = 'active'; $purchase->payment_method = 'handcash'; $purchase->payment_status = 'success'; $purchase->transaction = 'hand_cash'; $purchase->save(); $userProperties=Property::where('user_id',$user_id)->orderBy('id','desc')->get(); if($userProperties->count() !=0){ if($plan->number_of_property !=-1){ foreach($userProperties as $index => $property){ if(++$index <= $plan->number_of_property){ $property->expired_date=$expiration_date; $property->save(); }else{ $property->expired_date='expired'; $property->save(); } } }elseif($plan->number_of_property ==-1){ foreach($userProperties as $index => $property){ $property->expired_date=$expiration_date; $property->save(); } } } } } app/Http/Controllers/Admin/SubscriptionPlanController.php 0000644 00000014766 15012227353 0017673 0 ustar 00 <?php namespace Modules\Subscription\app\Http\Controllers\Admin; use App\Http\Controllers\Controller; use Illuminate\Http\Request; use Modules\Subscription\app\Models\SubscriptionPlan; use Modules\Subscription\app\Enums\SubscriptionFeatures; class SubscriptionPlanController extends Controller { public function index() { checkAdminHasPermissionAndThrowException('subscription.view'); $plans = SubscriptionPlan::orderBy('serial', 'asc')->get(); return view('subscription::admin.subscription_list', compact('plans')); } public function create() { checkAdminHasPermissionAndThrowException('subscription.create'); return view('subscription::admin.subscription_create'); } public function store(Request $request) { checkAdminHasPermissionAndThrowException('subscription.store'); $request->validate([ 'plan_name' => 'required', 'plan_price' => 'required|numeric', 'expiration_date' => 'required', 'serial' => 'required', 'status' => 'required', 'number_of_property'=>'required', 'feature'=>'required', 'top_property'=>'required', 'urgent'=>'required', 'number_of_feature_property'=>'required', 'number_of_top_property'=> 'required', 'number_of_urgent_property'=>'required', ], [ 'plan_name.required' => __('Plan name is required'), 'plan_price.required' => __('Plan price is required'), 'plan_price.numeric' => __('Plan price should be numeric'), 'expiration_date.required' => __('Expiration date is required'), 'serial.required' => __('Serial is required'), 'number_of_property.required' => trans('Number of property is required'), 'number_of_feature_property.required' => trans('Number of feature property is required'), 'number_of_top_property.required' => trans('Number of top property is required'), 'number_of_urgent_property.required' => trans('Number of urgent property is required'), ]); $plan = new SubscriptionPlan(); $plan->plan_name = $request->plan_name; $plan->plan_price = $request->plan_price; $plan->expiration_date = $request->expiration_date; $plan->serial = $request->serial; $plan->status = $request->status; // foreach (SubscriptionFeatures::all() as $feature) { // $plan->$feature['column'] = $request->$feature['column']; // } $plan->number_of_property=$request->number_of_property; $plan->is_featured=$request->feature; $plan->is_top=$request->top_property; $plan->is_urgent=$request->urgent; $plan->number_of_feature_property=$request->number_of_feature_property ? $request->number_of_feature_property : 0; $plan->number_of_top_property=$request->number_of_top_property ? $request->number_of_top_property : 0; $plan->number_of_urgent_property=$request->number_of_urgent_property ? $request->number_of_urgent_property : 0; $plan->save(); $notification = __('Create Successfully'); $notification = ['messege' => $notification, 'alert-type' => 'success']; return redirect()->route('admin.subscription-plan.index')->with($notification); } public function show($id) { return view('subscription::show'); } public function edit($id) { checkAdminHasPermissionAndThrowException('subscription.edit'); $plan = SubscriptionPlan::find($id); return view('subscription::admin.subscription_edit', compact('plan')); } public function update(Request $request, $id) { checkAdminHasPermissionAndThrowException('subscription.update'); $request->validate([ 'plan_name' => 'required', 'plan_price' => 'required|numeric', 'expiration_date' => 'required', 'serial' => 'required', 'status' => 'required', 'number_of_property'=>'required', 'feature'=>'required', 'top_property'=>'required', 'urgent'=>'required', 'number_of_feature_property'=>'required', 'number_of_top_property'=> 'required', 'number_of_urgent_property'=>'required', ], [ 'plan_name.required' => __('Plan name is required'), 'plan_price.required' => __('Plan price is required'), 'plan_price.numeric' => __('Plan price should be numeric'), 'expiration_date.required' => __('Expiration date is required'), 'serial.required' => __('Serial is required'), 'number_of_property.required' => trans('Number of property is required'), 'number_of_feature_property.required' => trans('Number of feature property is required'), 'number_of_top_property.required' => trans('Number of top property is required'), 'number_of_urgent_property.required' => trans('Number of urgent property is required'), ]); $plan = SubscriptionPlan::find($id); $plan->plan_name = $request->plan_name; $plan->plan_price = $request->plan_price; $plan->expiration_date = $request->expiration_date; $plan->serial = $request->serial; $plan->status = $request->status; $plan->number_of_property=$request->number_of_property; $plan->is_featured=$request->feature; $plan->is_top=$request->top_property; $plan->is_urgent=$request->urgent; $plan->number_of_feature_property=$request->number_of_feature_property ? $request->number_of_feature_property : 0; $plan->number_of_top_property=$request->number_of_top_property ? $request->number_of_top_property : 0; $plan->number_of_urgent_property=$request->number_of_urgent_property ? $request->number_of_urgent_property : 0; $plan->save(); $notification = __('Update Successfully'); $notification = ['messege' => $notification, 'alert-type' => 'success']; return redirect()->route('admin.subscription-plan.index')->with($notification); } public function destroy($id) { checkAdminHasPermissionAndThrowException('subscription.delete'); $plan = SubscriptionPlan::find($id); $plan->delete(); $notification = __('Delete Successfully'); $notification = ['messege' => $notification, 'alert-type' => 'success']; return redirect()->route('admin.subscription-plan.index')->with($notification); } } app/Http/Controllers/Admin/error_log 0000644 00000000605 15012227353 0013517 0 ustar 00 [17-May-2025 10:12:01 UTC] PHP Fatal error: Uncaught Error: Class "App\Http\Controllers\Controller" not found in /home/c7lekhnath/silverray.com.au/Modules/Subscription/app/Http/Controllers/Admin/SubscriptionPlanController.php:10 Stack trace: #0 {main} thrown in /home/c7lekhnath/silverray.com.au/Modules/Subscription/app/Http/Controllers/Admin/SubscriptionPlanController.php on line 10 app/Http/Controllers/SubscriptionController.php 0000644 00000024432 15012227353 0016017 0 ustar 00 <?php namespace Modules\Subscription\app\Http\Controllers; use Illuminate\Http\Request; use App\Http\Controllers\Controller; use Illuminate\Pagination\Paginator; use Illuminate\Support\Facades\Auth; use Illuminate\Http\RedirectResponse; use Illuminate\Support\Facades\Session; use App\Traits\GetGlobalInformationTrait; use Modules\Property\app\Models\Property; use Modules\Currency\app\Models\MultiCurrency; use Modules\Subscription\app\Models\SubscriptionPlan; use Modules\Subscription\app\Models\SubscriptionHistory; class SubscriptionController extends Controller { use GetGlobalInformationTrait; /** * Display a listing of the resource. */ public function index(){ $user=Auth::guard('web')->user(); $activeOrder=SubscriptionHistory::where(['user_id'=>$user->id,'status'=>'active'])->first(); $subscriptionPlans = SubscriptionPlan::where('status','active')->orderBy('serial','asc')->get(); return view('subscription::user.pricing-plan', compact('subscriptionPlans', 'activeOrder')); } public function subscription_history(){ Paginator::useBootstrap(); $user=Auth::guard('web')->user(); // $subscriptionHistories = SubscriptionHistory::where('user_id',$user->id)->orderBy('id','desc')->paginate(10); $subscriptionHistories = SubscriptionHistory::where(['user_id' => $user->id, 'payment_status' => 'success'])->orWhere('payment_method', 'bank') ->orderBy('id', 'desc') ->paginate(10); return view('subscription::user.subscription_history', compact('subscriptionHistories')); } public function show_subscription_history($id){ $user=Auth::guard('web')->user(); $subscriptionHistory = SubscriptionHistory::where(['user_id'=>$user->id,'id'=>$id])->first(); if($subscriptionHistory){ return view('subscription::user.show_subscription_history',compact('subscriptionHistory')); }else{ $notification=trans('Something went wrong'); $notification=array('messege'=>$notification,'alert-type'=>'error'); return redirect()->route('subscription.subscription-history')->with($notification); } } public function payment_page($id) { Session::forget('subscription_type'); Session::forget('current_plan_id'); Session::forget('payable_amount'); Session::forget('plan_id'); Session::forget('expiration_date'); // plan id will be dynamic $plan=SubscriptionPlan::findOrFail($id); Session::put('plan_id', $plan->id); $user=Auth::guard('web')->user(); if($plan){ if($plan->plan_price==0){ if($plan->expiration_date == 'monthly'){ $expiration_date = date('Y-m-d', strtotime('30 days')); }elseif($plan->expiration_date == 'yearly'){ $expiration_date = date('Y-m-d', strtotime('365 days')); } elseif ($plan->expiration_date == 'lifetime') { $expiration_date = date('Y-m-d', strtotime('+100 years')); } $this->store_free_pricing_plan($user->id, $plan, $expiration_date); $notification=trans('Purchase successfully'); $notification=array('messege'=>$notification,'alert-type'=>'success'); return redirect()->route('subscription.subscription-history')->with($notification); }else{ $payable_amount = $plan->plan_price; Session::put('payable_amount', $payable_amount); $user = Auth::guard('web')->user(); $paymentService = app(\Modules\BasicPayment\app\Services\PaymentMethodService::class); $activeGateways = $paymentService->getActiveGatewaysWithDetails(); return view('subscription::user.payment')->with([ 'plan' => $plan, 'user' => $user, 'paymentService' => $paymentService, 'activeGateways' => $activeGateways, ]); } }else{ $notification=trans('Something went wrong'); $notification=array('messege'=>$notification,'alert-type'=>'error'); return redirect()->route('pricing.plan')->with($notification); } } public function renewPackage($id){ // plan id will be dynamic Session::forget('subscription_type'); Session::forget('current_plan_id'); Session::forget('payable_amount'); Session::forget('plan_id'); Session::forget('expiration_date'); Session::put('subscription_type', 'renew'); Session::put('current_plan_id', $id); Session::put('plan_id', $id); $current_plan = SubscriptionHistory::where('id', $id)->first(); $plan = SubscriptionPlan::find($current_plan->subscription_plan_id); Session::put('plan_id', $plan->id); if($plan){ if($plan->plan_price==0){ if ($current_plan->expiration_date <= date('Y-m-d')) { if ($plan->expiration_date == 'monthly') { $expiration_date = date('Y-m-d', strtotime('30 days')); } elseif ($plan->expiration_date == 'yearly') { $expiration_date = date('Y-m-d', strtotime('365 days')); } elseif ($plan->expiration_date == 'lifetime') { $expiration_date = date('Y-m-d', strtotime('+100 years')); } } else { $plan = SubscriptionPlan::find($current_plan->subscription_plan_id); if ($plan->expiration_date == 'monthly') { $expiration_date = date('Y-m-d', strtotime($current_plan->expiration_date.' +30 days')); } elseif ($plan->expiration_date == 'yearly') { $expiration_date = date('Y-m-d', strtotime($current_plan->expiration_date.' +365 days')); } elseif ($plan->expiration_date == 'lifetime') { $expiration_date = date('Y-m-d', strtotime('+100 years')); } } $this->store_free_pricing_plan($current_plan->user_id, $plan, $expiration_date); $notification=trans('Purchase successfully'); $notification=array('messege'=>$notification,'alert-type'=>'success'); return redirect()->route('subscription.subscription-history')->with($notification); }else{ $payable_amount = $plan->plan_price; Session::put('payable_amount', $payable_amount); $user = Auth::guard('web')->user(); $paymentService = app(\Modules\BasicPayment\app\Services\PaymentMethodService::class); $activeGateways = $paymentService->getActiveGatewaysWithDetails(); return view('subscription::user.payment')->with([ 'plan' => $plan, 'user' => $user, 'paymentService' => $paymentService, 'activeGateways' => $activeGateways, ]); } }else{ $notification=trans('Something went wrong'); $notification=array('messege'=>$notification,'alert-type'=>'error'); return redirect()->route('pricing.plan')->with($notification); } } public function store_free_pricing_plan($user_id, $plan, $expiration_date){ $activeOrder=SubscriptionHistory::where(['user_id'=>$user_id,'status'=>'active'])->count(); $oldOrders=SubscriptionHistory::where('user_id',$user_id)->update(['status'=>'expired']); $purchase=new SubscriptionHistory(); $purchase->user_id=$user_id; $purchase->order_id=mt_rand().date('Ydmis'); $purchase->subscription_plan_id=$plan->id; $purchase->expiration=$plan->expiration_date; $purchase->expiration_date = $expiration_date; $purchase->status='active'; $purchase->payment_status='success'; $purchase->plan_name = $plan->plan_name; $purchase->payable_amount = 0.0; $purchase->gateway_charge = 0; $purchase->payable_with_charge = 0; $purchase->paid_amount = 0; $purchase->payment_method = 'free'; $purchase->transaction = 'free'; $purchase->number_of_property = $plan->number_of_property; $purchase->number_of_feature_property = $plan->number_of_feature_property; $purchase->number_of_top_property = $plan->number_of_top_property; $purchase->number_of_urgent_property = $plan->number_of_urgent_property; $purchase->is_featured = $plan->is_featured; $purchase->is_top = $plan->is_top; $purchase->is_urgent = $plan->is_urgent; $purchase->save(); // active and in-active minimum limit listing $userProperties=Property::where('user_id',$user_id)->orderBy('id','desc')->get(); if($userProperties->count() !=0){ foreach($userProperties as $index => $property){ if(++$index <= $plan->number_of_property){ $property->status=1; $property->expired_date = $expiration_date; $property->save(); }else{ $property->status=0; $property->expired_date = 'expired'; $property->save(); } } } // end inactive Session::forget('after_success_url'); Session::forget('after_faild_url'); Session::forget('payable_amount'); Session::forget('gateway_charge'); Session::forget('after_success_gateway'); Session::forget('after_success_transaction'); Session::forget('subscription_plan_id'); Session::forget('payable_with_charge'); Session::forget('payable_currency'); Session::forget('subscription_plan_id'); Session::forget('paid_amount'); Session::forget('payment_details'); Session::forget('subscription_type'); Session::forget('plan_id'); Session::forget('current_plan_id'); Session::forget('subscription_history_id'); Session::forget('subscription_history'); Session::forget('expiration_date'); } } app/Http/Controllers/PaymentController.php 0000644 00000117004 15012227353 0014746 0 ustar 00 <?php namespace Modules\Subscription\app\Http\Controllers; use Closure; use Exception; use Razorpay\Api\Api; use Illuminate\Support\Str; use Illuminate\Http\Request; use App\Traits\MailSenderTrait; use Illuminate\Support\Facades\DB; use App\Http\Controllers\Controller; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Route; use Illuminate\Support\Facades\Session; use App\Traits\GetGlobalInformationTrait; use Modules\Property\app\Models\Property; use App\Http\Requests\BankInformationRequest; use Modules\Currency\app\Models\MultiCurrency; use Srmklive\PayPal\Services\PayPal as PayPalClient; use Modules\Subscription\app\Models\SubscriptionPlan; use Modules\Subscription\app\Models\SubscriptionHistory; use Modules\BasicPayment\app\Http\Controllers\FrontPaymentController; use Modules\BasicPayment\app\Enums\BasicPaymentSupportedCurrencyListEnum; use Modules\BasicPayment\app\Enums\PaymentGatewaySupportedCurrencyListEnum; class PaymentController extends Controller { use GetGlobalInformationTrait, MailSenderTrait; private $paymentService; function __construct() { $this->paymentService = app(\Modules\BasicPayment\app\Services\PaymentMethodService::class); } function placeOrder($method) { $user=Auth::guard('web')->user(); $activeGateways = array_keys($this->paymentService->getActiveGatewaysWithDetails()); if (!in_array($method, $activeGateways)) { return response()->json(['status' => false, 'messege' => __('The selected payment method is now inactive.')]); } if (!$this->paymentService->isCurrencySupported($method)) { $supportedCurrencies = $this->paymentService->getSupportedCurrencies($method); return response()->json(['status' => false, 'messege' => __('You are trying to use unsupported currency'), 'supportCurrency' => sprintf( '%s %s: %s', strtoupper($method), __('supports only these types of currencies'), implode(', ', $supportedCurrencies) )]); } try { $payable_amount = Session::get('payable_amount'); $calculatePayableCharge = $this->paymentService->getPayableAmount($method, $payable_amount); DB::beginTransaction(); $paid_amount = $calculatePayableCharge?->payable_amount + $calculatePayableCharge?->gateway_charge; if (in_array($method, ['Razorpay', 'Stripe'])) { $allCurrencyCodes = BasicPaymentSupportedCurrencyListEnum::getStripeSupportedCurrencies(); if (in_array(Str::upper($calculatePayableCharge?->currency_code), $allCurrencyCodes['non_zero_currency_codes'])) { $paid_amount = $paid_amount; } elseif (in_array(Str::upper($calculatePayableCharge?->currency_code), $allCurrencyCodes['three_digit_currency_codes'])) { $paid_amount = (int) rtrim(strval($paid_amount), '0'); } else { $paid_amount = floatval($paid_amount / 100); } } $planId = Session::get('plan_id'); $subscription_type = Session::get('subscription_type'); $current_plan_id = Session::get('current_plan_id'); $payable_currency = getSessionCurrency(); $paymentDetails = Session::has('payment_details') ? Session::get('payment_details') : null; $plan = SubscriptionPlan::findOrFail($planId); $user = Auth::guard('web')->user(); if($subscription_type == 'renew'){ $current_plan = SubscriptionHistory::where('id', $current_plan_id)->first(); if ($current_plan->expiration_date <= date('Y-m-d')) { if ($plan->expiration_date == 'monthly') { $expiration_date = date('Y-m-d', strtotime('30 days')); } elseif ($plan->expiration_date == 'yearly') { $expiration_date = date('Y-m-d', strtotime('365 days')); } elseif ($plan->expiration_date == 'lifetime') { $expiration_date = date('Y-m-d', strtotime('+100 years')); } } else { $plan = SubscriptionPlan::find($current_plan->subscription_plan_id); if ($plan->expiration_date == 'monthly') { $expiration_date = date('Y-m-d', strtotime($current_plan->expiration_date.' +30 days')); } elseif ($plan->expiration_date == 'yearly') { $expiration_date = date('Y-m-d', strtotime($current_plan->expiration_date.' +365 days')); } elseif ($plan->expiration_date == 'lifetime') { $expiration_date = date('Y-m-d', strtotime('+100 years')); } } }else{ if ($plan->expiration_date == 'monthly') { $expiration_date = date('Y-m-d', strtotime('30 days')); } elseif ($plan->expiration_date == 'yearly') { $expiration_date = date('Y-m-d', strtotime('365 days')); } elseif ($plan->expiration_date == 'lifetime') { $expiration_date = date('Y-m-d', strtotime('+100 years')); } } Session::put('expiration_date', $expiration_date); if (!is_null($planId)) { $purchase = new SubscriptionHistory(); $purchase->order_id = mt_rand() . date('Ydmis'); $purchase->user_id = $user->id; $purchase->subscription_plan_id = $plan->id; $purchase->plan_name = $plan->plan_name; $purchase->plan_price = $plan->plan_price; $purchase->expiration = $plan->expiration_date; $purchase->expiration_date = $expiration_date; $purchase->status = 'pending'; $purchase->payable_amount = $payable_amount; $purchase->gateway_charge = $calculatePayableCharge?->gateway_charge; $purchase->payable_with_charge = $calculatePayableCharge?->payable_amount; $purchase->payable_currency = $payable_currency; $purchase->transaction = ''; $purchase->number_of_property = $plan->number_of_property; $purchase->number_of_feature_property = $plan->number_of_feature_property; $purchase->number_of_top_property = $plan->number_of_top_property; $purchase->number_of_urgent_property = $plan->number_of_urgent_property; $purchase->is_featured = $plan->is_featured; $purchase->is_top = $plan->is_top; $purchase->is_urgent = $plan->is_urgent; if ($payable_amount <= 0) { $purchase->payment_method = 'free'; $purchase->payment_status = 'pending'; $purchase->paid_amount = 0.00; } elseif ($method === 'bank') { $purchase->payment_method = 'bank'; $purchase->payment_status = 'pending'; $purchase->paid_amount = 0.00; $purchase->payment_details = json_encode($paymentDetails); } else { $purchase->payment_method = $method; $purchase->payment_status = 'pending'; $purchase->paid_amount = $paid_amount; $purchase->payment_details = json_encode($paymentDetails); } $purchase->save(); } DB::commit(); return response()->json(['success' => true, 'subscription_id' => $purchase?->id]); } catch (Exception $e) { DB::rollBack(); return response()->json(['status' => false, 'messege' => __('Payment Failed')]); } } function index() { $subscription_id = request('subscription_id', null); $user = $user=Auth::guard('web')->user(); $subscription_history = SubscriptionHistory::where('id', $subscription_id)->where('status', 'pending')->first(); if (!$subscription_history) { $notification = [ 'messege' => __('Not Found!'), 'alert-type' => 'error', ]; return redirect()->back()->with($notification); } $paymentMethod = $subscription_history->payment_method; if (!$this->paymentService->isActive($paymentMethod)) { $notification = [ 'messege' => __('The selected payment method is now inactive.'), 'alert-type' => 'error', ]; return redirect()->back()->with($notification); } $calculatePayableCharge = $this->paymentService->getPayableAmount($paymentMethod, $subscription_history?->payable_amount); Session::put('subscription_history_id', $subscription_history->id); Session::put('subscription_history', $subscription_history); Session::put('payable_currency', $subscription_history?->payable_currency); Session::put('paid_amount', $calculatePayableCharge?->payable_with_charge); $paymentService = $this->paymentService; $view = $this->paymentService->getBladeView($paymentMethod); return view($view, compact('subscription_history', 'paymentService', 'paymentMethod')); } public function stripe_pay() { $basic_payment = $this->get_basic_payment_info(); // Set your Stripe API secret key \Stripe\Stripe::setApiKey($basic_payment?->stripe_secret); $after_failed_url = route('subscription.payment-addon-faild'); session()->put('after_failed_url', $after_failed_url); $payable_currency = session()->get('payable_currency'); $paid_amount = session()->get('paid_amount'); $allCurrencyCodes = $this->paymentService->getSupportedCurrencies($this->paymentService::STRIPE); if (in_array(Str::upper($payable_currency), $allCurrencyCodes['non_zero_currency_codes'])) { $payable_with_charge = $paid_amount; } elseif (in_array(Str::upper($payable_currency), $allCurrencyCodes['three_digit_currency_codes'])) { $convertedCharge = (string) $paid_amount . '0'; $payable_with_charge = (int) $convertedCharge; } else { $payable_with_charge = (int) ($paid_amount * 100); } // Create a checkout session $checkoutSession = \Stripe\Checkout\Session::create([ 'payment_method_types' => ['card'], 'line_items' => [[ 'price_data' => [ 'currency' => $payable_currency, 'unit_amount' => $payable_with_charge, 'product_data' => [ 'name' => cache()->get('setting')->app_name, ], ], 'quantity' => 1, ]], 'mode' => 'payment', 'success_url' => url('subscription/pay-via-stripe') . '?session_id={CHECKOUT_SESSION_ID}', 'cancel_url' => $after_failed_url, ]); // Redirect to the checkout session URL return redirect()->away($checkoutSession->url); } public function stripe_success(Request $request) { $after_success_url = route('subscription.payment-addon-success'); $basic_payment = $this->get_basic_payment_info(); // Assuming the Checkout Session ID is passed as a query parameter $session_id = $request->query('session_id'); if ($session_id) { \Stripe\Stripe::setApiKey($basic_payment->stripe_secret); $session = \Stripe\Checkout\Session::retrieve($session_id); $paymentDetails = [ 'transaction_id' => $session->payment_intent, 'amount' => $session->amount_total, 'currency' => $session->currency, 'payment_status' => $session->payment_status, 'created' => $session->created, ]; Session::put('after_success_url', $after_success_url); Session::put('after_success_transaction', $session->payment_intent); Session::put('payment_details', $paymentDetails); return redirect($after_success_url); } $after_faild_url = Session::get('after_faild_url'); return redirect($after_faild_url); } public function pay_via_paypal() { $basic_payment = $this->get_basic_payment_info(); $paypal_credentials = (object) [ 'paypal_client_id' => $basic_payment->paypal_client_id, 'paypal_secret_key' => $basic_payment->paypal_secret_key, 'paypal_app_id' => $basic_payment->paypal_app_id, 'paypal_account_mode' => $basic_payment->paypal_account_mode, ]; $after_success_url = route('subscription.payment-addon-success'); $after_failed_url = route('subscription.payment-addon-faild'); return $this->pay_with_paypal($paypal_credentials, $after_success_url, $after_failed_url); } public function pay_with_paypal($paypal_credentials, $after_success_url, $after_failed_url) { config(['paypal.mode' => $paypal_credentials->paypal_account_mode]); if ($paypal_credentials->paypal_account_mode == 'sandbox') { config(['paypal.sandbox.client_id' => $paypal_credentials->paypal_client_id]); config(['paypal.sandbox.client_secret' => $paypal_credentials->paypal_secret_key]); } else { config(['paypal.live.client_id' => $paypal_credentials->paypal_client_id]); config(['paypal.live.client_secret' => $paypal_credentials->paypal_secret_key]); config(['paypal.live.app_id' => $paypal_credentials->paypal_app_id]); } $payable_currency = session()->get('payable_currency'); $paid_amount = session()->get('paid_amount'); try { $provider = new PayPalClient; $provider->setApiCredentials(config('paypal')); $paypalToken = $provider->getAccessToken(); $response = $provider->createOrder([ 'intent' => 'CAPTURE', 'application_context' => [ 'return_url' => route('subscription.paypal-success-payment'), 'cancel_url' => $after_failed_url, ], 'purchase_units' => [ 0 => [ 'amount' => [ 'currency_code' => $payable_currency, 'value' => $paid_amount, ], ], ], ]); } catch (Exception $ex) { info($ex->getMessage()); $notification = __('Payment faild, please try again'); $notification = ['messege' => $notification, 'alert-type' => 'error']; return redirect()->back()->with($notification); } if (isset($response['id']) && $response['id'] != null) { Session::put('after_success_url', $after_success_url); Session::put('after_failed_url', $after_failed_url); Session::put('paypal_credentials', $paypal_credentials); // redirect to approve href foreach ($response['links'] as $links) { if ($links['rel'] == 'approve') { return redirect()->away($links['href']); } } $notification = __('Payment faild, please try again'); $notification = ['messege' => $notification, 'alert-type' => 'error']; return redirect()->back()->with($notification); } else { $notification = __('Payment faild, please try again'); $notification = ['messege' => $notification, 'alert-type' => 'error']; return redirect()->back()->with($notification); } } public function paypal_success(Request $request) { $paypal_credentials = Session::get('paypal_credentials'); config(['paypal.mode' => $paypal_credentials->paypal_account_mode]); if ($paypal_credentials->paypal_account_mode == 'sandbox') { config(['paypal.sandbox.client_id' => $paypal_credentials->paypal_client_id]); config(['paypal.sandbox.client_secret' => $paypal_credentials->paypal_secret_key]); } else { config(['paypal.sandbox.client_id' => $paypal_credentials->paypal_client_id]); config(['paypal.sandbox.client_secret' => $paypal_credentials->paypal_secret_key]); config(['paypal.sandbox.app_id' => $paypal_credentials->paypal_account_mode]); } $provider = new PayPalClient; $provider->setApiCredentials(config('paypal')); $provider->getAccessToken(); $response = $provider->capturePaymentOrder($request['token']); if (isset($response['status']) && $response['status'] == 'COMPLETED') { Session::put('after_success_transaction', $request->PayerID); $after_success_url = Session::get('after_success_url'); $paid_amount = $this->checkArrayIsset($response['purchase_units'][0]['payments']['captures'][0]['amount']['value']); Session::put('paid_amount', $paid_amount); $details = [ 'payments_captures_id' => $this->checkArrayIsset($response['purchase_units'][0]['payments']['captures'][0]['id']), 'amount' => $this->checkArrayIsset($response['purchase_units'][0]['payments']['captures'][0]['amount']['value']), 'currency' => $this->checkArrayIsset($response['purchase_units'][0]['payments']['captures'][0]['amount']['currency_code']), 'paid' => $this->checkArrayIsset($response['purchase_units'][0]['payments']['captures'][0]['seller_receivable_breakdown']['gross_amount']['value']), 'paypal_fee' => $this->checkArrayIsset($response['purchase_units'][0]['payments']['captures'][0]['seller_receivable_breakdown']['paypal_fee']['value']), 'net_amount' => $this->checkArrayIsset($response['purchase_units'][0]['payments']['captures'][0]['seller_receivable_breakdown']['net_amount']['value']), 'status' => $this->checkArrayIsset($response['purchase_units'][0]['payments']['captures'][0]['status']), ]; Session::put('payment_details', $details); return redirect($after_success_url); } else { $after_failed_url = Session::get('after_failed_url'); return redirect($after_failed_url); } } private function checkArrayIsset($value) { return isset($value) ? $value : null; } public function pay_via_bank(BankInformationRequest $request) { $bankDetails = json_encode($request->only(['bank_name', 'account_number', 'routing_number', 'branch', 'transaction'])); $allPayments = SubscriptionHistory::whereNotNull('payment_details')->get(); foreach ($allPayments as $payment) { $paymentDetailsJson = json_decode($payment?->payment_details, true); if (isset($paymentDetailsJson['account_number']) && $paymentDetailsJson['account_number'] == $request->account_number) { if (isset($paymentDetailsJson['transaction']) && $paymentDetailsJson['transaction'] == $request->transaction) { $notification = __('Payment failed, transaction already exist'); $notification = ['messege' => $notification, 'alert-type' => 'error']; return redirect()->back()->with($notification); } } } Session::put('after_success_transaction', $request->transaction); Session::put('payment_details', $bankDetails); Session::put('after_success_transaction', $request->transaction); return $this->payment_addon_success(); } public function pay_via_razorpay(Request $request) { $payment_setting = $this->get_payment_gateway_info(); $after_success_url = route('subscription.payment-addon-success'); $after_failed_url = route('subscription.payment-addon-faild'); $razorpay_credentials = (object) [ 'razorpay_key' => $payment_setting->razorpay_key, 'razorpay_secret' => $payment_setting->razorpay_secret, ]; return $this->pay_with_razorpay($request, $razorpay_credentials, $request->payable_amount, $after_success_url, $after_failed_url); } public function pay_with_razorpay(Request $request, $razorpay_credentials, $payable_amount, $after_success_url, $after_failed_url) { $input = $request->all(); $api = new Api($razorpay_credentials->razorpay_key, $razorpay_credentials->razorpay_secret); $payment = $api->payment->fetch($input['razorpay_payment_id']); if (count($input) && !empty($input['razorpay_payment_id'])) { try { $response = $api->payment->fetch($input['razorpay_payment_id'])->capture(['amount' => $payment['amount']]); $paymentDetails = [ 'transaction_id' => $response->id, 'amount' => $response->amount, 'currency' => $response->currency, 'fee' => $response->fee, 'description' => $response->description, 'payment_method' => $response->method, 'status' => $response->status, ]; Session::put('after_success_url', $after_success_url); Session::put('after_failed_url', $after_failed_url); Session::put('after_success_transaction', $response->id); Session::put('payment_details', $paymentDetails); return redirect($after_success_url); } catch (Exception $e) { info($e->getMessage()); return redirect($after_failed_url); } } else { return redirect($after_failed_url); } } public function pay_via_mollie() { $after_success_url = route('subscription.payment-addon-success'); $after_failed_url = route('subscription.payment-addon-faild'); session()->put('after_success_url', $after_success_url); session()->put('after_failed_url', $after_failed_url); $payment_setting = $this->get_payment_gateway_info(); $mollie_credentials = (object) [ 'mollie_key' => $payment_setting->mollie_key, ]; return $this->pay_with_mollie($mollie_credentials); } public function pay_with_mollie($mollie_credentials) { $payable_currency = session()->get('payable_currency'); $paid_amount = session()->get('paid_amount'); try { $mollie = new \Mollie\Api\MollieApiClient(); $mollie->setApiKey($mollie_credentials->mollie_key); $payment = $mollie->payments->create([ "amount" => [ "currency" => "$payable_currency", "value" => "$paid_amount", ], "description" => auth()->user()?->name, "redirectUrl" => route('subscription.mollie-payment-success'), ]); $payment = $mollie->payments->get($payment->id); session()->put('payment_id', $payment->id); session()->put('mollie_credentials', $mollie_credentials); return redirect($payment->getCheckoutUrl(), 303); } catch (Exception $ex) { info($ex); info($ex->getMessage()); $notification = __('Payment faild, please try again'); $notification = ['messege' => $notification, 'alert-type' => 'error']; return redirect()->back()->with($notification); } } public function mollie_payment_success() { $mollie_credentials = Session::get('mollie_credentials'); $mollie = new \Mollie\Api\MollieApiClient(); $mollie->setApiKey($mollie_credentials->mollie_key); $payment = $mollie->payments->get(session()->get('payment_id')); if ($payment->isPaid()) { $paymentDetails = [ 'transaction_id' => $payment->id, 'amount' => $payment->amount->value, 'currency' => $payment->amount->currency, 'fee' => $payment->settlementAmount->value . ' ' . $payment->settlementAmount->currency, 'description' => $payment->description, 'payment_method' => $payment->method, 'status' => $payment->status, 'paid_at' => $payment->paidAt, ]; Session::put('payment_details', $paymentDetails); Session::put('after_success_transaction', session()->get('payment_id')); $after_success_url = Session::get('after_success_url'); return redirect($after_success_url); } else { $after_failed_url = Session::get('after_failed_url'); return redirect($after_failed_url); } } public function pay_via_instamojo() { $after_success_url = route('subscription.payment-addon-success'); $after_failed_url = route('subscription.payment-addon-faild'); session()->put('after_success_url', $after_success_url); session()->put('after_failed_url', $after_failed_url); $payment_setting = $this->get_payment_gateway_info(); $instamojo_credentials = (object) [ 'instamojo_api_key' => $payment_setting->instamojo_api_key, 'instamojo_auth_token' => $payment_setting->instamojo_auth_token, 'account_mode' => $payment_setting->instamojo_account_mode, ]; return $this->pay_with_instamojo($instamojo_credentials); } public function pay_with_instamojo($instamojo_credentials) { $payable_currency = session()->get('payable_currency'); $paid_amount = session()->get('paid_amount'); $plan_id = session()->get('plan_id'); $environment = $instamojo_credentials->account_mode; $api_key = $instamojo_credentials->instamojo_api_key; $auth_token = $instamojo_credentials->instamojo_auth_token; if ($environment == 'Sandbox') { $url = 'https://test.instamojo.com/api/1.1/'; } else { $url = 'https://www.instamojo.com/api/1.1/'; } try { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url . 'payment-requests/'); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_HTTPHEADER, ["X-Api-Key:$api_key", "X-Auth-Token:$auth_token"]); $payload = [ 'purpose' => env('APP_NAME'), 'amount' => $paid_amount, 'phone' => '918160651749', 'buyer_name' => auth()->user()?->name, 'redirect_url' => route('subscription.instamojo-success'), 'send_email' => true, 'webhook' => 'http://www.example.com/webhook/', 'send_sms' => true, 'email' => auth()->user()?->email, 'allow_repeated_payments' => false, ]; curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($payload)); $response = curl_exec($ch); curl_close($ch); $response = json_decode($response); session()->put('instamojo_credentials', $instamojo_credentials); if(!empty($response?->payment_request?->longurl)){ return redirect($response?->payment_request?->longurl); }else{ return redirect()->route('subscription.purchase.package', $plan_id)->with(['messege' => __('Payment faild, please try again'), 'alert-type' => 'error']); } } catch (Exception $ex) { info($ex->getMessage()); $notification = __('Payment faild, please try again'); $notification = ['messege' => $notification, 'alert-type' => 'error']; return redirect()->back()->with($notification); } } public function flutterwave_payment(Request $request) { $payment_setting = $this->get_payment_gateway_info(); $curl = curl_init(); $tnx_id = $request->tnx_id; $url = "https://api.flutterwave.com/v3/transactions/$tnx_id/verify"; $token = $payment_setting?->flutterwave_secret_key; curl_setopt_array($curl, [ CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_HTTPHEADER => [ 'Content-Type: application/json', "Authorization: Bearer $token", ], ]); $response = curl_exec($curl); curl_close($curl); $response = json_decode($response); if ($response->status == 'success') { $paymentDetails = [ 'status' => $response->status, 'trx_id' => $tnx_id, 'amount' => $response?->data?->amount, 'amount_settled' => $response?->data?->amount_settled, 'currency' => $response?->data?->currency, 'charged_amount' => $response?->data?->charged_amount, 'app_fee' => $response?->data?->app_fee, 'merchant_fee' => $response?->data?->merchant_fee, 'card_last_4digits' => $response?->data?->card?->last_4digits, ]; Session::put('payment_details', $paymentDetails); Session::put('after_success_transaction', $tnx_id); return response()->json(['messege' => 'Payment Success.']); } else { $notification = __('Payment faild, please try again'); return response()->json(['messege' => $notification], 403); } } public function paystack_payment(Request $request) { $payment_setting = $this->get_payment_gateway_info(); $reference = $request->reference; $transaction = $request->tnx_id; $secret_key = $payment_setting?->paystack_secret_key; $curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => "https://api.paystack.co/transaction/verify/$reference", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_SSL_VERIFYHOST => 0, CURLOPT_SSL_VERIFYPEER => 0, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_HTTPHEADER => [ "Authorization: Bearer $secret_key", 'Cache-Control: no-cache', ], ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); $final_data = json_decode($response); if ($final_data->status == true) { $paymentDetails = [ 'status' => $final_data?->data?->status, 'transaction_id' => $transaction, 'requested_amount' => $final_data?->data->requested_amount, 'amount' => $final_data?->data?->amount, 'currency' => $final_data?->data?->currency, 'gateway_response' => $final_data?->data?->gateway_response, 'paid_at' => $final_data?->data?->paid_at, 'card_last_4_digits' => $final_data?->data->authorization?->last4, ]; Session::put('payment_details', $paymentDetails); Session::put('after_success_transaction', $transaction); return response()->json(['messege' => 'Payment Success.']); } else { $notification = __('Payment faild, please try again'); return response()->json(['messege' => $notification], 403); } } public function payment_addon_success($bankDetails = null) { $subscription_history_id = Session::get('subscription_history_id'); $transaction = Session::get('after_success_transaction'); $paymentDetails = Session::get('payment_details'); $expiration_date = Session::get('expiration_date'); $planId = Session::get(key: 'plan_id'); $user = Auth::guard('web')->user(); $subscription_history = SubscriptionHistory::where('id', $subscription_history_id)->first(); if($subscription_history->payment_method != 'bank'){ SubscriptionHistory::where(['user_id' => $user->id, 'status' => 'active'])->update(['status' => 'expired']); } if($subscription_history){ $subscription_history->status = $subscription_history->payment_method == 'bank' ? 'pending':'active'; $subscription_history->payment_status = $subscription_history->payment_method == 'bank' ? 'pending':'success'; $subscription_history->payment_details = json_encode($paymentDetails); $subscription_history->transaction = $transaction; $subscription_history->save(); $plan = SubscriptionPlan::findOrFail($planId); $userProperties=Property::where('user_id',$user->id)->orderBy('id','desc')->get(); if($subscription_history->payment_method != 'bank'){ if($userProperties->count() !=0){ if($plan->number_of_property !=-1){ foreach($userProperties as $index => $property){ if(++$index <= $plan->number_of_property){ $property->expired_date=$expiration_date; $property->save(); }else{ $property->expired_date='expired'; $property->save(); } } }elseif($plan->number_of_property ==-1){ foreach($userProperties as $index => $property){ $property->expired_date=$expiration_date; $property->save(); } } } } } /**write your project logic here after successfully payment, you can use above information if you need. */ /**if gateway name == Direct Bank, payment status will be pending, after approval by admin, status will be success if($gateway_name == 'Direct Bank'){} */ /**after write all logic you need to forget all session data*/ Session::forget('after_success_url'); Session::forget('after_faild_url'); Session::forget('payable_amount'); Session::forget('gateway_charge'); Session::forget('after_success_gateway'); Session::forget('after_success_transaction'); Session::forget('subscription_plan_id'); Session::forget('payable_with_charge'); Session::forget('payable_currency'); Session::forget('subscription_plan_id'); Session::forget('paid_amount'); Session::forget('payment_details'); Session::forget('subscription_type'); Session::forget('plan_id'); Session::forget('current_plan_id'); Session::forget('subscription_history_id'); Session::forget('subscription_history'); Session::forget('expiration_date'); $notification = __('Purchase successfully'); $notification = ['messege' => $notification, 'alert-type' => 'success']; return redirect()->route('subscription.subscription-history')->with($notification); } public function payment_addon_faild() { $id = Session::get('subscription_plan_id'); $plan_id = Session::get('plan_id'); /**you can write here your project related code */ Session::forget('after_success_url'); Session::forget('after_faild_url'); Session::forget('payable_amount'); Session::forget('gateway_charge'); Session::forget('after_success_gateway'); Session::forget('after_success_transaction'); Session::forget('subscription_plan_id'); Session::forget('payable_with_charge'); Session::forget('payable_currency'); Session::forget('subscription_plan_id'); Session::forget('paid_amount'); Session::forget('payment_details'); Session::forget('subscription_type'); Session::forget('plan_id'); Session::forget('current_plan_id'); Session::forget('subscription_history_id'); Session::forget('subscription_history'); Session::forget('expiration_date'); $notification = __('Payment Failed please try again'); $notification = ['messege' => $notification, 'alert-type' => 'error']; return redirect()->route('subscription.purchase.package', parameters: $plan_id)->with($notification); } public function store_free_pricing_plan($user_id, $plan, $expiration_date) { SubscriptionHistory::where('user_id', $user_id)->update(['status' => 'expired']); $activeOrder=SubscriptionHistory::where(['user_id'=>$user_id,'status'=>'active'])->count(); $purchase=new SubscriptionHistory(); $purchase->user_id=$user_id; $purchase->order_id=mt_rand().date('Ydmis'); $purchase->subscription_plan_id=$plan->id; $purchase->expiration=$plan->expiration_date; $purchase->expiration_date = $expiration_date; $purchase->status='active'; $purchase->payment_status='success'; $purchase->plan_name = $plan->plan_name; $purchase->payable_amount = 0.0; $purchase->gateway_charge = 0; $purchase->payable_with_charge = 0; $purchase->paid_amount = 0; $purchase->payment_method = 'free'; $purchase->transaction = 'free'; $purchase->number_of_property = $plan->number_of_property; $purchase->number_of_feature_property = $plan->number_of_feature_property; $purchase->number_of_top_property = $plan->number_of_top_property; $purchase->number_of_urgent_property = $plan->number_of_urgent_property; $purchase->is_featured = $plan->is_featured; $purchase->is_top = $plan->is_top; $purchase->is_urgent = $plan->is_urgent; $purchase->save(); // active and in-active minimum limit listing $userProperties=Property::where('user_id',$user_id)->orderBy('id','desc')->get(); if($userProperties->count() !=0){ foreach($userProperties as $index => $property){ if(++$index <= $plan->number_of_property){ $property->status=1; $property->expired_date = $expiration_date; $property->save(); }else{ $property->status=0; $property->expired_date = 'expired'; $property->save(); } } } // end inactive } } app/Http/Requests/.gitkeep 0000644 00000000000 15012227353 0011475 0 ustar 00 app/Http/Middleware/.gitkeep 0000644 00000000000 15012227353 0011737 0 ustar 00 app/Models/.gitkeep 0000644 00000000000 15012227353 0010166 0 ustar 00 app/Models/SubscriptionPlan.php 0000644 00000000706 15012227353 0012562 0 ustar 00 <?php namespace Modules\Subscription\app\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Modules\Subscription\Database\factories\SubscriptionPlanFactory; class SubscriptionPlan extends Model { use HasFactory; /** * The attributes that are mass assignable. */ protected $fillable = []; protected static function newFactory(): SubscriptionPlanFactory { } } app/Models/error_log 0000644 00000001244 15012227353 0010465 0 ustar 00 [08-May-2025 17:16:10 UTC] PHP Fatal error: Uncaught Error: Class "Illuminate\Database\Eloquent\Model" not found in /home/lekhnath/silverray.com.au/Modules/Subscription/app/Models/SubscriptionHistory.php:13 Stack trace: #0 {main} thrown in /home/lekhnath/silverray.com.au/Modules/Subscription/app/Models/SubscriptionHistory.php on line 13 [08-May-2025 17:16:11 UTC] PHP Fatal error: Uncaught Error: Class "Illuminate\Database\Eloquent\Model" not found in /home/lekhnath/silverray.com.au/Modules/Subscription/app/Models/SubscriptionPlan.php:9 Stack trace: #0 {main} thrown in /home/lekhnath/silverray.com.au/Modules/Subscription/app/Models/SubscriptionPlan.php on line 9 app/Models/SubscriptionHistory.php 0000644 00000002376 15012227353 0013336 0 ustar 00 <?php namespace Modules\Subscription\app\Models; use App\Models\User; use Illuminate\Support\Str; use Illuminate\Support\Facades\Cache; use Illuminate\Database\Eloquent\Model; use Modules\Subscription\app\Models\SubscriptionPlan; use Illuminate\Database\Eloquent\Factories\HasFactory; use Modules\Subscription\Database\factories\SubscriptionHistoryFactory; class SubscriptionHistory extends Model { use HasFactory; /** * The attributes that are mass assignable. */ protected $fillable = []; public function user() { return $this->belongsTo(User::class); } protected static function boot() { parent::boot(); static::creating(function ($user) { $user->uuid = Str::uuid(); }); static::created(function () { Cache::forget('pending_transactions'); }); static::deleted(function () { Cache::forget('pending_transactions'); }); static::updated(function () { Cache::forget('pending_transactions'); }); static::saved(function () { Cache::forget('pending_transactions'); }); } public function package(){ return $this->belongsTo(SubscriptionPlan::class); } } app/Enums/SubscriptionStatusType.php 0000644 00000000244 15012227353 0013656 0 ustar 00 <?php namespace Modules\Subscription\app\Enums; enum SubscriptionStatusType: string { case ACTIVE_STATUS = 'active'; case INACTIVE_STATUS = 'inactive'; } app/Enums/SubscriptionFeatures.php 0000644 00000005771 15012227353 0013321 0 ustar 00 <?php namespace Modules\Subscription\app\Enums; enum SubscriptionFeatures: string { case COURSES_LIMIT = 'courses_limit'; case COURSE_MAX_PRICE = 'course_max_price'; case COURSE_NOTIFICATION = 'course_notification'; case EMAIL_SUPPORT = 'email_support'; case PHONE_SUPPORT = 'phone_support'; case FORUM_SUPPORT = 'forum_support'; public function getColumns(): array { return match ($this) { self::COURSES_LIMIT => [ 'column' => self::COURSES_LIMIT->value, 'type' => 'integer', 'nullable' => true, 'default' => 0, 'comment' => 'null = unlimited', 'unlimited' => null, ], self::COURSE_MAX_PRICE => [ 'column' => self::COURSE_MAX_PRICE->value, 'type' => 'integer', 'nullable' => true, 'default' => 0, 'comment' => '0 = unlimited', 'unlimited' => 0, 'is_price' => true, ], self::COURSE_NOTIFICATION => [ 'column' => self::COURSE_NOTIFICATION->value, 'type' => 'boolean', 'nullable' => false, 'default' => 0, ], self::EMAIL_SUPPORT => [ 'column' => self::EMAIL_SUPPORT->value, 'type' => 'boolean', 'nullable' => false, 'default' => 0, ], self::PHONE_SUPPORT => [ 'column' => self::PHONE_SUPPORT->value, 'type' => 'boolean', 'nullable' => false, 'default' => 0, ], self::FORUM_SUPPORT => [ 'column' => self::FORUM_SUPPORT->value, 'type' => 'boolean', 'nullable' => false, 'default' => 0, ], }; } public static function all(): array { return array_map(fn ($case) => $case->getColumns(), self::cases()); } public static function allColumns() { return array_map(fn ($case) => $case->value, self::cases()); } public function getLabel(): string { return match ($this) { self::COURSES_LIMIT => __('Course Accessible'), self::COURSE_MAX_PRICE => __('Max Course Price'), self::COURSE_NOTIFICATION => __('Get Course Notification'), self::EMAIL_SUPPORT => __('Full Email Support'), self::PHONE_SUPPORT => __('Phone Calling Support'), self::FORUM_SUPPORT => __('Forum Access'), }; } public function getClassName(): string { return match ($this) { self::COURSES_LIMIT => 'deactivate', self::COURSE_MAX_PRICE => '', self::COURSE_NOTIFICATION => 'deactivate', self::EMAIL_SUPPORT => 'deactivate', self::PHONE_SUPPORT => 'deactivate', self::FORUM_SUPPORT => 'deactivate', }; } } app/Providers/RouteServiceProvider.php 0000644 00000002707 15012227353 0014152 0 ustar 00 <?php namespace Modules\Subscription\app\Providers; use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider; use Illuminate\Support\Facades\Route; class RouteServiceProvider extends ServiceProvider { /** * The module namespace to assume when generating URLs to actions. */ protected string $moduleNamespace = 'Modules\Subscription\app\Http\Controllers'; /** * Called before routes are registered. * * Register any model bindings or pattern based filters. */ public function boot(): void { parent::boot(); } /** * Define the routes for the application. */ public function map(): void { $this->mapApiRoutes(); $this->mapWebRoutes(); } /** * Define the "web" routes for the application. * * These routes all receive session state, CSRF protection, etc. */ protected function mapWebRoutes(): void { Route::middleware('web') ->namespace($this->moduleNamespace) ->group(module_path('Subscription', '/routes/web.php')); } /** * Define the "api" routes for the application. * * These routes are typically stateless. */ protected function mapApiRoutes(): void { Route::prefix('api') ->middleware('api') ->namespace($this->moduleNamespace) ->group(module_path('Subscription', '/routes/api.php')); } } app/Providers/.gitkeep 0000644 00000000000 15012227353 0010720 0 ustar 00 app/Providers/SubscriptionServiceProvider.php 0000644 00000006466 15012227353 0015546 0 ustar 00 <?php namespace Modules\Subscription\app\Providers; use Illuminate\Support\Facades\Blade; use Illuminate\Support\ServiceProvider; class SubscriptionServiceProvider extends ServiceProvider { protected string $moduleName = 'Subscription'; protected string $moduleNameLower = 'subscription'; /** * Boot the application events. */ public function boot(): void { $this->registerCommands(); $this->registerCommandSchedules(); $this->registerTranslations(); $this->registerConfig(); $this->registerViews(); $this->loadMigrationsFrom(module_path($this->moduleName, 'database/migrations')); } /** * Register the service provider. */ public function register(): void { $this->app->register(RouteServiceProvider::class); } /** * Register commands in the format of Command::class */ protected function registerCommands(): void { // $this->commands([]); } /** * Register command Schedules. */ protected function registerCommandSchedules(): void { // $this->app->booted(function () { // $schedule = $this->app->make(Schedule::class); // $schedule->command('inspire')->hourly(); // }); } /** * Register translations. */ public function registerTranslations(): void { $langPath = resource_path('lang/modules/'.$this->moduleNameLower); if (is_dir($langPath)) { $this->loadTranslationsFrom($langPath, $this->moduleNameLower); $this->loadJsonTranslationsFrom($langPath); } else { $this->loadTranslationsFrom(module_path($this->moduleName, 'lang'), $this->moduleNameLower); $this->loadJsonTranslationsFrom(module_path($this->moduleName, 'lang')); } } /** * Register config. */ protected function registerConfig(): void { $this->publishes([module_path($this->moduleName, 'config/config.php') => config_path($this->moduleNameLower.'.php')], 'config'); $this->mergeConfigFrom(module_path($this->moduleName, 'config/config.php'), $this->moduleNameLower); } /** * Register views. */ public function registerViews(): void { $viewPath = resource_path('views/modules/'.$this->moduleNameLower); $sourcePath = module_path($this->moduleName, 'resources/views'); $this->publishes([$sourcePath => $viewPath], ['views', $this->moduleNameLower.'-module-views']); $this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower); $componentNamespace = str_replace('/', '\\', config('modules.namespace').'\\'.$this->moduleName.'\\'.config('modules.paths.generator.component-class.path')); Blade::componentNamespace($componentNamespace, $this->moduleNameLower); } /** * Get the services provided by the provider. */ public function provides(): array { return []; } private function getPublishableViewPaths(): array { $paths = []; foreach (config('view.paths') as $path) { if (is_dir($path.'/modules/'.$this->moduleNameLower)) { $paths[] = $path.'/modules/'.$this->moduleNameLower; } } return $paths; } } database/factories/.gitkeep 0000644 00000000000 15012227353 0011706 0 ustar 00 database/migrations/.gitkeep 0000644 00000000000 15012227353 0012103 0 ustar 00 database/migrations/2023_11_12_064847_create_subscription_histories_table.php 0000644 00000004547 15012227353 0022623 0 ustar 00 <?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; use Modules\Subscription\app\Enums\SubscriptionStatusType; return new class extends Migration { /** * Run the migrations. */ public function up(): void { Schema::create('subscription_histories', function (Blueprint $table) { $table->id(); $table->uuid('uuid')->unique(); $table->integer('order_id')->nullable(); $table->integer('user_id'); $table->integer('subscription_plan_id'); $table->string('plan_name'); $table->float('plan_price', 8, 2); $table->string('expiration_date'); $table->string('expiration'); // write an extra migrate fields here depend on your project requirement // write an extra migrate fields here depend on your project requirement $table->string('status')->default('expired'); $table->string('payment_method'); $table->text('payment_details')->nullable(); $table->string('payable_amount')->default(0.00); $table->string('gateway_charge')->default(0.00); $table->string('payable_with_charge')->default(0.00); $table->string('paid_amount')->default(0.00); $table->string('payable_currency')->nullable(); $table->string('payment_status')->default(SubscriptionStatusType::INACTIVE_STATUS->value); $table->string('transaction'); $table->integer('number_of_aminities')->nullable(); $table->integer('number_of_nearest_place')->nullable(); $table->integer('number_of_photo')->nullable(); $table->integer('number_of_property')->nullable(); $table->integer('number_of_feature_property')->nullable(); $table->integer('number_of_top_property')->nullable(); $table->integer('number_of_urgent_property')->nullable(); $table->boolean('is_featured')->default(false); $table->boolean('is_top')->default(false); $table->boolean('is_urgent')->default(false); $table->timestamps(); }); } /** * Reverse the migrations. */ public function down(): void { Schema::dropIfExists('subscription_histories'); } }; database/migrations/error_log 0000644 00000001530 15012227353 0012400 0 ustar 00 [07-May-2025 04:28:33 UTC] PHP Fatal error: Uncaught Error: Class "Illuminate\Database\Migrations\Migration" not found in /home/lekhnath/silverray.com.au/Modules/Subscription/database/migrations/2023_11_12_064847_create_subscription_histories_table.php:8 Stack trace: #0 {main} thrown in /home/lekhnath/silverray.com.au/Modules/Subscription/database/migrations/2023_11_12_064847_create_subscription_histories_table.php on line 8 [07-May-2025 06:40:19 UTC] PHP Fatal error: Uncaught Error: Class "Illuminate\Database\Migrations\Migration" not found in /home/lekhnath/silverray.com.au/Modules/Subscription/database/migrations/2023_11_12_052417_create_subscription_plans_table.php:8 Stack trace: #0 {main} thrown in /home/lekhnath/silverray.com.au/Modules/Subscription/database/migrations/2023_11_12_052417_create_subscription_plans_table.php on line 8 database/migrations/2023_11_12_052417_create_subscription_plans_table.php 0000644 00000004264 15012227353 0021711 0 ustar 00 <?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; use Modules\Subscription\app\Enums\SubscriptionFeatures; return new class extends Migration { /** * Run the migrations. */ public function up(): void { Schema::create('subscription_plans', function (Blueprint $table) { $table->id(); $table->string('plan_name'); $table->decimal('plan_price', 8, 2); $table->string('expiration_date'); foreach (SubscriptionFeatures::all() as $feature) { $column = $feature['column']; $type = $feature['type']; $nullable = $feature['nullable']; $default = $feature['default']; $comment = isset($feature['comment']) ? $feature['comment'] : null; $columnDef = $table->$type($column); if ($nullable) { $columnDef->nullable(); } if (! is_null($default)) { $columnDef->default($default); } if ($comment) { $columnDef->comment($comment); } } $table->string('status'); $table->string('serial'); $table->integer('number_of_aminities')->nullable(); $table->integer('number_of_nearest_place')->nullable(); $table->integer('number_of_photo')->nullable(); $table->integer('number_of_property')->nullable(); $table->integer('number_of_feature_property')->nullable(); $table->integer('number_of_top_property')->nullable(); $table->integer('number_of_urgent_property')->nullable(); $table->boolean('is_featured')->default(false); $table->boolean('is_top')->default(false); $table->boolean('is_urgent')->default(false); $table->boolean('is_popular')->default(false); $table->timestamps(); }); } /** * Reverse the migrations. */ public function down(): void { Schema::dropIfExists('subscription_plans'); } }; database/seeders/.gitkeep 0000644 00000000000 15012227353 0011361 0 ustar 00 database/seeders/error_log 0000644 00000000546 15012227353 0011664 0 ustar 00 [13-May-2025 21:03:08 UTC] PHP Fatal error: Uncaught Error: Class "Illuminate\Database\Seeder" not found in /home/lekhnath/silverray.com.au/Modules/Subscription/database/seeders/SubscriptionDatabaseSeeder.php:7 Stack trace: #0 {main} thrown in /home/lekhnath/silverray.com.au/Modules/Subscription/database/seeders/SubscriptionDatabaseSeeder.php on line 7 database/seeders/SubscriptionDatabaseSeeder.php 0000644 00000000405 15012227353 0015713 0 ustar 00 <?php namespace Modules\Subscription\database\seeders; use Illuminate\Database\Seeder; class SubscriptionDatabaseSeeder extends Seeder { /** * Run the database seeds. */ public function run(): void { // $this->call([]); } } resources/assets/.gitkeep 0000644 00000000000 15012227353 0011477 0 ustar 00 resources/assets/js/app.js 0000644 00000000000 15012227353 0011600 0 ustar 00 resources/assets/sass/app.scss 0000644 00000000000 15012227353 0012474 0 ustar 00 resources/views/admin/sidebar.blade.php 0000644 00000003047 15012227353 0014177 0 ustar 00 <li class="nav-item dropdown {{ isRoute(['admin.subscription-plan.*', 'admin.plan-transaction-history', 'admin.assign-plan', 'admin.purchase-history-show', 'admin.pending-plan-transaction', 'admin.subscription-history'], 'active') }}"> <a href="#" class="nav-link has-dropdown" data-toggle="dropdown"><i class="fas fa-dollar-sign"></i> <span>{{ __('Subscription') }} <small class="me-3 badge bg-danger">{{ __('Add') }}</small> </span> </a> <ul class="dropdown-menu"> <li class="{{ isRoute('admin.subscription-plan.*', 'active') }}"><a class="nav-link" href="{{ route('admin.subscription-plan.index') }}">{{ __('Subscription Plan') }}</a></li> <li class="{{ isRoute(['admin.subscription-history', 'admin.purchase-history-show'], 'active') }}"> <a class="nav-link" href="{{ route('admin.subscription-history') }}">{{ __('Subscription History') }}</a> </li> <li class="{{ isRoute('admin.plan-transaction-history', 'active') }}"><a class="nav-link" href="{{ route('admin.plan-transaction-history') }}">{{ __('Transaction History') }}</a></li> <li class="{{ isRoute('admin.pending-plan-transaction', 'active') }}"><a class="nav-link" href="{{ route('admin.pending-plan-transaction') }}">{{ __('Pending Transaction') }}</a></li> <li class="{{ isRoute('admin.assign-plan', 'active') }}"><a class="nav-link" href="{{ route('admin.assign-plan') }}">{{ __('Assign Plan') }}</a></li> </ul> </li> resources/views/admin/purchase_history_show.blade.php 0000644 00000023713 15012227353 0017223 0 ustar 00 @extends('admin.master_layout') @section('title') <title>{{ __('Transaction History') }}</title> @endsection @section('admin-content') <div class="main-content"> <section class="section"> <x-admin.breadcrumb title="{{ __('Transaction History') }}" :list="[ __('Dashboard') => route('admin.dashboard'), __('Transaction History') => '#', ]" /> <div class="section-body"> <div class="row"> <div class="col-12 col-md-12 col-lg-12"> <div class="card"> <div class="card-body"> <div class="table-responsive"> <table class="table table-striped"> <tr> <td>{{ __('User') }}</td> <td><a href="">{{ $history?->user?->name }}</a></td> </tr> <tr> <td>{{ __('Plan') }}</td> <td>{{ $history->plan_name }}</td> </tr> <tr> <td>{{ __('Price') }}</td> <td>{{ currency($history->plan_price) }}</td> </tr> <tr> <td>{{ __('Expiration') }}</td> <td>{{ ucFirst($history->expiration) }}</td> </tr> <tr> <td>{{ __('Expiated Date') }}</td> <td>{{ $history->expiration == 'lifetime' ? 'Lifetime' : $history->expiration_date }}</td> </tr> <tr> <td>{{ __('Remaining day') }}</td> <td> @if ($history->status == 'active') @if ($history->expiration == 'lifetime') {{ __('Lifetime') }} @else @php $date1 = new DateTime(date('Y-m-d')); $date2 = new DateTime($history->expiration_date); $interval = $date1->diff($date2); $remaining = $interval->days; @endphp @if ($remaining > 0) {{ $remaining }} {{ __('Days') }} @else {{ __('Expired') }} @endif @endif @else {{ __('Expired') }} @endif </td> </tr> <tr> <td>{{ __('Payment Method') }}</td> <td>{{ $history->payment_method }}</td> </tr> <tr> <td>{{ __('Transaction') }}</td> <td>{!! nl2br($history->transaction) !!}</td> </tr> <tr> <td>{{ __('Plan Status') }}</td> <td> @if ($history->status == 'active') @if ($history->expiration_date == 'lifetime') <div class="badge bg-success">{{ __('Active') }}</div> @else @if (date('Y-m-d') <= $history->expiration_date) <div class="badge bg-success">{{ __('Active') }}</div> @else <div class="badge bg-danger">{{ __('Expired') }}</div> @endif @endif @elseif ($history->status == 'pending') <div class="badge bg-danger">{{ __('Pending') }}</div> @elseif ($history->status == 'expired') <div class="badge bg-danger">{{ __('Expired') }}</div> @endif </td> </tr> <tr> <td> {{ __('Payment') }} </td> <td> @if ($history->payment_status == 'success') <div class="badge bg-success">{{ __('Success') }}</div> @else <div class="badge bg-danger">{{ __('Pending') }}</div> @endif </td> </tr> </table> </div> <a href="" data-url="{{ route('admin.delete-plan-payment', $history->id) }}" class="btn btn-danger delete">{{ __('Delete') }}</a> @if ($history->payment_status == 'pending' && $history->transaction) <a href="javascript:;" data-bs-toggle="modal" data-bs-target="#paymentUpdate" class="btn btn-primary">{{ __('Payment approved') }}</a> @endif </div> </div> </div> </div> </div> </section> </div> <!-- Modal --> <div class="modal fade" id="paymentUpdate" tabindex="-1" role="dialog" aria-labelledby="modelTitleId" aria-hidden="true"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title">{{ __('Payment Approved') }}</h5> <button type="button" class="btn-close" data-bs-dismiss="modal"></button> </div> <div class="modal-body"> <div class="container-fluid"> <p class="text-danger">{{ __('Are you sure approved this payment ?') }}</p> </div> </div> <div class="modal-footer"> <form action="{{ route('admin.approved-plan-payment', $history->id) }}" method="POST"> @csrf @method('PUT') <x-admin.button variant="danger" data-bs-dismiss="modal" text="{{ __('Close') }}" /> <x-admin.button type="submit" text="{{ __('Yes, Approved') }}" /> </form> </div> </div> </div> </div> <div class="modal fade" tabindex="-1" role="dialog" id="delete"> <div class="modal-dialog" role="document"> <form action="" method="POST"> @csrf @method('DELETE') <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title">{{ __('Delete Purchase History') }}</h5> <button type="button" class="btn-close" data-bs-dismiss="modal"></button> </div> <div class="modal-body"> <p class="text-danger">{{ __('Are You Sure to Delete this Plan?') }}</p> </div> <div class="modal-footer"> <x-admin.button variant="danger" data-bs-dismiss="modal" text="{{ __('Close') }}" /> <x-admin.button type="submit" text="{{ __('Yes, Delete') }}" /> </div> </div> </form> </div> </div> @push('js') <script> $(function() { 'use strict' $('.delete').on('click', function(e) { e.preventDefault(); const modal = $('#delete'); modal.find('form').attr('action', $(this).data('url')); modal.modal('show'); }) }) </script> @endpush @endsection resources/views/admin/assign_plan.blade.php 0000644 00000006645 15012227353 0015073 0 ustar 00 @extends('admin.master_layout') @section('title') <title>{{ __('Assign Plan') }}</title> @endsection @section('admin-content') <div class="main-content"> <section class="section"> <x-admin.breadcrumb title="{{ __('Assign Plan') }}" :list="[ __('Dashboard') => route('admin.dashboard'), __('Assign Plan') => '#', ]" /> <div class="section-body"> <div class="alert alert-warning alert-has-icon"> <div class="alert-icon"><i class="far fa-lightbulb"></i></div> <div class="alert-body"> <div class="alert-title">{{ __('Warning') }}</div> {{ __('When a new plan will be assign to user, previous plan feature will be destroy') }} </div> </div> </div> <div class="section-body"> <div class="row"> <div class="col-12 col-md-12 col-lg-12"> <div class="card"> <div class="card-body"> <form action="{{ route('admin.store-assign-plan') }}" method="POST" enctype="multipart/form-data"> @csrf <div class="row"> <div class="form-group col-12"> <x-admin.form-select id="plan_id" name="plan_id" label="{{ __('Select Plan') }}" class="select2" required="true"> <x-admin.select-option value="" text="{{ __('Select') }}" /> @foreach ($plans as $plan) <x-admin.select-option :selected="old('plan_id') == $plan->id" value="{{ $plan->id }}" text="{{ $plan->plan_name }}" /> @endforeach </x-admin.form-select> </div> <div class="form-group col-12"> <x-admin.form-select id="user_id" name="user_id" label="{{ __('Select User') }}" class="select2" required="true"> <x-admin.select-option value="" text="{{ __('Select') }}" /> @foreach ($users as $user) <x-admin.select-option :selected="old('user_id') == $user->id" value="{{ $user->id }}" text="{{ $user->name }} - {{ $user->email }}" /> @endforeach </x-admin.form-select> </div> <div class="form-group col-md-12"> <x-admin.button type="submit" :text="__('Assign Plan')" /> </div> </div> </form> </div> </div> </div> </div> </div> </section> </div> @endsection resources/views/admin/subscription_list.blade.php 0000644 00000007535 15012227353 0016353 0 ustar 00 @extends('admin.master_layout') @section('title') <title>{{ __('Subscription Plan') }}</title> @endsection @section('admin-content') <div class="main-content"> <section class="section"> <x-admin.breadcrumb title="{{ __('Subscription Plan') }}" :list="[ __('Dashboard') => route('admin.dashboard'), __('Subscription Plan') => '#', ]" /> <div class="section-body"> <div class="row"> <div class="col-12 col-md-12 col-lg-12"> <div class="card"> <div class="card-header d-flex justify-content-between"> <x-admin.form-title :text="__('Subscription Plan')" /> <div> <x-admin.add-button :href="route('admin.subscription-plan.create')" /> </div> </div> <div class="card-body text-center"> <div class="table-responsive"> <table class="table table-striped"> <tr> <th>{{ __('Serial') }}</th> <th>{{ __('Name') }}</th> <th>{{ __('Price') }}</th> <th>{{ __('Expiration') }}</th> <th>{{ __('Status') }}</th> <th>{{ __('Action') }}</th> </tr> @forelse ($plans as $index => $plan) <tr> <td>{{ $plan->serial }}</td> <td>{{ $plan->plan_name }}</td> <td>{{ currency($plan->plan_price) }}</td> <td>{{ $plan->expiration_date }}</td> <td> @if ($plan->status == 'active') <div class="badge bg-success">{{ __('Active') }}</div> @else <div class="badge bg-danger">{{ __('Inactive') }}</div> @endif </td> <td> <x-admin.edit-button :href="route('admin.subscription-plan.edit', $plan->id)" /> <x-admin.delete-button :id="$plan->id" onclick="deleteData" /> </td> </tr> @empty <x-empty-table :name="__('Subscription')" route="admin.subscription-plan.create" create="yes" :message="__('No data found!')" colspan="6" /> @endforelse </table> </div> </div> </div> </div> </div> </div> </section> </div> <x-admin.delete-modal /> @endsection @push('js') <script> "use strict" function deleteData(id) { $("#deleteForm").attr("action", '{{ url('/admin/subscription-plan/') }}' + "/" + id) } </script> @endpush resources/views/admin/subscription_edit.blade.php 0000644 00000023437 15012227353 0016324 0 ustar 00 @extends('admin.master_layout') @section('title') <title>{{ __('Edit Plan') }}</title> @endsection @section('admin-content') <div class="main-content"> <section class="section"> <x-admin.breadcrumb title="{{ __('Edit Plan') }}" :list="[ __('Dashboard') => route('admin.dashboard'), __('Subscription Plan') => route('admin.subscription-plan.index'), __('Edit Plan') => '#', ]" /> <div class="section-body"> <div class="row"> <div class="col-12 col-md-12 col-lg-12"> <div class="card"> <div class="card-header d-flex justify-content-between"> <x-admin.form-title :text="__('Edit Plan')" /> <x-admin.form-title :text="__('(Unlimitd Quantity = -1)')" /> <div> <x-admin.back-button :href="route('admin.subscription-plan.index')" /> </div> </div> <div class="card-body"> <form action="{{ route('admin.subscription-plan.update', $plan->id) }}" method="POST" enctype="multipart/form-data"> @csrf @method('PUT') <div class="row"> <div class="form-group col-md-6"> <x-admin.form-input id="plan_name" name="plan_name" label="{{ __('Plan Name') }}" placeholder="{{ __('Enter Plan Name') }}" value="{{ $plan->plan_name }}" required="true"/> </div> <div class="form-group col-md-6"> <x-admin.form-input id="plan_price" name="plan_price" label="{{ __('Plan Price') }}" placeholder="{{ __('Enter Plan Price') }}" value="{{ $plan->plan_price }}" type="number" required="true"/> </div> <div class="form-group col-md-6"> <x-admin.form-select id="expiration_date" name="expiration_date" label="{{ __('Expiration Date') }}" class="form-select" required="true"> <x-admin.select-option :selected="$plan->expiration_date == 'monthly'" value="monthly" text="{{ __('Monthly') }}" /> <x-admin.select-option :selected="$plan->expiration_date == 'yearly'" value="yearly" text="{{ __('Yearly') }}" /> <x-admin.select-option :selected="$plan->expiration_date == 'lifetime'" value="lifetime" text="{{ __('Lifetime') }}" /> </x-admin.form-select> </div> <div class="form-group col-md-6"> <x-admin.form-input id="serial" name="serial" label="{{ __('Serial') }}" placeholder="{{ __('Enter Serial') }}" value="{{ $plan->serial }}" type="number" required="true"/> </div> <div class="form-group col-md-6"> <label for="number_of_property">{{ __('Number Of Property') }} <span class="text-danger">*</span></label> <input type="number" name="number_of_property" class="form-control" id="number_of_property" value="{{ $plan->number_of_property }}"> @error('number_of_property') <span class="text-danger">{{ $message }}</span> @enderror </div> <div class="form-group col-md-6"> <label for="feature">{{ __('Allow Feature') }} <span class="text-danger">*</span></label> <select name="feature" id="feature" class="form-control"> <option value="1" {{ $plan->is_featured == 1 ? 'selected':'' }}>{{ __('Yes') }}</option> <option value="0" {{ $plan->is_featured == 0 ? 'selected':'' }}>{{ __('No') }}</option> </select> @error('feature') <span class="text-danger">{{ $message }}</span> @enderror </div> <div class="form-group col-md-6"> <label for="number_of_feature_property">{{ __('Number Of Featured Property') }} <span class="text-danger">*</span></label> <input type="number" name="number_of_feature_property" id="number_of_feature_property" class="form-control" value="{{ $plan->number_of_feature_property }}"> @error('number_of_feature_property') <span class="text-danger">{{ $message }}</span> @enderror </div> <div class="form-group col-md-6"> <label for="top_property">{{ __('Allow Top Property') }} <span class="text-danger">*</span></label> <select name="top_property" id="top_property" class="form-control"> <option value="1" {{ $plan->is_top == 1 ? 'selected':'' }}>{{ __('Yes') }}</option> <option value="0" {{ $plan->is_top == 0 ? 'selected':'' }}>{{ __('No') }}</option> </select> @error('top_property') <span class="text-danger">{{ $message }}</span> @enderror </div> <div class="form-group col-md-6"> <label for="number_of_top_property">{{ __('Number Of Top Property') }} <span class="text-danger">*</span></label> <input type="number" name="number_of_top_property" id="number_of_top_property" class="form-control" value="{{ $plan->number_of_top_property }}"> @error('number_of_top_property') <span class="text-danger">{{ $message }}</span> @enderror </div> <div class="form-group col-md-6"> <label for="urgent">{{ __('Allow Urgent Property') }}<span class="text-danger">*</span></label> <select name="urgent" id="urgent" class="form-control"> <option value="1" {{ $plan->is_urgent == 1 ? 'selected':'' }}>{{ __('Yes') }}</option> <option value="0" {{ $plan->is_urgent == 0 ? 'selected':'' }}>{{ __('No') }}</option> </select> @error('urgent') <span class="text-danger">{{ $message }}</span> @enderror </div> <div class="form-group col-md-6"> <label for="number_of_urgent_property">{{ __('Number Of Urgent Property') }} <span class="text-danger">*</span></label> <input type="number" name="number_of_urgent_property" id="number_of_urgent_property" class="form-control" value="{{ $plan->number_of_urgent_property }}"> @error('number_of_urgent_property') <span class="text-danger">{{ $message }}</span> @enderror </div> <div class="form-group col-md-12"> <div class="form-group"> <x-admin.form-switch name="status" label="{{ __('Status') }}" active_value="active" inactive_value="inactive" :checked="$plan->status == 'active'"/> </div> </div> <div class="form-group col-md-12"> <x-admin.update-button :text="__('Update')" /> </div> </div> </form> </div> </div> </div> </div> </div> </section> </div> @endsection resources/views/admin/subscription_create.blade.php 0000644 00000023435 15012227353 0016640 0 ustar 00 @extends('admin.master_layout') @section('title') <title>{{ __('Create Plan') }}</title> @endsection @section('admin-content') <div class="main-content"> <section class="section"> <x-admin.breadcrumb title="{{ __('Create Plan') }}" :list="[ __('Dashboard') => route('admin.dashboard'), __('Subscription Plan') => route('admin.subscription-plan.index'), __('Create Plan') => '#', ]" /> <div class="section-body"> <div class="row"> <div class="col-12 col-md-12 col-lg-12"> <div class="card"> <div class="card-header d-flex justify-content-between"> <x-admin.form-title :text="__('Create Plan')" /> <x-admin.form-title :text="__('(Unlimitd Quantity = -1)')" /> <div> <x-admin.back-button :href="route('admin.subscription-plan.index')" /> </div> </div> <div class="card-body"> <form action="{{ route('admin.subscription-plan.store') }}" method="POST" enctype="multipart/form-data"> @csrf <div class="row"> <div class="form-group col-md-6"> <x-admin.form-input id="plan_name" name="plan_name" label="{{ __('Plan Name') }}" value="{{ old('plan_name') }}" required="true" /> </div> <div class="form-group col-md-6"> <x-admin.form-input id="plan_price" name="plan_price" label="{{ __('Plan Price') }}" value="{{ old('plan_price') }}" type="number" required="true" /> </div> <div class="form-group col-md-6"> <x-admin.form-select id="expiration_date" name="expiration_date" label="{{ __('Expiration Date') }}" class="form-select" required="true"> <x-admin.select-option :selected="old('expiration_date') == 'monthly'" value="monthly" text="{{ __('Monthly') }}" /> <x-admin.select-option :selected="old('expiration_date') == 'yearly'" value="yearly" text="{{ __('Yearly') }}" /> <x-admin.select-option :selected="old('expiration_date') == 'lifetime'" value="lifetime" text="{{ __('Lifetime') }}" /> </x-admin.form-select> </div> <div class="form-group col-md-6"> <x-admin.form-input id="serial" name="serial" label="{{ __('Serial') }}" value="{{ old('serial') }}" type="number" required="true" /> </div> {{-- write your extra input field here depand on your project requirement --}} <div class="form-group col-md-6"> <label for="number_of_property">{{ __('Number Of Property') }} <span class="text-danger">*</span></label> <input type="number" name="number_of_property" class="form-control" id="number_of_property" value="{{ old('number_of_property') }}"> @error('number_of_property') <span class="text-danger">{{ $message }}</span> @enderror </div> <div class="form-group col-md-6"> <label for="feature">{{ __('Allow Feature') }} <span class="text-danger">*</span></label> <select name="feature" id="feature" class="form-control"> <option value="1">{{ __('Yes') }}</option> <option value="0">{{ __('No') }}</option> </select> @error('feature') <span class="text-danger">{{ $message }}</span> @enderror </div> <div class="form-group col-md-6"> <label for="number_of_feature_property">{{ __('Number Of Featured Property') }} <span class="text-danger">*</span></label> <input type="number" name="number_of_feature_property" id="number_of_feature_property" class="form-control" value="{{ old('number_of_feature_property') }}"> @error('number_of_feature_property') <span class="text-danger">{{ $message }}</span> @enderror </div> <div class="form-group col-md-6"> <label for="top_property">{{ __('Allow Top Property') }} <span class="text-danger">*</span></label> <select name="top_property" id="top_property" class="form-control"> <option value="1">{{ __('Yes') }}</option> <option value="0">{{ __('No') }}</option> </select> @error('top_property') <span class="text-danger">{{ $message }}</span> @enderror </div> <div class="form-group col-md-6"> <label for="number_of_top_property">{{ __('Number Of Top Property') }} <span class="text-danger">*</span></label> <input type="number" name="number_of_top_property" id="number_of_top_property" class="form-control" value="{{ old('number_of_top_property') }}"> @error('number_of_top_property') <span class="text-danger">{{ $message }}</span> @enderror </div> <div class="form-group col-md-6"> <label for="urgent">{{ __('Allow Urgent Property') }}<span class="text-danger">*</span></label> <select name="urgent" id="urgent" class="form-control"> <option value="1">{{ __('Yes') }}</option> <option value="0">{{ __('No') }}</option> </select> @error('urgent') <span class="text-danger">{{ $message }}</span> @enderror </div> <div class="form-group col-md-6"> <label for="number_of_urgent_property">{{ __('Number Of Urgent Property') }} <span class="text-danger">*</span></label> <input type="number" name="number_of_urgent_property" id="number_of_urgent_property" class="form-control" value="{{ old('number_of_urgent_property') }}"> @error('number_of_urgent_property') <span class="text-danger">{{ $message }}</span> @enderror </div> <div class="col-md-12"> <div class="form-group"> <x-admin.form-switch name="status" label="{{ __('Status') }}" active_value="active" inactive_value="inactive" :checked="old('status') == 'active'" /> </div> </div> <div class="form-group col-md-12"> <x-admin.save-button :text="__('Save')" /> </div> </div> </form> </div> </div> </div> </div> </div> </section> </div> @endsection resources/views/admin/subscription_history.blade.php 0000644 00000021165 15012227353 0017074 0 ustar 00 @extends('admin.master_layout') @section('title') <title>{{ __('Subscription History') }}</title> @endsection @section('admin-content') <div class="main-content"> <section class="section"> <x-admin.breadcrumb title="{{ __('Subscription History') }}" :list="[ __('Dashboard') => route('admin.dashboard'), __('Subscription History') => '#', ]" /> <div class="section-body"> <div class="row"> <div class="col-12 col-md-12 col-lg-12"> <div class="card"> <div class="card-body text-center"> <div class="table-responsive"> <table class="table table-striped"> <tr> <th>{{ __('Serial') }}</th> <th>{{ __('User') }}</th> <th>{{ __('Plan') }}</th> <th>{{ __('Expiration') }}</th> <th>{{ __('Remaining') }}</th> <th>{{ __('Status') }}</th> <th>{{ __('Action') }}</th> </tr> @forelse ($histories as $index => $history) <tr> <td>{{ ++$index }}</td> <td><a href="">{{ $history?->user?->name }}</a></td> <td>{{ $history->plan_name }}</td> <td>{{ $history->expiration }}</td> <td> @if ($history->expiration == 'lifetime') {{ __('Lifetime') }} @else @php $date1 = new DateTime(date('Y-m-d')); $date2 = new DateTime($history->expiration_date); $interval = $date1->diff($date2); $remaining = $interval->days; @endphp @if ($remaining > 0) {{ $remaining }} {{ __('Days') }} @else {{ __('Expired') }} @endif @endif </td> <td> @if ($history->expiration_date == 'lifetime') <div class="badge bg-success">{{ __('Active') }}</div> @else @if (date('Y-m-d') <= $history->expiration_date) <div class="badge bg-success">{{ __('Active') }}</div> @else <div class="badge bg-danger">{{ __('Expired') }}</div> @endif @endif </td> <td> <a href="{{ route('admin.purchase-history-show', $history->id) }}" class="btn btn-primary btn-sm"><i class="fa fa-eye"></i></a> <a href="javascript:;" data-url="{{ route('admin.plan-renew', $history->id) }}" class="btn btn-success btn-sm plan_renew"><i class="fa fa-sync-alt"></i></a> <a href="javascript:;" data-url="{{ route('admin.delete-plan-payment', $history->id) }}" class="btn btn-danger btn-sm delete"><i class="fa fa-trash"></i></a> </td> </tr> @empty <x-empty-table :name="__('Subscription')" route="admin.subscription-plan.create" create="yes" :message="__('No data found!')" colspan="6"></x-empty-table> @endforelse </table> </div> </div> @if ($histories->hasPages()) <div class="card-footer"> {{ $histories->links('admin.paginate_box') }} </div> @endif </div> </div> </div> </div> </section> </div> <div class="modal fade" tabindex="-1" role="dialog" id="delete"> <div class="modal-dialog" role="document"> <form action="" method="POST"> @csrf @method('DELETE') <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title">{{ __('Delete subscription history') }}</h5> <button type="button" class="btn-close" data-bs-dismiss="modal"></button> </div> <div class="modal-body"> <p class="text-danger">{{ __('Are You Sure to Delete this Plan?') }}</p> </div> <div class="modal-footer"> <x-admin.button variant="danger" data-bs-dismiss="modal" text="{{ __('Close') }}" /> <x-admin.button type="submit" text="{{ __('Yes, Delete') }}" /> </div> </div> </form> </div> </div> <div class="modal fade" tabindex="-1" role="dialog" id="plan_renew"> <div class="modal-dialog" role="document"> <form action="" method="POST"> @csrf @method('PUT') <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title">{{ __('Subscription Renew') }}</h5> <button type="button" class="btn-close" data-bs-dismiss="modal"></button> </div> <div class="modal-body"> <p class="text-danger">{{ __('Are you really want to renew this subscription?') }}</p> </div> <div class="modal-footer"> <x-admin.button variant="danger" data-bs-dismiss="modal" text="{{ __('Close') }}" /> <x-admin.button type="submit" text="{{ __('Yes, Renew') }}" /> </div> </div> </form> </div> </div> @push('js') <script> $(function() { 'use strict' $('.delete').on('click', function(e) { e.preventDefault(); const modal = $('#delete'); modal.find('form').attr('action', $(this).data('url')); modal.modal('show'); }) $('.plan_renew').on('click', function(e) { e.preventDefault(); const modal = $('#plan_renew'); modal.find('form').attr('action', $(this).data('url')); modal.modal('show'); }) }) </script> @endpush @endsection resources/views/admin/purchase_history.blade.php 0000644 00000024540 15012227353 0016162 0 ustar 00 @extends('admin.master_layout') @section('title') <title>{{ $title }}</title> @endsection @section('admin-content') <div class="main-content"> <section class="section"> <x-admin.breadcrumb title="{{ $title }}" :list="[ __('Dashboard') => route('admin.dashboard'), $title => '#', ]" /> <div class="section-body"> <div class="row"> {{-- Search filter --}} <div class="col-12"> <div class="card"> <div class="card-body pb-1"> <form action="{{ url()->current() }}" method="GET" onchange="$(this).trigger('submit')"> <div class="row"> <div class="{{ Route::is('admin.plan-transaction-history') ? 'col-md-6 ' : 'col-md-6' }} col-lg-4 form-group mb-3"> <x-admin.form-input name="keyword" placeholder="{{ __('Search') }}" value="{{ request()->get('keyword') }}" /> </div> @if (Route::is('admin.plan-transaction-history')) <div class="col-lg-4 col-md-6 form-group mb-3"> <x-admin.form-select name="status" id="status" class="form-select"> <x-admin.select-option value="" text="{{ __('Select Status') }}" /> <x-admin.select-option :selected="request('status') == 'active'" value="active" text="{{ __('Active') }}" /> <x-admin.select-option :selected="request('status') == 'inactive'" value="inactive" text="{{ __('In-Active') }}" /> </x-admin.form-select> </div> @endif <div class="col-lg-4 col-md-6 form-group mb-3"> <x-admin.form-select name="user" id="user" class="select2"> <x-admin.select-option value="" text="{{ __('Select user') }}" /> @foreach ($users as $user) <x-admin.select-option :selected="$user->id == request('user')" value="{{ $user->id }}" text="{{ $user->name }}" /> @endforeach </x-admin.form-select> </div> <div class="col-lg-4 col-md-6 form-group mb-3"> <x-admin.form-select name="order_by" id="order_by" class="form-select"> <x-admin.select-option value="" text="{{ __('Order By') }}" /> <x-admin.select-option :selected="request('order_by') == '1'" value="1" text="{{ __('ASC') }}" /> <x-admin.select-option :selected="request('order_by') == '0'" value="0" text="{{ __('DESC') }}" /> </x-admin.form-select> </div> <div class="col-lg-4 col-md-6 form-group mb-3"> <x-admin.form-select name="par-page" id="par-page" class="form-select"> <x-admin.select-option value="" text="{{ __('Per Page') }}" /> <x-admin.select-option :selected="request('par-page') == '5'" value="5" text="{{ __('5') }}" /> <x-admin.select-option :selected="request('par-page') == '10'" value="10" text="{{ __('10') }}" /> <x-admin.select-option :selected="request('par-page') == '25'" value="25" text="{{ __('25') }}" /> <x-admin.select-option :selected="request('par-page') == '50'" value="50" text="{{ __('50') }}" /> <x-admin.select-option :selected="request('par-page') == '100'" value="100" text="{{ __('100') }}" /> <x-admin.select-option :selected="request('par-page') == 'all'" value="all" text="{{ __('All') }}" /> </x-admin.form-select> </div> </div> </form> </div> </div> </div> <div class="col-12 col-md-12 col-lg-12"> <div class="card"> <div class="card-body text-center"> <div class="table-responsive"> <table class="table table-striped"> <tr> <th>{{ __('SN') }}</th> <th>{{ __('User') }}</th> <th>{{ __('Plan') }}</th> <th>{{ __('Price') }}</th> <th>{{ __('Payment') }}</th> <th>{{ __('Action') }}</th> </tr> @forelse ($histories as $index => $history) <tr> <td>{{ ++$index }}</td> <td><a href="">{{ $history?->user?->name }}</a></td> <td>{{ $history->plan_name }}</td> <td>{{ currency($history->plan_price) }}</td> <td> @if ($history->payment_status == 'success') <div class="badge bg-success">{{ __('Success') }}</div> @else <div class="badge bg-danger">{{ __('Pending') }}</div> @endif </td> <td> <a href="{{ route('admin.purchase-history-show', $history->id) }}" class="btn btn-primary btn-sm"><i class="fa fa-eye"></i></a> <a href="javascript:;" data-url="{{ route('admin.delete-plan-payment', $history->id) }}" class="btn btn-danger btn-sm delete"><i class="fa fa-trash"></i></a> </td> </tr> @empty <x-empty-table :name="__('')" route="admin.subscription-plan.create" create="no" :message="__('No data found!')" colspan="6"></x-empty-table> @endforelse </table> </div> @if (request()->get('par-page') !== 'all') <div class="float-right"> {{ $histories->onEachSide(0)->links() }} </div> @endif </div> </div> </div> </div> </div> </section> </div> <div class="modal fade" tabindex="-1" role="dialog" id="delete"> <div class="modal-dialog" role="document"> <form action="" method="POST"> @csrf @method('DELETE') <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title">{{ __('Delete Purchase History') }}</h5> <button type="button" class="btn-close" data-bs-dismiss="modal"></button> </div> <div class="modal-body"> <p class="text-danger">{{ __('Are You Sure to Delete this Plan?') }}</p> </div> <div class="modal-footer"> <x-admin.button variant="danger" data-bs-dismiss="modal" text="{{ __('Close') }}" /> <x-admin.button type="submit" text="{{ __('Yes, Delete') }}" /> </div> </div> </form> </div> </div> @endsection @push('js') <script> $(function() { 'use strict' $('.delete').on('click', function(e) { e.preventDefault(); const modal = $('#delete'); modal.find('form').attr('action', $(this).data('url')); modal.modal('show'); }) }) </script> @endpush resources/views/user/show_subscription_history.blade.php 0000644 00000010264 15012227353 0020020 0 ustar 00 @extends('user.layout') @section('title') <title>{{ __('Transaction History') }}</title> @endsection @section('user-dashboard') <div class="wsus__dashboard_main_content"> <div class="wsus__dash_invoice"> <div class="wsus__dash_info p_25 mb_25"> <div class="row"> <div class="col-xl-6 col-md-6"> <div class="invoice_left"> <a href="{{ route('home') }}"> <img src="{{ asset($setting->logo) }}" alt="topland" class="img-fluid"> </a> <h4>{{ $subscriptionHistory->user->name }}</h4> <p>{{ $subscriptionHistory->user->email }}</p> @if ($subscriptionHistory->user->phone) <p>{{ $subscriptionHistory->user->phone }}</p> @endif @if ($subscriptionHistory->user->address) <p>{{ $subscriptionHistory->user->address }}</p> @endif </div> </div> <div class="col-xl-6 col-md-6"> <div class="invoice_left invoice_right"> <h4>{{ __('Subscription Id') }}: {{ $subscriptionHistory->order_id }}</h4> <p>{{ __('Amount') }}: {{ currency($subscriptionHistory->plan_price) }}</p> @if ($subscriptionHistory->payment_method) <p>{{ __('Payment Method') }}: {{ $subscriptionHistory->payment_method }}</p> @endif @if ($subscriptionHistory->transaction) @if ($subscriptionHistory->payment_method == 'directBank') <p>{{ __('Payment Information') }}: {!! clean(nl2br(e($subscriptionHistory->transaction))) !!} </p> @else <p>{{ __('Transaction Id') }}: {!! clean(nl2br(e($subscriptionHistory->transaction))) !!} </p> @endif @endif </div> </div> <div class="col-12"> <div class="table-responsive"> <table class="table"> <tr> <th class="packages">{{ __('Plan Name') }}</th> <th class="p_date">{{ __('Purchase Date') }}</th> <th class="e_date">{{ __('Expired Date') }}</th> <th class="amount">{{ __('Amount') }}</th> </tr> <tr> <td class="packages"> {{ $subscriptionHistory->plan_name }} </td> <td class="p_date"> {{ date('Y-m-d', strtotime($subscriptionHistory->created_at)) }} </td> <td class="e_date"> @if ($subscriptionHistory->expiration == 'lifetime') {{ __('Lifetime') }} @else {{ date('Y-m-d', strtotime($subscriptionHistory->expiration_date)) }} @endif </td> <td class="amount"> {{ currency($subscriptionHistory->plan_price) }} </td> </tr> </table> </div> </div> </div> </div> <a onclick="window.print()" href="javascript:;" class="common_btn invoice_print">{{ __('Print') }}</a> </div> </div> @endsection resources/views/user/pricing-plan.blade.php 0000644 00000015643 15012227353 0015044 0 ustar 00 @extends('user.layout') @section('title') <title>{{ __('Pricing Plan') }}</title> @endsection @section('user-dashboard') <div class="wsus__dashboard_main_content"> <div class="wsus__my_property"> <h4 class="heading">{{ __('Pricing Plan') }}</h4> <div class="row"> @foreach ($subscriptionPlans as $index => $plan) <div class="col-xl-6 col-xxl-4 col-md-6 col-lg"> <div class="wsus__single_price"> <h4>{{ $plan->plan_name }}</h4> <div class="wsus__round_area"> <h3>{{ currency($plan->plan_price) }}</h3> @if ($plan->expiration_date == 'monthly') <p>/30 {{ __('Days') }}</p> @elseif($plan->expiration_date == 'yearly') <p>/365 {{ __('Days') }}</p> @elseif($plan->expiration_date == 'lifetime') <p>/{{ __('Unlimited') }}</p> @endif <i class="fab fa-canadian-maple-leaf right"></i> </div> <ul> @if ($plan->number_of_property == -1) <li>{{ __('Unlimited Property Submission') }}</li> @else <li>{{ $plan->number_of_property }} {{ __('Propertiy Submission') }}</li> @endif <li>{{ __('Unlimited Amenity') }}</li> <li>{{ __('Unlimited Nearest Place') }}</li> <li>{{ __('Unlimited Photo') }}</li> @if ($plan->is_featured == 1) <li>{{ __('Featured Property') }}</li> @else <li class="delete">{{ __('Featured Property') }}</li> @endif @if ($plan->number_of_feature_property == -1) <li>{{ __('Unlimited Featured Property') }}</li> @else <li>{{ $plan->number_of_feature_property }} {{ __('Featured Property') }}</li> @endif @if ($plan->is_top == 1) <li>{{ __('Top Property') }}</li> @else <li class="delete">{{ __('Top Property') }}</li> @endif @if ($plan->number_of_top_property == -1) <li>{{ __('Unlimited Top Property') }}</li> @else <li>{{ $plan->number_of_top_property }} {{ __('Top Property') }}</li> @endif @if ($plan->is_urgent == 1) <li>{{ __('Urgent Property') }}</li> @else <li class="delete">{{ __('Urgent Property') }}</li> @endif @if ($plan->number_of_urgent_property == -1) <li>{{ __('Unlimited Urgent Property') }}</li> @else <li>{{ $plan->number_of_urgent_property }} {{ __('Urgent Property') }}</li> @endif </ul> @if ($plan->plan_price == 0) @if ($activeOrder && ($activeOrder->subscription_plan_id == $plan->id)) <a href="javascript:;" onclick="freeRenewEnroll('{{ $activeOrder->id }}')" class="common_btn active_btn">{{ __('Renew With') }} {{ $plan->plan_name }}</a> @else <a href="javascript:;" onclick="freeEnroll('{{ $plan->id }}')" class="common_btn">{{ __('Start With') }} {{ $plan->plan_name }}</a> @endif @else @if ($activeOrder && ($activeOrder->subscription_plan_id == $plan->id)) <a href="{{ route('subscription.renew.package', $activeOrder->id) }}" class="common_btn active_btn">{{ __('Renew With') }} {{ $plan->plan_name }}</a> @else <a href="{{ route('subscription.purchase.package', $plan->id) }}" class="common_btn">{{ __('Start With') }} {{ $plan->plan_name }}</a> @endif @endif </div> </div> @endforeach </div> </div> </div> @endsection @push('js') <script> function freeEnroll(id) { Swal.fire({ title: "{{ __('Are You Sure ?') }}", text: "{{ __('You will also upgrade your plan!') }}", icon: 'warning', showCancelButton: true, confirmButtonColor: '#3085d6', cancelButtonColor: '#d33', confirmButtonText: "{{ __('Yes, Enroll It') }}", cancelButtonText: "{{ __('Cancel') }}", }).then((result) => { if (result.isConfirmed) { Swal.fire( "{{ __('Enrolled') }}", "{{ __('Congrats to Enroll our Free Plan') }}", 'success' ) location.href = "{{ url('subscription/purchase-package/') }}" + "/" + id; } }) } function freeRenewEnroll(id) { Swal.fire({ title: "{{ __('Are You Sure ?') }}", text: "{{ __('You will also upgrade your plan!') }}", icon: 'warning', showCancelButton: true, confirmButtonColor: '#3085d6', cancelButtonColor: '#d33', confirmButtonText: "{{ __('Yes, Enroll It') }}", cancelButtonText: "{{ __('Cancel') }}", }).then((result) => { if (result.isConfirmed) { Swal.fire( "{{ __('Enrolled') }}", "{{ __('Congrats to Enroll our Free Plan') }}", 'success' ) location.href = "{{ url('subscription/renew-package/') }}" + "/" + id; } }) } </script> @endpush resources/views/user/payment.blade.php 0000644 00000024166 15012227353 0014136 0 ustar 00 @extends('layout1') @section('title') <title>{{ __('Payment') }}</title> @endsection @section('meta') <meta name="description" content="Payment"> @endsection @section('frontend-content') <!--===BREADCRUMB PART START====--> <section class="wsus__breadcrumb" style="background: url({{ $setting->breadcrumb_image ? asset($setting->breadcrumb_image) : '' }});"> <div class="wsus_bread_overlay"> <div class="container"> <div class="row"> <div class="col-12 text-center"> <h4>{{ __('Payment') }}</h4> <nav style="--bs-breadcrumb-divider: '-';" aria-label="breadcrumb"> <ol class="breadcrumb"> <li class="breadcrumb-item"><a href="{{ route('home') }}">{{ __('Home') }}</a></li> <li class="breadcrumb-item active" aria-current="page">{{ __('Payment') }}</li> </ol> </nav> </div> </div> </div> </div> </section> <!--===BREADCRUMB PART END====--> <!--=====CHECKOUT START=====--> <section class="wsus__checkout mt_45 mb_45"> <div class="container"> <div class="row"> <div class="col-xl-2 col-lg-3"> <div class="wsus__pay_method" id="sticky_sidebar"> <h5>{{ __('Payment Method') }}</h5> <div class="d-flex align-items-start"> <div class="nav flex-column nav-pills" id="v-pills-tab" role="tablist" aria-orientation="vertical"> @foreach ($activeGateways as $gatewayKey => $gatewayDetails) <button class="nav-link {{ $gatewayKey == 'stripe' ? 'active': '' }}" id="v-pills-{{ $gatewayKey }}-tab" data-bs-toggle="pill" data-bs-target="#v-pills-{{ $gatewayKey }}" type="button" role="tab" aria-controls="v-pills-{{ $gatewayKey }}" aria-selected="true">{{ $gatewayDetails['name'] }}</button> @endforeach </div> </div> </div> </div> <div class="col-xl-5 col-lg-4"> <div class="wsus__pay_details" id="sticky_sidebar2"> <h5>{{ __('Payment Details') }}</h5> <div class="tab-content" id="v-pills-tabContent"> @foreach ($activeGateways as $gatewayKey => $gatewayDetails) <div class="tab-pane fade {{ $gatewayKey == 'stripe' ? 'show active':'' }}" id="v-pills-{{ $gatewayKey }}" role="tabpanel" aria-labelledby="v-pills-{{ $gatewayKey }}-tab"> <a href="javascript:;" class="common_btn place-order-btn" data-method="{{ $gatewayKey }}">{{ __('Pay With') }} {{ $gatewayDetails['name'] }}</a> </div> @endforeach </div> </div> </div> <div class="col-xl-5 col-lg-5"> <div class="wsus__package_details"> <h5>{{ __('Package Details') }}</h5> <div class="table-responsive main_table"> <table class="table"> <tr> <td width="50%">{{ __('Plan Name') }}</td> <td width="50%">{{ $plan->plan_name }}</td> </tr> <tr> <td width="50%">{{ __('Price') }}</td> <td width="50%">{{ currency($plan->plan_price) }}</td> </tr> <tr> <td width="50%">{{ __('Expired Date') }}</td> <td width="50%"> @if ($plan->expiration_date == 'monthly') 30 {{ __('Days') }} @elseif($plan->expiration_date == 'yearly') 365 {{ __('Days') }} @elseif($plan->expiration_date == 'lifetime') {{ __('Lifetime') }} @endif </td> </tr> <tr> <td width="50%">{{ __('Property') }}</td> <td width="50%"> @if ($plan->number_of_property == -1) {{ __('Unlimited') }} @else {{ $plan->number_of_property }} @endif </td> </tr> <tr> <td width="50%">{{ __('Amenity') }}</td> <td width="50%"> {{ __('Unlimited') }} </td> </tr> <tr> <td width="50%">{{ __('Nearest Place') }}</td> <td width="50%"> {{ __('Unlimited') }} </td> </tr> <tr> <td width="50%">{{ __('Photo') }}</td> <td width="50%"> {{ __('Unlimited') }} </td> </tr> <tr> <td width="50%">{{ __('Featured Property') }}</td> <td width="50%"> @if ($plan->is_featured == 1) {{ __('Available') }} @else {{ __('Not Available') }} @endif </td> </tr> <tr> <td width="50%">{{ __('Featured Property') }}</td> <td width="50%"> @if ($plan->number_of_feature_property == -1) {{ __('Unlimited') }} @else {{ $plan->number_of_feature_property }} @endif </td> </tr> <tr> <td width="50%">{{ __('Top Property') }}</td> <td width="50%"> @if ($plan->is_top == 1) {{ __('Available') }} @else {{ __('Not Available') }} @endif </td> </tr> <tr> <td width="50%">{{ __('Top Property') }}</td> <td width="50%"> @if ($plan->number_of_top_property == -1) {{ __('Unlimited') }} @else {{ $plan->number_of_top_property }} @endif </td> </tr> <tr> <td width="50%">{{ __('Urgent Property') }}</td> <td width="50%"> @if ($plan->is_urgent == 1) {{ __('Available') }} @else {{ __('Not Available') }} @endif </td> </tr> <tr> <td width="50%">{{ __('Urgent Property') }}</td> <td width="50%"> @if ($plan->number_of_urgent_property == -1) {{ __('Unlimited') }} @else {{ $plan->number_of_urgent_property }} @endif </td> </tr> </table> </div> </div> </div> </div> </div> </section> <!--=====CHECKOUT END=====--> @endsection @push('js') <script> "use strict"; /** On DOM load */ $(document).ready(function () { //place order $(document).on("click", ".place-order-btn", function (e) { e.preventDefault(); const method = $(this).data("method"); var base_url = '{{ url('/') }}'; $.ajax({ url: `${base_url}/subscription/place-order/${method}`, type: "POST", dataType: "json", data: { _token: $('meta[name="csrf-token"]').attr("content"), }, beforeSend: function () { $("#show_currency_notifications .alert-warning").addClass( "d-none" ); $(".preloader-two").removeClass("d-none"); }, success: (response) => { if (response.success) { window.location.href = `${base_url}/subscription/payment?subscription_id=${response.subscription_id}`; } else { if (response.supportCurrency) { $("#show_currency_notifications .alert-warning") .html(response.supportCurrency) .removeClass("d-none"); } toastr.warning(response.messege); $(".preloader-two").addClass("d-none"); } }, error: (error) => { const errorMessage = error.responseJSON?.message || basic_error_message; toastr.error(errorMessage); $(".preloader-two").addClass("d-none"); }, }); }); }); </script> @endpush resources/views/user/subscription_history.blade.php 0000644 00000006324 15012227353 0016762 0 ustar 00 @extends('user.layout') @section('title') <title>{{ __('Subscription History') }}</title> @endsection @section('user-dashboard') <div class="wsus__dashboard_main_content"> <h4 class="heading">{{ __('Subscription History') }}</h4> <div class="wsus__dash_order mb_25"> <div class="table-responsive"> <table class="table"> <tbody> <tr> <th class="serial">{{ __('Serial') }}</th> <th class="package">{{ __('Plan Name') }}</th> <th class="p_date">{{ __('Purchase Date') }}</th> <th class="e_date">{{ __('Expired Date') }}</th> <th class="price">{{ __('Price') }}</th> <th class="action">{{ __('Action') }}</th> </tr> @foreach ($subscriptionHistories as $index => $history) <tr> <td class="serial">{{ ++$index }}</td> <td class="package"> {{ $history->plan_name }} <br> @if ($history->status == 'active') @if ($history->expired_date == null) <span class="custom-badge">{{ __('Currently Active') }}</span> @else @php $expired_date = date('Y-m-d', strtotime($history->expired_date)); @endphp @if (date('Y-m-d') < $expired_date) <span class="custom-badge">{{ __('Currently Active') }}</span> @endif @endif @endif </td> <td class="p_date">{{ date('Y-m-d', strtotime($history->created_at)) }}</td> <td class="e_date"> @if ($history->expiration == 'lifetime') {{ __('Lifetime') }} @else {{ date('Y-m-d', strtotime($history->expiration_date)) }} @endif </td> <td class="price">{{ currency($history->plan_price) }}</td> <td class="action"> <a href="{{ route('subscription.show-subscription-history', $history->id) }}"> <i class="fa fa-eye" aria-hidden="true"></i> </a> </td> </tr> @endforeach </tbody> </table> </div> </div> {{ $subscriptionHistories->links('custom_paginator') }} </div> @endsection resources/views/.gitkeep 0000644 00000000000 15012227353 0011332 0 ustar 00 resources/views/payment_success.blade.php 0000644 00000000343 15012227353 0014677 0 ustar 00 <p>Payment successfull</p> <p>transaction : {{ Session::get('after_success_transaction') }}</p> <p>Gateway name : {{ Session::get('after_success_gateway') }}</p> <a href="{{ route('user.payment') }}">Go to payment page</a> resources/views/payment.blade.php 0000644 00000077655 15012227353 0013173 0 ustar 00 <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Subscription Plan Module</title> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous"> <script src="https://code.jquery.com/jquery-3.7.1.min.js" integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script> <link rel="stylesheet" href="{{ asset('global/toastr/toastr.min.css') }}"> <style> .wsus__single_payment { box-shadow: rgba(100, 100, 111, 0.2) 0px 7px 29px 0px; border-radius: 5px; overflow: hidden; background: #faf6f3fa; display: block; transition: all linear .3s; margin-top: 25px; height: 100px; -webkit-transition: all linear .3s; -moz-transition: all linear .3s; -ms-transition: all linear .3s; -o-transition: all linear .3s; } .wsus__single_payment img { border-radius: 4px; } .wsus__single_payment:hover { background: var(--colorPrimary); } .wsus__pay_modal_info p { margin-bottom: 20px; } .wsus__pay_modal_info ul li { font-size: 16px; color: var(--paraColor); position: relative; padding-left: 35px; margin: 10px 0px; } .wsus__pay_modal_info ul li::after { position: absolute; content: "\f00c"; color: var(--colorWhite); font-family: "Font Awesome 5 Free"; font-weight: 600; top: 2px; left: 0; width: 20px; height: 20px; line-height: 20px; text-align: center; font-size: 10px; border-radius: 50%; background: var(--colorPrimary); transition: all linear .3s; -webkit-transition: all linear .3s; -moz-transition: all linear .3s; -ms-transition: all linear .3s; -o-transition: all linear .3s; } .wsus__pay_modal_info input, .wsus__pay_modal_info textarea, .wsus__pay_modal_info .nice-select { border: 1px solid #eee; margin-top: 15px; font-weight: 400; } .wsus__pay_modal_info .nice-select { margin-top: 10px; } .wsus__pay_modal_info .nice-select .option { font-weight: 400; margin: 0; } .wsus__pay_modal_info .nice-select .option::after { display: none; } .wsus__payment_btn_area { display: flex; flex-wrap: wrap; width: 100%; justify-content: space-between; padding-top: 20px; } .wsus__payment_btn_area button { border-radius: 3px; border: none; padding: 10px 30px; text-transform: capitalize; } </style> </head> <body> <div class="container text-center"> <h1 class="my-5">Subscription Plan Module</h1> <section class="wsus_payment_page mt_100"> <div class="container"> <div class="row"> <div class="col-lg-8"> <div id="show_currency_notifications"> @php $BasicPaymentSupportedCurrencyListEnum = \Modules\BasicPayment\app\Enums\BasicPaymentSupportedCurrencyListEnum::class; $PaymentGatewaySupportedCurrencyListEnum = \Modules\BasicPayment\app\Enums\PaymentGatewaySupportedCurrencyListEnum::class; @endphp @if (session()->has('show_stripe_currency') && session()->get('show_stripe_currency')) <div class="alert alert-warning"> Stripe {{ __('Support only those type of currencies') }} : {{ is_array($BasicPaymentSupportedCurrencyListEnum::getStripeSupportedCurrencies()['all_currency_codes']) ? implode(', ', $BasicPaymentSupportedCurrencyListEnum::getStripeSupportedCurrencies()['all_currency_codes']) : '' }} </div> @endif @if (session()->has('show_mollie_currency') && session()->get('show_mollie_currency')) <div class="alert alert-warning"> Mollie {{ __('Support only those type of currencies') }} : {{ is_array($PaymentGatewaySupportedCurrencyListEnum::getMollieSupportedCurrencies()) ? implode(', ', $PaymentGatewaySupportedCurrencyListEnum::getMollieSupportedCurrencies()) : '' }} </div> @endif @if (session()->has('show_paypal_currency') && session()->get('show_paypal_currency')) <div class="alert alert-warning"> Paypal {{ __('Support only those type of currencies') }} : {{ is_array($BasicPaymentSupportedCurrencyListEnum::getPaypalSupportedCurrencies()) ? implode(', ', $BasicPaymentSupportedCurrencyListEnum::getPaypalSupportedCurrencies()) : '' }} </div> @endif @if (session()->has('show_instamojo_currency') && session()->get('show_instamojo_currency')) <div class="alert alert-warning"> Instamojo {{ __('Support only those type of currencies') }} : {{ is_array($PaymentGatewaySupportedCurrencyListEnum::getInstamojoSupportedCurrencies()) ? implode(', ', $PaymentGatewaySupportedCurrencyListEnum::getInstamojoSupportedCurrencies()) : '' }} </div> @endif </div> <div class="wsus__payment_area"> <div class="row"> @if ($basic_payment->stripe_status == 'active') <div class="col-lg-3 col-6 col-sm-4"> <a href="javascript:;" class="btn btn-primary" onclick="event.preventDefault(); $('#stripe-form').trigger('submit');">Pay with Stripe</a> <form id="stripe-form" action="{{ route('subscription.pay-via-stripe',$plan->id) }}" method="POST" class="d-none"> @csrf </form> </div> @endif @if ($basic_payment->paypal_status == 'active') <div class="col-lg-3 col-6 col-sm-4"> <a class="wsus__single_payment" href="{{ route('subscription.pay-via-paypal', $plan->id) }}"> <img src="{{ asset($basic_payment->paypal_image) }}" alt="Pay with paypal" class="img-fluid w-100"> </a> </div> @endif @if ($basic_payment->bank_status == 'active') <div class="col-lg-3 col-6 col-sm-4"> <a class="wsus__single_payment" data-bs-toggle="modal" data-bs-target="#bankModal" href="#"> <img src="{{ asset($basic_payment->bank_image) }}" alt="Pay with bank" class="img-fluid w-100"> </a> </div> @endif @if ($razorpay_credentials->razorpay_status == 'active') <div class="col-lg-3 col-6 col-sm-4"> <a href="javascript:;" class="wsus__single_payment" id="razorpayBtn"> <img src="{{ asset($razorpay_credentials->razorpay_image) }}" alt="payment method" class="img-fluid w-100"> </a> </div> <form action="{{ route('subscription.pay-via-razorpay', $plan->id) }}" method="POST" class="d-none"> @csrf <input type="hidden" name="payable_amount" value="{{ $payable_amount }}"> <script src="https://checkout.razorpay.com/v1/checkout.js" data-key="{{ $razorpay_credentials->razorpay_key }}" data-currency="{{ $razorpay_credentials->currency_code }}" data-amount="{{ $razorpay_credentials->payable_with_charge * 100 }}" data-buttontext="{{ __('Pay') }}" data-name="{{ $razorpay_credentials->razorpay_name }}" data-description="{{ $razorpay_credentials->razorpay_description }}" data-image="{{ asset($razorpay_credentials->razorpay_image) }}" data-prefill.name="{{ userAuth()->name }}" data-prefill.email="{{ userAuth()->email }}" data-theme.color="{{ $razorpay_credentials->razorpay_theme_color }}"> </script> </form> @endif @if ($mollie_credentials->mollie_status == 'active') <div class="col-lg-3 col-6 col-sm-4"> <a href="{{ route('subscription.pay-via-mollie', $plan->id) }}" class="wsus__single_payment"> <img src="{{ asset($mollie_credentials->mollie_image) }}" alt="payment method" class="img-fluid w-100"> </a> </div> @endif @if ($instamojo_credentials->instamojo_status == 'active') <div class="col-lg-3 col-6 col-sm-4"> <a href="{{ route('subscription.pay-via-instamojo', $plan->id) }}" class="wsus__single_payment"> <img src="{{ asset($instamojo_credentials->instamojo_image) }}" alt="instamojo method" class="img-fluid w-100"> </a> </div> @endif @if ($flutterwave_credentials->flutterwave_status == 'active') <div class="col-lg-3 col-6 col-sm-4"> <a href="javascript:;" class="wsus__single_payment" onclick="flutterwavePayment()"> <img src="{{ asset($flutterwave_credentials->flutterwave_image) }}" alt="flutterwave method" class="img-fluid w-100"> </a> </div> @endif @if ($payment_setting->paystack_status == 'active') <div class="col-lg-3 col-6 col-sm-4"> <a href="javascript:;" class="wsus__single_payment" onclick="payWithPaystack()"> <img src="{{ asset($paystack_credentials->paystack_image) }}" alt="paystack method" class="img-fluid w-100"> </a> </div> @endif </div> </div> </div> <div class="col-lg-4 col-md-7"> <div class="wsus__single_pricing"> <h4>{{ $plan->plan_name }}</h4> <h2>{{ $plan->plan_price }} {{ allCurrencies()->first()->currency_code ?? 'USD' }}</h2> <p>{{ ucfirst($plan->expiration_date) }}</p> <div class="wsus__single_pricing_center"> <p>{{ __('payable_amount') }}: <span>{{ currency($plan->plan_price) }}</span> </p> <p class="bold">{{ __('payable_with_gateway_charge') }}:</p> @if (payable_with_charges($plan->plan_price)) @foreach (payable_with_charges($plan->plan_price) as $key => $value) @if ( $key == 'stripe' && $BasicPaymentSupportedCurrencyListEnum::isStripeSupportedCurrencies(getSessionCurrency()) && $basic_payment->stripe_status == 'active') <p>{{ str($key)->title() }}: <span>{{ $value }} {{ getSessionCurrency() }}</span></p> @elseif ( $key == 'paypal' && $BasicPaymentSupportedCurrencyListEnum::isPaypalSupportedCurrencies(getSessionCurrency()) && $basic_payment->paypal_status == 'active') <p>{{ str($key)->title() }}: <span>{{ $value }} {{ getSessionCurrency() }}</span></p> @elseif ( $key == 'mollie' && $PaymentGatewaySupportedCurrencyListEnum::isMollieSupportedCurrencies(getSessionCurrency()) && $mollie_credentials->mollie_status == 'active') <p>{{ str($key)->title() }}: <span>{{ $value }} {{ getSessionCurrency() }}</span></p> @elseif ( $key == 'razorpay' && $PaymentGatewaySupportedCurrencyListEnum::isRazorpaySupportedCurrencies(getSessionCurrency()) && $razorpay_credentials->razorpay_status == 'active') <p>{{ str($key)->title() }}: <span>{{ $value }} {{ getSessionCurrency() }}</span></p> @elseif ( $key == 'instamojo' && $PaymentGatewaySupportedCurrencyListEnum::isInstamojoSupportedCurrencies(getSessionCurrency()) && $instamojo_credentials->instamojo_status == 'active') <p>{{ str($key)->title() }}: <span>{{ $value }} {{ getSessionCurrency() }}</span></p> @elseif ( $key == 'flutterwave' && $PaymentGatewaySupportedCurrencyListEnum::isFlutterwaveSupportedCurrencies(getSessionCurrency()) && $flutterwave_credentials->flutterwave_status == 'active') <p>{{ str($key)->title() }}: <span>{{ $value }} {{ getSessionCurrency() }}</span></p> @elseif ( $key == 'paystack' && $PaymentGatewaySupportedCurrencyListEnum::isPaystackSupportedCurrencies(getSessionCurrency()) && $payment_setting->paystack_status == 'active') <p>{{ str($key)->title() }}: <span>{{ $value }} {{ getSessionCurrency() }}</span></p> @elseif( $key != 'stripe' && $key != 'paypal' && $key !== 'mollie' && $key !== 'razorpay' && $key !== 'instamojo' && $key !== 'flutterwave' && $key !== 'paystack') <p>{{ str($key)->title() }}: <span>{{ $value }} {{ getSessionCurrency() }}</span></p> @endif @endforeach @endif </div> <div class="text"> <ul> {{-- write plan details --}} </ul> </div> </div> </div> </div> </div> </section> @if ($basic_payment->stripe_status == 'active') <script type="text/javascript" src="https://js.stripe.com/v2/"></script> <script type="text/javascript"> "use strict"; $(function() { var $form = $(".require-validation"); $('form.require-validation').bind('submit', function(e) { $('#stripePaymentSubmitButton').prop('disabled', true); var $form = $(".require-validation"), inputSelector = ['input[type=email]', 'input[type=password]', 'input[type=text]', 'input[type=file]', 'textarea' ].join(', '), $inputs = $form.find('.required').find(inputSelector), $errorMessage = $form.find('div.error'), valid = true; $errorMessage.addClass('d-none'); $('.has-error').removeClass('has-error'); $inputs.each(function(i, el) { var $input = $(el); if ($input.val() === '') { $input.parent().addClass('has-error'); $errorMessage.removeClass('d-none'); e.preventDefault(); } }); if (!$form.data('cc-on-file')) { e.preventDefault(); Stripe.setPublishableKey($form.data('stripe-publishable-key')); Stripe.createToken({ number: $('.card-number').val(), cvc: $('.card-cvc').val(), exp_month: $('.card-expiry-month').val(), exp_year: $('.card-expiry-year').val() }, stripeResponseHandler); } }); function stripeResponseHandler(status, response) { if (response.error) { $('#stripePaymentSubmitButton').prop('disabled', false); $('.error') .removeClass('d-none') .find('.alert') .text(response.error.message); } else { /* token contains id, last4, and card type */ var token = response['id']; $form.find('input[type=text]').empty(); $form.append("<input type='hidden' name='stripeToken' value='" + token + "' />"); $form.get(0).submit(); } } }); </script> @endif @if ($razorpay_credentials->razorpay_status == 'active') {{-- start razorpay payment --}} <script> "use strict"; $(function() { $("#razorpayBtn").on("click", function() { var isCurrencyAllowed = "{{ $PaymentGatewaySupportedCurrencyListEnum::isRazorpaySupportedCurrencies($razorpay_credentials->currency_code) ? '1' : '0' }}"; if (isCurrencyAllowed == 0) { toastr.error('This currency is not supported by Razorpay'); $('#show_currency_notifications').empty(); $('#show_currency_notifications').append( `<div class='alert alert-warning'> Razorpay {{ __('Support only those type of currencies') }} : {{ is_array($PaymentGatewaySupportedCurrencyListEnum::getRazorpaySupportedCurrencies()) ? implode(', ', $PaymentGatewaySupportedCurrencyListEnum::getRazorpaySupportedCurrencies()) : '' }} </div>` ); return; } $(".razorpay-payment-button").trigger('click'); }) }); </script> @endif @if ($flutterwave_credentials->flutterwave_status == 'active') {{-- start flutterwave payment --}} <script src="https://checkout.flutterwave.com/v3.js"></script> <script> "use strict"; function flutterwavePayment() { var isDemo = "{{ env('APP_MODE') }}" if (isDemo == 'DEMO') { toastr.error('This Is Demo Version. You Can Not Change Anything'); return; } var isCurrencyAllowed = "{{ $PaymentGatewaySupportedCurrencyListEnum::isFlutterwaveSupportedCurrencies($flutterwave_credentials->currency_code) ? '1' : '0' }}"; if (isCurrencyAllowed == 0) { toastr.error('This currency is not supported by Flutterwave'); $('#show_currency_notifications').empty(); $('#show_currency_notifications').append( `<div class='alert alert-warning'> Flutterwave {{ __('Support only those type of currencies') }} : {{ is_array($PaymentGatewaySupportedCurrencyListEnum::getFlutterwaveSupportedCurrencies()) ? implode(', ', array_keys($PaymentGatewaySupportedCurrencyListEnum::getFlutterwaveSupportedCurrencies())) : '' }} </div>` ); return; } FlutterwaveCheckout({ public_key: "{{ $flutterwave_credentials->flutterwave_public_key }}", tx_ref: "{{ substr(rand(0, time()), 0, 10) }}", amount: "{{ $flutterwave_credentials->payable_with_charge }}", currency: "{{ $flutterwave_credentials->currency_code }}", country: "{{ $flutterwave_credentials->country_code }}", payment_options: " ", customer: { email: "{{ $user->email }}", phone_number: "{{ $user->phone }}", name: "{{ $user->name }}", }, callback: function(data) { var tnx_id = data.transaction_id; var _token = "{{ csrf_token() }}"; var payable_amount = "{{ $payable_amount }}"; var planId = '{{ $plan->id }}'; $.ajax({ type: 'post', data: { tnx_id, _token, payable_amount, planId }, url: "{{ url('paymentgateway/pay-via-flutterwave') }}", success: function(response) { window.location.href = "{{ route('subscription.payment-addon-success') }}"; }, error: function(err) { toastr.error("{{ __('Payment Failed please try again') }}"); window.location.reload(); } }); }, customizations: { title: "{{ $flutterwave_credentials->flutterwave_app_name }}", logo: "{{ asset($flutterwave_credentials->flutterwave_image) }}", }, }); } </script> {{-- end flutterwave payment --}} @endif @if ($payment_setting->paystack_status == 'active') {{-- paystack start --}} <script src="https://js.paystack.co/v1/inline.js"></script> <script> "use strict"; function payWithPaystack() { var isDemo = "{{ env('APP_MODE') }}" if (isDemo == 'DEMO') { toastr.error('This Is Demo Version. You Can Not Change Anything'); return; } var isCurrencyAllowed = "{{ $PaymentGatewaySupportedCurrencyListEnum::isPaystackSupportedCurrencies($paystack_credentials->currency_code) ? '1' : '0' }}"; if (isCurrencyAllowed == 0) { toastr.error('This currency is not supported by Paystack'); $('#show_currency_notifications').empty(); $('#show_currency_notifications').append( `<div class='alert alert-warning'> Paystack {{ __('Support only those type of currencies') }} : {{ is_array($PaymentGatewaySupportedCurrencyListEnum::getPaystackSupportedCurrencies()) ? implode(', ', $PaymentGatewaySupportedCurrencyListEnum::getPaystackSupportedCurrencies()) : '' }} </div>` ); return; } var handler = PaystackPop.setup({ key: '{{ $paystack_credentials->paystack_public_key }}', email: '{{ $user->email }}', amount: '{{ $paystack_credentials->payable_with_charge * 100 }}', currency: "{{ $paystack_credentials->currency_code }}", callback: function(response) { let reference = response.reference; let tnx_id = response.transaction; let _token = "{{ csrf_token() }}"; var payable_amount = "{{ $payable_amount }}"; var secret_key = "{{ $paystack_credentials->paystack_secret_key }}"; $.ajax({ type: "post", data: { reference, tnx_id, _token, payable_amount, secret_key, }, url: "{{ route('paymentgateway.pay-via-paystack', ['planId' => $plan->id]) }}", success: function(response) { window.location.href = "{{ route('subscription.payment-addon-success') }}"; }, error: function(response) { toastr.error("{{ __('Payment Failed please try again') }}"); window.location.reload(); } }); }, onClose: function() { alert('window closed'); } }); handler.openIframe(); } </script> @endif </div> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-kenU1KFdBIe4zVF0s0G1M5b4hcpxyD9F7jL+jjXkk+Q2h455rYXK/7HAuoJl+0I4" crossorigin="anonymous"> </script> <script src="{{ asset('global/toastr/toastr.min.js') }}"></script> <script> @if (Session::has('messege')) var type = "{{ Session::get('alert-type', 'info') }}" switch (type) { case 'info': toastr.info("{{ Session::get('messege') }}"); break; case 'success': toastr.success("{{ Session::get('messege') }}"); break; case 'warning': toastr.warning("{{ Session::get('messege') }}"); break; case 'error': toastr.error("{{ Session::get('messege') }}"); break; } @endif </script> @if ($errors->any()) @foreach ($errors->all() as $error) <script> toastr.error('{{ $error }}'); </script> @endforeach @endif @stack('js') </body> </html>
| ver. 1.4 |
Github
|
.
| PHP 8.3.20 | Генерация страницы: 0.01 |
proxy
|
phpinfo
|
Настройка