!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/Admin/src/Http/Requests/   drwxrwxrwx
Free 13.06 GB of 57.97 GB (22.53%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


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

namespace Webkul\Admin\Http\Requests;

use 
Carbon\Carbon;
use 
Illuminate\Foundation\Http\FormRequest;
use 
Webkul\Attribute\Repositories\AttributeRepository;
use 
Webkul\Attribute\Repositories\AttributeValueRepository;
use 
Webkul\Core\Contracts\Validations\Decimal;

class 
LeadForm extends FormRequest
{
    
/**
     * @var array
     */
    
protected $rules = [];

    
/**
     * Create a new form request instance.
     *
     * @return void
     */
    
public function __construct(
        protected 
AttributeRepository $attributeRepository,
        protected 
AttributeValueRepository $attributeValueRepository
    
) {}

    
/**
     * Determine if the product is authorized to make this request.
     *
     * @return bool
     */
    
public function authorize()
    {
        return 
true;
    }

    
/**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    
public function rules()
    {
        foreach ([
'leads''persons'] as $key => $entityType) {
            
$attributes $this->attributeRepository->scopeQuery(function ($query) use ($entityType) {
                
$attributeCodes $entityType == 'persons'
                    
array_keys(request('person') ?? [])
                    : 
array_keys(request()->all());

                
$query $query->whereIn('code'$attributeCodes)
                    ->
where('entity_type'$entityType);

                if (
request()->has('quick_add')) {
                    
$query $query->where('quick_add'1);
                }

                return 
$query;
            })->
get();

            foreach (
$attributes as $attribute) {
                if (
$entityType == 'persons') {
                    
$attribute->code 'person.'.$attribute->code;
                }

                
$validations = [];

                if (
$attribute->type == 'boolean') {
                    continue;
                } elseif (
$attribute->type == 'address') {
                    if (! 
$attribute->is_required) {
                        continue;
                    }

                    
$validations = [
                        
$attribute->code.'.address'  => 'required',
                        
$attribute->code.'.country'  => 'required',
                        
$attribute->code.'.state'    => 'required',
                        
$attribute->code.'.city'     => 'required',
                        
$attribute->code.'.postcode' => 'required',
                    ];
                } elseif (
$attribute->type == 'email') {
                    
$validations = [
                        
$attribute->code              => [$attribute->is_required 'required' 'nullable'],
                        
$attribute->code.'.*.value'   => [$attribute->is_required 'required' 'nullable''email'],
                        
$attribute->code.'.*.label'   => $attribute->is_required 'required' 'nullable',
                    ];
                } elseif (
$attribute->type == 'phone') {
                    
$validations = [
                        
$attribute->code              => [$attribute->is_required 'required' 'nullable'],
                        
$attribute->code.'.*.value'   => [$attribute->is_required 'required' 'nullable'],
                        
$attribute->code.'.*.label'   => $attribute->is_required 'required' 'nullable',
                    ];
                } else {
                    
$validations[$attribute->code] = [$attribute->is_required 'required' 'nullable'];

                    if (
$attribute->type == 'text' && $attribute->validation) {
                        
array_push($validations[$attribute->code],
                            
$attribute->validation == 'decimal'
                            
? new Decimal
                            
$attribute->validation
                        
);
                    }

                    if (
$attribute->type == 'price') {
                        
array_push($validations[$attribute->code], new Decimal);
                    }
                }

                if (
$attribute->is_unique) {
                    
array_push($validations[in_array($attribute->type, ['email''phone'])
                        ? 
$attribute->code.'.*.value'
                        
$attribute->code
                    
], function ($field$value$fail) use ($attribute$entityType) {
                        if (! 
$this->attributeValueRepository->isValueUnique(
                            
$entityType == 'persons' request('person.id') : $this->id,
                            
$attribute->entity_type,
                            
$attribute,
                            
request($field)
                        )
                        ) {
                            
$fail('The value has already been taken.');
                        }
                    });
                }

                
$this->rules array_merge($this->rules$validations);
            }
        }

        
$this->rules['expected_close_date'] = [
            
'date_format:Y-m-d',
            
'after:'.Carbon::yesterday()->format('Y-m-d'),
        ];

        return [
            ...
$this->rules,
            
'products'              => 'array',
            
'products.*.product_id' => 'sometimes|required|exists:products,id',
            
'products.*.name'       => 'required_with:products.*.product_id',
            
'products.*.price'      => 'required_with:products.*.product_id',
            
'products.*.quantity'   => 'required_with:products.*.product_id',
        ];
    }

    
/**
     * Get the validation messages that apply to the request.
     */
    
public function messages(): array
    {
        return [
            
'products.*.product_id.exists'      => trans('admin::app.leads.selected-product-not-exist'),
            
'products.*.name.required_with'     => trans('admin::app.leads.product-name-required'),
            
'products.*.price.required_with'    => trans('admin::app.leads.product-price-required'),
            
'products.*.quantity.required_with' => trans('admin::app.leads.product-quantity-required'),
        ];
    }
}

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