Linux ubuntu22 5.15.0-133-generic #144-Ubuntu SMP Fri Feb 7 20:47:38 UTC 2025 x86_64
nginx/1.18.0
: 128.199.27.159 | : 216.73.216.1
Cant Read [ /etc/named.conf ]
8.1.31
www-data
www.github.com/MadExploits
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
CPANEL RESET
CREATE WP USER
README
+ Create Folder
+ Create File
/
var /
www /
html /
sdgamatya /
app /
Http /
Controllers /
[ HOME SHELL ]
Name
Size
Permission
Action
Admin
[ DIR ]
drwxr-xr-x
Auth
[ DIR ]
drwxr-xr-x
Authentication
[ DIR ]
drwxr-xr-x
Product
[ DIR ]
drwxr-xr-x
Setting
[ DIR ]
drwxr-xr-x
User
[ DIR ]
drwxr-xr-x
Controller.php
374
B
-rw-r--r--
HomeController.php
19.22
KB
-rw-r--r--
HomeController_09.php
19.22
KB
-rw-r--r--
HomeController_09282018.php
19.22
KB
-rw-r--r--
HomeController_backup.php
18.83
KB
-rw-r--r--
HomeController_l.php
9.54
KB
-rw-r--r--
HomeController_old.php
18.83
KB
-rw-r--r--
OrderController.php
14.55
KB
-rw-r--r--
OrderController_old.php
14.55
KB
-rw-r--r--
OrderPaymentController.php
6.73
KB
-rw-r--r--
OrderPaymentController_old.php
6.73
KB
-rw-r--r--
SuperAdminController.php
3.59
KB
-rw-r--r--
SuperAdminController_old.php
3.61
KB
-rw-r--r--
WelcomeController.php
1.03
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : HomeController_backup.php
<?php namespace App\Http\Controllers; use App\Model\Receive; use App\Model\Company; use App\Model\Payment; use App\Model\Product\Product; use Illuminate\Http\Request; use App\Http\Helpers\Constants; use DB; use Sentinel; use Illuminate\Support\Facades\Artisan; use Carbon\Carbon; use App\Model\Order\Order; class HomeController extends Controller { function __construct() { } public function dashboard() { $user = \Sentinel::getUser(); $userRole = $user->role->slug; switch ($userRole) { case Constants::ROLE_ADMIN : $data = $this->adminDashboard(); return view('layouts.admin.home', compact('data')); break; case Constants::ROLE_FACTORY : $data = $this->factoryDashboard(); return view('layouts.factory.home', compact('data')); break; case Constants::ROLE_RECEIVER : $data = $this->receiverDashboard(); return view('layouts.receiver.home', compact('data')); break; case Constants::ROLE_COMPANY : $data = $this->companyDashboard(); $products = $this->availableProductsCollection(); return view('layouts.company.home', compact('data','products')); break; case Constants::ROLE_SUPER_ADMIN : $data = $this->superAdminDashboard(); $advanceAmount = $this->todaysAdvanceCollection(); return view('layouts.super_admin.home', compact('data','advanceAmount')); break; } } public function permissionError() { return view('error.permission'); } public function adminDashboard() { //{Cyl.@STORE} fetch receive status [0 = Cylinder Received, 1=Confirmed By Admin, 9 = back to store] $data['received_cylinders'] = Receive::whereIn('status', [0, 1])->orderByDesc('id')->get(); //count cylinders having receive status = [0,1,9] $data['count_received_cylinders'] = Receive::whereIn('status', [0, 1])->select(DB::raw('sum(total_cylinder) as total_received_cylinder')) ->first(); //{Cyl.@FACTORY fetch receive status [2,3,4,5,6,7,8]} $data['under_process_cylinders'] = Receive::whereIn('status', [2, 3, 4, 5, 6, 7, 8])->orderByDesc('id')->get(); $data['count_under_construction_cylinders'] = Receive::select(DB::raw('sum(total_cylinder) as total_under_construction_cylinder')) ->whereIn('status', [2, 3, 4, 5, 6, 7, 8]) ->first(); $data['back_to_receiver'] = Receive::where('status', 9)->orderByDesc('id')->get(); $data['count_repaired_cylinders'] = Receive::select(DB::raw('sum(total_cylinder) as total_repaired_cylinder')) ->where('status', 9) ->first(); $data['delivered_cylinders'] = Receive::where('status', '=', 10)->orderByDesc('id')->get(); $data['count_delivered_cylinders'] = Receive::select(DB::raw('sum(total_cylinder) as total_delivered_cylinder')) ->where('status', 10) ->first(); $data['companywise_rate'] = DB::table('view_company_rate')->get(); $data['factorywise_rate'] = DB::table('view_factory_rate')->get(); $data['summary'] = $this->superAdminDashboard()['summary']; return $data; } protected function factoryDashboard() { //fetching receive having [status 2 = Sent To Factyory] $data['received_cylinders'] = Receive::where('status', 2)->orderByDesc('id')->get(); //fetching receives having [status 3 = Filling, 4 = Sent for confirmation,5 = Confirmed by client] $data['under_process_cylinders'] = Receive::whereIn('status', [2, 3, 4, 5, 6, 7, 8])->orderByDesc('id')->get(); //count the sum of no. of receive having [status 3,4,5,6,7,8] $data['count_under_construction_cylinders'] = Receive::select(DB::raw('sum(total_cylinder) as total_under_construction_cylinder')) ->whereIn('status', [2, 3, 4, 5, 6, 7, 8]) ->first(); $data['back_to_receiver'] = Receive::where('status', 6)->orderByDesc('id')->get(); //count the no. of cylinders receive having [status 2 = Sent to factory ] $data['count_received_cylinders'] = Receive::select(DB::raw('sum(total_cylinder) as total_received_cylinder')) ->where('status', 2) ->first(); //count the sum of no. of cylinders receive having [status 6 = repairing ] $data['count_repaired_cylinders'] = Receive::select(DB::raw('sum(total_cylinder) as total_repaired_cylinder')) ->where('status', 6) ->first(); $data['factorywise_rate'] = DB::table('view_factory_rate')->get(); return $data; } protected function receiverDashboard() { //{Cyl.@STORE} fetch receive status [0 = Cylinder Received, 1=Confirmed By Admin, 9 = back to store] $data['received_cylinders'] = Receive::whereIn('status', [0, 1])->orderByDesc('id')->get(); //count cylinders having receive status = [0,1,9] $data['count_received_cylinders'] = Receive::whereIn('status', [0, 1])->select(DB::raw('sum(total_cylinder) as total_received_cylinder')) ->first(); //{Cyl.@FACTORY fetch receive status [2,3,4,5,6,7,8]} $data['under_process_cylinders'] = Receive::whereIn('status', [2, 3, 4, 5, 6, 7, 8])->orderByDesc('id')->get(); $data['count_under_construction_cylinders'] = Receive::select(DB::raw('sum(total_cylinder) as total_under_construction_cylinder')) ->whereIn('status', [2, 3, 4, 5, 6, 7, 8]) ->first(); $data['back_to_receiver'] = Receive::where('status', 9)->orderByDesc('id')->get(); $data['count_repaired_cylinders'] = Receive::select(DB::raw('sum(total_cylinder) as total_repaired_cylinder')) ->where('status', 9) ->first(); $data['delivered_cylinders'] = Receive::where('status', '=', 10)->orderByDesc('id')->get(); $data['count_delivered_cylinders'] = Receive::select(DB::raw('sum(total_cylinder) as total_delivered_cylinder')) ->where('status', 10) ->first(); $data['companywise_rate'] = DB::table('view_company_rate')->get(); $data['factorywise_rate'] = DB::table('view_factory_rate')->get(); return $data; } protected function companyDashboard() { $data = []; $company_id = Company::where(['user_id'=>\Sentinel:: getUser()->id])->first()->id; $data = (array)$this->companyDashboardData($company_id); return $data; } public function superAdminDashboard() { try { $q = 'select max(receive_id) from view_company_rate group by company_id'; $selectColumns = [ 'company_name', 'with_cap', 'without_cap', 'total_cylinder', 'date', 'sum_body_leakage as body_leak', 'sum_nozzle_change as nozzle_change', 'sum_nozzle_repair as nozzle_repair', 'sum_cap_change as cap_change', 'sum_washer_change as washer_change', 'sum_refill as refill', 'company_id', 'repair_id' ]; $data['summary'] = DB::table('view_company_rate') ->select($selectColumns) ->selectRaw('sum(price_nozzle_change+price_nozzle_repair+price_cap_change+price_washer_change+price_refill) as total_amount') ->whereIn('receive_id', [DB::raw($q)]) ->groupBy('company_id') ->get(); } catch (\Exception $e) { return $data['summary'] = null; } foreach($data['summary'] as $d){ $dat = DB::table('view_company_rate') ->select($selectColumns) ->selectRaw('sum(price_nozzle_change+price_nozzle_repair+price_cap_change+price_washer_change+price_refill) as total_amount') ->where('company_id', $d->company_id) ->whereNotIn('receive_id', [DB::raw($q)]) ->orderByDesc('receive_id') ->groupBy('receive_id') ->get(); $d->detail_datas = $dat; } /* ------------------------------------------------------------------------------------- Admin features implementation ------------------------------------------------------------------------------------- */ //{Cyl.@STORE} fetch receive status [0 = Cylinder Received, 1=Confirmed By Admin, 9 = back to store] $data['received_cylinders'] = Receive::whereIn('status', [0, 1])->orderByDesc('id')->get(); //count cylinders having receive status = [0,1,9] $data['count_received_cylinders'] = Receive::whereIn('status', [0, 1])->select(DB::raw('sum(total_cylinder) as total_received_cylinder')) ->first(); //{Cyl.@FACTORY fetch receive status [2,3,4,5,6,7,8]} $data['under_process_cylinders'] = Receive::whereIn('status', [2, 3, 4, 5, 6, 7, 8])->orderByDesc('id')->get(); $data['count_under_construction_cylinders'] = Receive::select(DB::raw('sum(total_cylinder) as total_under_construction_cylinder')) ->whereIn('status', [2, 3, 4, 5, 6, 7, 8]) ->first(); $data['back_to_receiver'] = Receive::where('status', 9)->orderByDesc('id')->get(); $data['count_repaired_cylinders'] = Receive::select(DB::raw('sum(total_cylinder) as total_repaired_cylinder')) ->where('status', 9) ->first(); $data['delivered_cylinders'] = Receive::where('status', '=', 10)->orderByDesc('id')->get(); $data['count_delivered_cylinders'] = Receive::select(DB::raw('sum(total_cylinder) as total_delivered_cylinder')) ->where('status', 10) ->first(); $data['companywise_rate'] = DB::table('view_company_rate')->get(); $data['factorywise_rate'] = DB::table('view_factory_rate')->get(); return $data; } private function todaysAdvanceCollection() { return Payment::whereDate('date',\Carbon\Carbon::now()->toDateString())->sum('amount'); } public function cylinderDetails() { if (isset(request()->receive_id)) { $column = request()->column; $receive_id = request()->receive_id; $receive = Receive::with(['repair.repair_details' =>function($query) use ($column){ $query->when(($column === 'refill'),function($query) use ($column) { $query->where([$column =>1]); },function($query) use ($column){ $query->where([$column =>1,'status'=>2]); }); }])->where(['id'=>$receive_id])->first(); $data['cylinders'] = $receive->repair->repair_details; }else{ $data['cylinders'] = []; } $data['title'] = request()->column; echo view('layouts.company.cylinder_info', compact('data')); } public function companyDashboardData($company_id) { try { $q = 'select max(receive_id) from view_company_rate group by company_id'; $selectColumns = [ 'company_name', 'with_cap', 'without_cap', 'total_cylinder', 'date', 'sum_body_leakage', 'sum_nozzle_change', 'sum_nozzle_repair', 'sum_cap_change', 'sum_washer_change', 'sum_refill', 'company_id', 'repair_id', 'nozzle_change', 'nozzle_repair', 'cap_change', 'washer_change', 'refill', 'isBilled', 'receive_id', ]; $data = DB::table('view_company_rate') ->select($selectColumns) ->selectRaw('sum(price_nozzle_change+price_nozzle_repair+price_cap_change+price_washer_change+price_refill) as grand_total') ->whereIn('receive_id', [DB::raw($q)]) ->where('company_id',$company_id) ->groupBy('company_id') ->first(); } catch (\Exception $e) { return $data = null; } return $data; } public function availableProductsCollection(){ return Product::where(['status'=>'published'])->get(); } public function getSales(){ $data = $this->totalSales(request()->fromDate,request()->toDate); // dd($data); if(request()->ajax()){ echo view('dashboard.replace_sales',compact('data')); }else{ echo view('dashboard.total_sales',compact('data')); } } public function getAdvances(){ $data = $this->advanceReceived(request()->fromDate,request()->toDate); if(request()->ajax()){ echo view('dashboard.replace_advance',compact('data')) ; }else{ echo view('dashboard.total_advance',compact('data')); } } public function getDues(){ $data = $this->totalDues(); if(request()->ajax()){ echo view('dashboard.dues') ; }else{ echo view('dashboard.total_dues') ; } } public function getClientStatement(){ $data = $this->clientStatement(request()->fromDate,request()->toDate); if(request()->ajax()){ echo view('dashboard.replace_client_statement',compact('data')) ; }else{ echo view('dashboard.all_client_statement',compact('data')); } } /* ------------------------------------------------------------------------------------- Total Sales calculation ------------------------------------------------------------------------------------- */ protected function totalSales($fromDate = NULL, $toDate = NULL){ //cofirmed order + cofnirmed repair of a week $receive_grand_total = 0;$order_grand_total = 0;$data = []; $receives_query = DB::table('view_company_rate')->select('*') ->selectRaw('(price_nozzle_change+price_nozzle_repair+price_cap_change+price_washer_change+price_refill) as total_amount'); if($fromDate == null && $toDate == null){ $receives_query->whereRaw('YEAR(date)='.date('Y',strtotime('today'))); }else{ $receives_query->whereBetween('date',[$fromDate,$toDate]); } $receiveData = $receives_query->whereIn('status',[5,6,7,8,9]) ->get(); $data['receives'] = []; if($receiveData){ foreach ($receiveData as $key => $receive) { $recData = []; $recData['company_name'] = $receive->company_name; $recData['date'] = $receive->date; $recData['total_cylinder'] = $receive->total_cylinder; $recData['total_amount'] = $receive->total_amount; $recData['vat_amount'] = $receive->total_amount * vat() / 100; $recData['total'] = $recData['total_amount'] + $recData['vat_amount']; $receive_grand_total+=$recData['total']; $data['receives'][$key] = $recData; } $data['receive_grand_total'] = number_format($receive_grand_total,3); } $order_query = DB::table('customers')->join('orders','customers.id','=','orders.customer_id')->join('order_details','orders.id','=','order_details.order_id'); $order_query->selectRaw('company_name,name,phone,orders.status,confirm_date,tax_option1,tax_option2,shipping_rate,exchange_rate')->selectRaw('SUM(qty*rate) as total'); if($fromDate == null && $toDate == null){ $order_query->whereRaw('YEAR(confirm_date)<='.date('Y',strtotime('today'))); }else{ $order_query->whereBetween('confirm_date',[$fromDate,$toDate]); } $queriedData = $order_query ->where(['orders.status'=>Constants::ORDER_STATUS_CONFIRMED]) ->groupBy('order_id')->get(); $data['confirmed_order'] = []; if($queriedData){ foreach ($queriedData as $key => $order) { $orderData = []; $orderData['company_name'] = $order->company_name; $orderData['name'] = $order->name; $orderData['status'] = $order->status; $orderData['confirm_date'] = $order->confirm_date; $orderData['tax1_amount'] = $order->total * $order->tax_option1 / 100; $orderData['tax2_amount'] = $order->total * $order->tax_option2 / 100; $orderData['shipping_rate'] = $order->shipping_rate; $orderData['exchange_rate'] = $order->exchange_rate; $orderData['sub_total'] = $order->total; $orderData['vat_amount'] = $order->total * vat() / 100; $orderData['ind_total'] = $order->total + $order->shipping_rate + $orderData['vat_amount'] + $orderData['tax1_amount'] +$orderData['tax2_amount']; $order_grand_total += $orderData['ind_total']; $data['confirmed_order'][$key] = $orderData; } $data['order_grand_total'] = number_format($order_grand_total,3); } return $data; } /* ------------------------------------------------------------------------------------- Total Advance calculation ------------------------------------------------------------------------------------- */ protected function advanceReceived($fromDate = null, $toDate = null){ $receive_advance_total = 0;$order_advance_total = 0; //calculating receive advance total $query = DB::table('receive')->join('payments','receive.id','=','payments.receive_id') ->join('company','company.id','=','receive.company_id'); $query->selectRaw('company.name as company_name, receive.date as receive_date,receive.lot_no,payments.receive_id'); if($fromDate == null && $toDate == null){ $query->whereRaw('YEAR(receive.date)='.date('Y',strtotime('today'))); }else{ $query->whereBetween('receive.date',[$fromDate,$toDate]); } $query->whereRaw('receive.status!=10'); $query->selectRaw('SUM(amount) as total_advance'); $queryData= $query->groupBy('receive_id')->get(); $data['receive_advance'] = $queryData; if($queryData){ $data['receive_advance_total'] = $queryData->sum('total_advance'); } //Calculating order advance total $orderQuery = DB::table('orders')->join('customers','customers.id','=','orders.customer_id') ->join('order_payments','order_payments.order_id','=','orders.id'); $orderQuery->selectRaw(' customers.name,order_payments.date as payment_date,order_payments.order_id,orders.status,orders.confirm_date,orders.created_at as order_date'); if($fromDate == null && $toDate == null){ $orderQuery->whereRaw('YEAR(orders.confirm_date)='.date('Y',strtotime('today'))); }else{ $orderQuery->whereBetween('orders.confirm_date',[$fromDate,$toDate]); } $orderQuery->where(['status'=>Constants::ORDER_STATUS_CONFIRMED]); $orderQuery->selectRaw('SUM(order_payments.amount) as order_advance'); $orderQueryData= $orderQuery->groupBy('order_id')->get(); $data['order_advance'] = $orderQueryData; if($orderQueryData){ $data['order_advance_total'] = $orderQueryData->sum('order_advance'); } return $data; } /* ------------------------------------------------------------------------------------- Total dues calculation ------------------------------------------------------------------------------------- */ protected function totalDues(){ } /* ------------------------------------------------------------------------------------- Total Client statement calculation ------------------------------------------------------------------------------------- */ protected function clientStatement($fromDate = NULL, $toDate = NULL){ $query = DB::table('receive')->join('payments','receive.id','=','payments.receive_id') ->join('company','company.id','=','receive.company_id')->join('contact_person','contact_person.company_id','=','company.id'); $query->selectRaw('company.name as company_name, payments.date as payment_date,payments.amount'); if($fromDate == null && $toDate == null){ $query->whereRaw('YEAR(payments.date)='.date('Y',strtotime('today'))); }else{ $query->whereBetween('payments.date',[$fromDate,$toDate]); } $data['receive_payments'] = $query->get(); //Calculating order advance total $orderQuery = DB::table('orders')->join('customers','customers.id','=','orders.customer_id') ->join('order_payments','order_payments.order_id','=','orders.id'); $orderQuery->selectRaw(' customers.name,order_payments.date as payment_date,order_payments.amount,order_payments.paid_by'); if($fromDate == null && $toDate == null){ $orderQuery->whereRaw('YEAR(order_payments.date)='.date('Y',strtotime('today'))); }else{ $orderQuery->whereBetween('order_payments.date',[$fromDate,$toDate]); } $data['order_payments'] = $orderQuery->get(); return $data; } /* ------------------------------------------------------------------------------------- Only for developers ------------------------------------------------------------------------------------- */ public function clearRouteCache() { \Artisan::call('cache:clear'); \Artisan::call('config:cache'); \Artisan::call('view:clear'); \Artisan::call('clear-compiled'); \Artisan::call('route:cache'); dd('Cleared'); } public function bktMigrate(){ Artisan::call('migrate'); dd('migrated successfully!!!'); } public function bktSeeding(){ Artisan::call('db:seed'); dd('seeded successfully!!!'); } }
Close