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


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

namespace App\Http\Controllers\Admin;

use 
App\Http\Controllers\Controller;
use 
App\Models\Customer;
use 
App\Models\Setting;
use 
GuzzleHttp\Client;
use 
Illuminate\Database\Eloquent\Model;
use 
Illuminate\Http\Request;
use 
Illuminate\Support\Facades\DB;
use 
Illuminate\Support\Facades\Log;
use 
Illuminate\Support\Facades\Route;
use 
Illuminate\Support\Str;

class 
CustomerController extends Controller
{
    public function 
index(Request $request) {

        
$keyword $request->get('keyword''');
        
$records Customer::select('id','firstname','lastname','email','telephone','status')
            ->
when($keyword != '', function($q) use($keyword) {
                
$q->where('firstname','like',"%$keyword%")->orWhere('lastname','like',"%$keyword%")->orWhere('email','like',"%$keyword%")->orWhere('telephone','like',"%$keyword%");
            })->
orderBy('created_at','DESC')->paginate($this->defaultPaginate);
        return 
view('admin.customer.index',['records' => $records]);
    }

    public function 
add() {
        return 
view('admin.customer.add');
    }

    protected function 
validateData ($request) {
//        dd(Route::currentRouteName());

        
$passwordValidations = [];
        if(
Route::currentRouteName() == 'customer.store') {
            
$passwordValidations = ['password' => ['required','min:6'],
            
'confirmed' => ['required','same:password']
                ];
        }

        
$customerValidations = [
            
'firstname' => ['required''string''max:32'],
            
'lastname' => ['required''string''max:32'],
            
'email' => ['required','email'],
            
'telephone' => ['required'],
            
'status' => ['required'],
        ];

        
$validationArray array_merge($passwordValidations,$customerValidations);

        
$this->validate($request,$validationArray);
    }

    public function 
store(Request $request) {



        
$this->validateData($request);
        
$data = new Customer($request->only('firstname','lastname','email','telephone','status'));
        
$data->password bcrypt($request->password);
        
$data->save();

        
//Section Inventory API
        
$api_url Setting::where('key''api_url')->first();
        
$api_token Setting::where('key''api_token')->first();
        if (
$api_url && isset($api_url->value) && $api_token && isset($api_token->value)) {
            try{
                
$client = new Client();

                
$api_form_data=[
                    
'user_id' => auth()->user()->id,
                    
'username' => $request->firstname.$request->lastname,
                    
'email' => $request->email,
                    
'phone' => $request->telephone,
                ];

                
$response $client->post($api_url->value '/api/customer/store', [
                    
'headers' => [
                        
'Accept' => 'application/json',
                        
'Authorization' => 'Bearer ' $api_token->value,
                    ],
                    
'form_params' => $api_form_data
                
]);
                
$response $response->getBody()->getContents();
            }catch(
\Exception $ex){
                
Log::info($ex->getMessage());
            }
        }
        
//END


        
return redirect(route('customer'))->with('success','Customer Created Successfully');
    }

    public function 
edit($id) {

        return 
view('admin.customer.edit',[
            
'data' => Customer::findOrFail($id),
        ]);
    }

    public function 
update(Request $request,$id) {

        
$this->validateData($request);
        
$data Customer::findOrFail($id);
        
$data->fill($request->only('firstname','lastname','email','telephone','password','status'))->save();

        
//Section Inventory API
        
$api_url Setting::where('key''api_url')->first();
        
$api_token Setting::where('key''api_token')->first();
        if (
$api_url && isset($api_url->value) && $api_token && isset($api_token->value)) {
            
$client = new Client();

            
$api_form_data=[
                
'user_id' => auth()->user()->id,
                
'username' => $request->firstname.$request->lastname,
                
'email' => $request->email,
                
'phone' => $request->telephone,
            ];

            
$response $client->post($api_url->value '/api/customer/update/'.$data->id, [
                
'headers' => [
                    
'Accept' => 'application/json',
                    
'Authorization' => 'Bearer ' $api_token->value,
                ],
                
'form_params' => $api_form_data
            
]);
            
$response $response->getBody()->getContents();

        }
        
//END



        
return redirect(route('customer'))->with('success','Customer Updated Successfully');
    }

    public function 
delete($id) {
        if(! 
$data Customer::whereId($id)->first()) {
            return 
redirect()->back()->with('error''Something went wrong');
        }

        
$data->delete();
        return 
redirect(route('customer'))->with('success''Customer  Deleted Successfully');
    }

    public function 
getDetail(Request $request) {
        return 
Customer::select('firstname','lastname','email','telephone')->whereId($request->id)->first();
    }
}

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