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


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

namespace Webkul\Contact\Repositories;

use 
Illuminate\Container\Container;
use 
Illuminate\Support\Facades\DB;
use 
Webkul\Attribute\Repositories\AttributeRepository;
use 
Webkul\Attribute\Repositories\AttributeValueRepository;
use 
Webkul\Contact\Contracts\Organization;
use 
Webkul\Core\Eloquent\Repository;

class 
OrganizationRepository extends Repository
{
    
/**
     * Create a new repository instance.
     *
     * @return void
     */
    
public function __construct(
        protected 
AttributeRepository $attributeRepository,
        protected 
AttributeValueRepository $attributeValueRepository,
        
Container $container
    
) {
        
parent::__construct($container);
    }

    
/**
     * Specify model class name.
     *
     * @return mixed
     */
    
public function model()
    {
        return 
Organization::class;
    }

    
/**
     * Create.
     *
     * @return \Webkul\Contact\Contracts\Organization
     */
    
public function create(array $data)
    {
        if (isset(
$data['user_id'])) {
            
$data['user_id'] = $data['user_id'] ?: null;
        }

        
$organization parent::create($data);

        
$this->attributeValueRepository->save(array_merge($data, [
            
'entity_id' => $organization->id,
        ]));

        return 
$organization;
    }

    
/**
     * Update.
     *
     * @param  int  $id
     * @param  array  $attribute
     * @return \Webkul\Contact\Contracts\Organization
     */
    
public function update(array $data$id$attributes = [])
    {
        if (isset(
$data['user_id'])) {
            
$data['user_id'] = $data['user_id'] ?: null;
        }

        
$organization parent::update($data$id);

        
/**
         * If attributes are provided then only save the provided attributes and return.
         */
        
if (! empty($attributes)) {
            
$conditions = ['entity_type' => $data['entity_type']];

            if (isset(
$data['quick_add'])) {
                
$conditions['quick_add'] = 1;
            }

            
$attributes $this->attributeRepository->where($conditions)
                ->
whereIn('code'$attributes)
                ->
get();

            
$this->attributeValueRepository->save(array_merge($data, [
                
'entity_id' => $organization->id,
            ]), 
$attributes);

            return 
$organization;
        }

        
$this->attributeValueRepository->save(array_merge($data, [
            
'entity_id' => $organization->id,
        ]));

        return 
$organization;
    }

    
/**
     * Delete organization and it's persons.
     *
     * @param  int  $id
     * @return @void
     */
    
public function delete($id)
    {
        
$organization $this->findOrFail($id);

        
DB::transaction(function () use ($organization$id) {
            
$this->attributeValueRepository->deleteWhere([
                
'entity_id'   => $id,
                
'entity_type' => 'organizations',
            ]);

            
$organization->delete();
        });
    }
}

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