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

Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 

uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 

uid=33(www-data) gid=33(www-data) groups=33(www-data) 

Safe-mode: OFF (not secure)

/var/www/html/main_file/app/Http/Controllers/   drwxrwxr-x
Free 13.08 GB of 57.97 GB (22.57%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


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

namespace App\Http\Controllers;

use 
App\Models\BankAccount;
use 
App\Models\BillPayment;
use 
App\Models\CustomField;
use 
App\Models\InvoicePayment;
use 
App\Models\Payment;
use 
App\Models\Revenue;
use 
App\Models\Transaction;
use 
Illuminate\Http\Request;

class 
BankAccountController extends Controller
{

    public function 
index()
    {
        if(
\Auth::user()->can('create bank account'))
        {
            
$accounts BankAccount::where('created_by''='\Auth::user()->creatorId())->get();

            return 
view('bankAccount.index'compact('accounts'));
        }
        else
        {
            return 
redirect()->back()->with('error'__('Permission denied.'));
        }
    }

    public function 
create()
    {
        if(
\Auth::user()->can('create bank account'))
        {
            
$customFields CustomField::where('created_by''='\Auth::user()->creatorId())->where('module''=''account')->get();

            return 
view('bankAccount.create'compact('customFields'));
        }
        else
        {
            return 
response()->json(['error' => __('Permission denied.')], 401);
        }
    }

    public function 
store(Request $request)
    {
        if(
\Auth::user()->can('create bank account'))
        {

            
$validator \Validator::make(
                
$request->all(), [
                                   
'holder_name' => 'required',
                                   
'bank_name' => 'required',
                                   
'account_number' => 'required',
                                   
'opening_balance' => 'required',
                                   
'contact_number' => 'required|regex:/^([0-9\s\-\+\(\)]*)$/',
                               ]
            );

            if(
$validator->fails())
            {
                
$messages $validator->getMessageBag();

                return 
redirect()->route('bank-account.index')->with('error'$messages->first());
            }

            
$account                  = new BankAccount();
            
$account->holder_name     $request->holder_name;
            
$account->bank_name       $request->bank_name;
            
$account->account_number  $request->account_number;
            
$account->opening_balance $request->opening_balance;
            
$account->contact_number  $request->contact_number;
            
$account->bank_address    $request->bank_address;
            
$account->created_by      \Auth::user()->creatorId();
            
$account->save();
            
CustomField::saveData($account$request->customField);

            return 
redirect()->route('bank-account.index')->with('success'__('Account successfully created.'));
        }
        else
        {
            return 
redirect()->back()->with('error'__('Permission denied.'));
        }
    }


    public function 
edit(BankAccount $bankAccount)
    {
        if(
\Auth::user()->can('edit bank account'))
        {
            if(
$bankAccount->created_by == \Auth::user()->creatorId())
            {
                
$bankAccount->customField CustomField::getData($bankAccount'account');
                
$customFields             CustomField::where('created_by''='\Auth::user()->creatorId())->where('module''=''account')->get();

                return 
view('bankAccount.edit'compact('bankAccount''customFields'));
            }
            else
            {
                return 
response()->json(['error' => __('Permission denied.')], 401);
            }
        }
        else
        {
            return 
response()->json(['error' => __('Permission denied.')], 401);
        }
    }


    public function 
update(Request $requestBankAccount $bankAccount)
    {
        if(
\Auth::user()->can('create bank account'))
        {

            
$validator \Validator::make(
                
$request->all(), [
                                   
'holder_name' => 'required',
                                   
'bank_name' => 'required',
                                   
'account_number' => 'required',
                                   
'opening_balance' => 'required',
                                   
'contact_number' => 'required|regex:/^([0-9\s\-\+\(\)]*)$/',
                               ]
            );

            if(
$validator->fails())
            {
                
$messages $validator->getMessageBag();

                return 
redirect()->route('bank-account.index')->with('error'$messages->first());
            }

            
$bankAccount->holder_name     $request->holder_name;
            
$bankAccount->bank_name       $request->bank_name;
            
$bankAccount->account_number  $request->account_number;
            
$bankAccount->opening_balance $request->opening_balance;
            
$bankAccount->contact_number  $request->contact_number;
            
$bankAccount->bank_address    $request->bank_address;
            
$bankAccount->created_by      \Auth::user()->creatorId();
            
$bankAccount->save();
            
CustomField::saveData($bankAccount$request->customField);

            return 
redirect()->route('bank-account.index')->with('success'__('Account successfully updated.'));
        }
        else
        {
            return 
redirect()->back()->with('error'__('Permission denied.'));
        }
    }


    public function 
destroy(BankAccount $bankAccount)
    {
        if(
\Auth::user()->can('delete bank account'))
        {
            if(
$bankAccount->created_by == \Auth::user()->creatorId())
            {
                
$revenue        Revenue::where('account_id'$bankAccount->id)->first();
                
$invoicePayment InvoicePayment::where('account_id'$bankAccount->id)->first();
                
$transaction    Transaction::where('account'$bankAccount->id)->first();
                
$payment        Payment::where('account_id'$bankAccount->id)->first();
                
$billPayment    BillPayment::first();

                if(!empty(
$revenue) && !empty($invoicePayment) && !empty($transaction) && !empty($payment) && !empty($billPayment))
                {
                    return 
redirect()->route('bank-account.index')->with('error'__('Please delete related record of this account.'));
                }
                else
                {
                    
$bankAccount->delete();

                    return 
redirect()->route('bank-account.index')->with('success'__('Account successfully deleted.'));
                }

            }
            else
            {
                return 
redirect()->back()->with('error'__('Permission denied.'));
            }
        }
        else
        {
            return 
redirect()->back()->with('error'__('Permission denied.'));
        }
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

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

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