!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/laravel-crm/packages/Webkul/Automation/src/Helpers/Entity/   drwxrwxrwx
Free 13.11 GB of 57.97 GB (22.61%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


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

namespace Webkul\Automation\Helpers\Entity;

use 
Illuminate\Support\Facades\Mail;
use 
Webkul\Admin\Notifications\Common;
use 
Webkul\Attribute\Repositories\AttributeRepository;
use 
Webkul\Automation\Repositories\WebhookRepository;
use 
Webkul\Automation\Services\WebhookService;
use 
Webkul\Contact\Repositories\PersonRepository;
use 
Webkul\EmailTemplate\Repositories\EmailTemplateRepository;
use 
Webkul\Lead\Repositories\LeadRepository;
use 
Webkul\Quote\Contracts\Quote as ContractsQuote;
use 
Webkul\Quote\Repositories\QuoteRepository;

class 
Quote extends AbstractEntity
{
    
/**
     * Define the entity type.
     */
    
protected string $entityType 'quotes';

    
/**
     * Create a new repository instance.
     *
     * @return void
     */
    
public function __construct(
        protected 
AttributeRepository $attributeRepository,
        protected 
EmailTemplateRepository $emailTemplateRepository,
        protected 
QuoteRepository $quoteRepository,
        protected 
LeadRepository $leadRepository,
        protected 
PersonRepository $personRepository,
        protected 
WebhookRepository $webhookRepository,
        protected 
WebhookService $webhookService
    
) {}

    
/**
     * Listing of the entities.
     */
    
public function getEntity(mixed $entity): mixed
    
{
        if (! 
$entity instanceof ContractsQuote) {
            
$entity $this->quoteRepository->find($entity);
        }

        return 
$entity;
    }

    
/**
     * Returns workflow actions.
     */
    
public function getActions(): array
    {
        
$emailTemplates $this->emailTemplateRepository->all(['id''name']);

        
$webhookOptions $this->webhookRepository->all(['id''name']);

        return [
            [
                
'id'         => 'update_quote',
                
'name'       => trans('admin::app.settings.workflows.helpers.update-quote'),
                
'attributes' => $this->getAttributes('quotes'),
            ], [
                
'id'         => 'update_person',
                
'name'       => trans('admin::app.settings.workflows.helpers.update-person'),
                
'attributes' => $this->getAttributes('persons'),
            ], [
                
'id'         => 'update_related_leads',
                
'name'       => trans('admin::app.settings.workflows.helpers.update-related-leads'),
                
'attributes' => $this->getAttributes('leads'),
            ], [
                
'id'      => 'send_email_to_person',
                
'name'    => trans('admin::app.settings.workflows.helpers.send-email-to-person'),
                
'options' => $emailTemplates,
            ], [
                
'id'      => 'send_email_to_sales_owner',
                
'name'    => trans('admin::app.settings.workflows.helpers.send-email-to-sales-owner'),
                
'options' => $emailTemplates,
            ], [
                
'id'      => 'trigger_webhook',
                
'name'    => trans('admin::app.settings.workflows.helpers.add-webhook'),
                
'options' => $webhookOptions,
            ],
        ];
    }

    
/**
     * Execute workflow actions.
     */
    
public function executeActions(mixed $workflowmixed $quote): void
    
{
        foreach (
$workflow->actions as $action) {
            switch (
$action['id']) {
                case 
'update_quote':
                    
$this->quoteRepository->update([
                        
'entity_type'        => 'quotes',
                        
$action['attribute'] => $action['value'],
                    ], 
$quote->id);

                    break;

                case 
'update_person':
                    
$this->personRepository->update([
                        
'entity_type'        => 'persons',
                        
$action['attribute'] => $action['value'],
                    ], 
$quote->person_id);

                    break;

                case 
'update_related_leads':
                    foreach (
$quote->leads as $lead) {
                        
$this->leadRepository->update(
                            [
                                
'entity_type'        => 'leads',
                                
$action['attribute'] => $action['value'],
                            ],
                            
$lead->id,
                            [
$action['attribute']]
                        );
                    }

                    break;

                case 
'send_email_to_person':
                    
$emailTemplate $this->emailTemplateRepository->find($action['value']);

                    if (! 
$emailTemplate) {
                        break;
                    }

                    try {
                        
Mail::queue(new Common([
                            
'to'      => data_get($quote->person->emails'*.value'),
                            
'subject' => $this->replacePlaceholders($quote$emailTemplate->subject),
                            
'body'    => $this->replacePlaceholders($quote$emailTemplate->content),
                        ]));
                    } catch (
\Exception $e) {
                    }

                    break;

                case 
'send_email_to_sales_owner':
                    
$emailTemplate $this->emailTemplateRepository->find($action['value']);

                    if (! 
$emailTemplate) {
                        break;
                    }

                    try {
                        
Mail::queue(new Common([
                            
'to'      => $quote->user->email,
                            
'subject' => $this->replacePlaceholders($quote$emailTemplate->subject),
                            
'body'    => $this->replacePlaceholders($quote$emailTemplate->content),
                        ]));
                    } catch (
\Exception $e) {
                    }

                    break;

                case 
'trigger_webhook':
                    try {
                        
$this->triggerWebhook($action['value'], $quote);
                    } catch (
\Exception $e) {
                        
report($e);
                    }

                    break;
            }
        }
    }
}

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