HEX
Server: nginx/1.28.1
System: Linux 10-41-63-61 6.8.0-31-generic #31-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 20 00:40:06 UTC 2024 x86_64
User: www (1001)
PHP: 7.4.33
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: /www/wwwroot//www.shooperm.com/app/Repositories/SupportTicketRepository.php
<?php
namespace App\Repositories;

use Modules\SupportTicket\Entities\SupportTicket;
use Modules\SupportTicket\Entities\TicketCategory;
use Modules\SupportTicket\Entities\TicketPriority;
use Modules\SupportTicket\Entities\TicketStatus;

class SupportTicketRepository{

    public function getMyTickets($id){
        return SupportTicket::with('messages.attachMsgFile','messages.user')->where('user_id', $id)->paginate(10);
    }

    public function getMyTicketWithPaginate($data){
        if($data['status']){
            
            return SupportTicket::with('messages.attachMsgFile','messages.user')->where('user_id',$data['user_id'])->where('status_id',$data['status'])->paginate(10);
        }else{
            return SupportTicket::where('user_id', $data['user_id'])->paginate(10);
        }
    }

    public function getCategories(){
        return TicketCategory::where('status', 1)->latest()->get();
    }

    public function getPriorities(){
        return TicketPriority::where('status', 1)->latest()->get();
    }

    public function getStatuses(){
        return TicketStatus::where('status', 1)->get();
    }

    public function store($data, $user_id){
        $rand = mt_rand(10,99);
        $time = time();
        $time = substr($time,6);
        $uliqueId = $rand . $time;
        $pre = 'TIC';

        return SupportTicket::create([
            'reference_no'  => $pre . $uliqueId,
            'subject'       => $data['subject'],
            'description'   => $data['description'],
            'user_id'       => $data['user_id'] ?? $user_id,
            'priority_id'   => $data['priority_id'],
            'category_id'   => $data['category_id'],
            'status_id'     => $request['status'] ?? 1
        ]);
        
    }

    public function getTicketById($id){
        return SupportTicket::with('messages.attachMsgFile','messages.user')->where('reference_no', $id)->first();
    }
}