Bug fix and Api updates
This commit is contained in:
@@ -735,15 +735,15 @@ class TicketController extends Controller {
|
||||
$eventuserid = $eventthread->user_id;
|
||||
$emailadd = User::where('id', $eventuserid)->first()->email;
|
||||
$source = $eventthread->source;
|
||||
$form_data = $request->except('ReplyContent', 'ticket_ID', 'attachment');
|
||||
$form_data = $request->except('reply_content', 'ticket_ID', 'attachment');
|
||||
\Event::fire(new \App\Events\ClientTicketFormPost($form_data, $emailadd, $source));
|
||||
// dd($attachments);
|
||||
// }
|
||||
//return $attachments;
|
||||
$reply_content = $request->input('ReplyContent');
|
||||
$reply_content = $request->input('reply_content');
|
||||
$thread->ticket_id = $request->input('ticket_ID');
|
||||
$thread->poster = 'support';
|
||||
$thread->body = $request->input('ReplyContent');
|
||||
$thread->body = $request->input('reply_content');
|
||||
$thread->user_id = Auth::user()->id;
|
||||
$ticket_id = $request->input('ticket_ID');
|
||||
//dd($ticket_id);
|
||||
@@ -828,7 +828,7 @@ class TicketController extends Controller {
|
||||
|
||||
try {
|
||||
$this->PhpMailController->sendmail(
|
||||
$from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $user_name, 'email' => $email, 'cc' => $collaborators], $message = ['subject' => $ticket_subject . '[#' . $ticket_number . ']', 'body' => $request->input('ReplyContent'), 'scenario' => 'ticket-reply-agent', 'attachments' => $attachment_files], $template_variables = ['ticket_number' => $ticket_number, 'user' => $username, 'agent_sign' => $agentsign]
|
||||
$from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $user_name, 'email' => $email, 'cc' => $collaborators], $message = ['subject' => $ticket_subject . '[#' . $ticket_number . ']', 'body' => $request->input('reply_content'), 'scenario' => 'ticket-reply-agent', 'attachments' => $attachment_files], $template_variables = ['ticket_number' => $ticket_number, 'user' => $username, 'agent_sign' => $agentsign]
|
||||
);
|
||||
} catch (\Exception $e) {
|
||||
return 0;
|
||||
@@ -843,7 +843,7 @@ class TicketController extends Controller {
|
||||
* @param type Ticket_Thread $thread
|
||||
* @return type bool
|
||||
*/
|
||||
public function ticket_edit_post($ticket_id, Ticket_Thread $thread, Tickets $ticket) {
|
||||
public function ticketEditPost($ticket_id, Ticket_Thread $thread, Tickets $ticket) {
|
||||
|
||||
if (Input::get('subject') == null) {
|
||||
return 1;
|
||||
@@ -887,7 +887,7 @@ class TicketController extends Controller {
|
||||
* @param type $ticket_number
|
||||
* @return type integer
|
||||
*/
|
||||
public function ticket_number($ticket_number) {
|
||||
public function ticketNumber($ticket_number) {
|
||||
$number = $ticket_number;
|
||||
$number = explode('-', $number);
|
||||
$number1 = $number[0];
|
||||
@@ -917,7 +917,7 @@ class TicketController extends Controller {
|
||||
* @param type $email
|
||||
* @return type bool
|
||||
*/
|
||||
public function check_email($email) {
|
||||
public function checkEmail($email) {
|
||||
$check = User::where('email', '=', $email)->first();
|
||||
if ($check == true) {
|
||||
return $check;
|
||||
@@ -948,7 +948,7 @@ class TicketController extends Controller {
|
||||
|
||||
// check emails
|
||||
$ticket_creator = $username;
|
||||
$checkemail = $this->check_email($emailadd);
|
||||
$checkemail = $this->checkEmail($emailadd);
|
||||
$company = $this->company();
|
||||
if ($checkemail == false) {
|
||||
// Generate password
|
||||
@@ -1173,16 +1173,16 @@ class TicketController extends Controller {
|
||||
$ticket_threads->save();
|
||||
}
|
||||
if (isset($id)) {
|
||||
if ($this->ticket_thread($subject, $body, $id, $user_id)) {
|
||||
if ($this->ticketThread($subject, $body, $id, $user_id)) {
|
||||
return array($ticket_number, 1);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$ticket_number = $this->create_ticket($user_id, $subject, $body, $helptopic, $sla, $priority, $source, $headers, $dept, $assignto, $form_data);
|
||||
$ticket_number = $this->createTicket($user_id, $subject, $body, $helptopic, $sla, $priority, $source, $headers, $dept, $assignto, $form_data);
|
||||
return array($ticket_number, 0);
|
||||
}
|
||||
} else {
|
||||
$ticket_number = $this->create_ticket($user_id, $subject, $body, $helptopic, $sla, $priority, $source, $headers, $dept, $assignto, $form_data);
|
||||
$ticket_number = $this->createTicket($user_id, $subject, $body, $helptopic, $sla, $priority, $source, $headers, $dept, $assignto, $form_data);
|
||||
return array($ticket_number, 0);
|
||||
}
|
||||
}
|
||||
@@ -1197,7 +1197,7 @@ class TicketController extends Controller {
|
||||
* @param type $priority
|
||||
* @return type string
|
||||
*/
|
||||
public function create_ticket($user_id, $subject, $body, $helptopic, $sla, $priority, $source, $headers, $dept, $assignto, $form_data) {
|
||||
public function createTicket($user_id, $subject, $body, $helptopic, $sla, $priority, $source, $headers, $dept, $assignto, $form_data) {
|
||||
$max_number = Tickets::whereRaw('id = (select max(`id`) from tickets)')->first();
|
||||
if ($max_number == null) {
|
||||
$ticket_number = "AAAA-9999-9999999";
|
||||
@@ -1209,7 +1209,7 @@ class TicketController extends Controller {
|
||||
|
||||
|
||||
$ticket = new Tickets;
|
||||
$ticket->ticket_number = $this->ticket_number($ticket_number);
|
||||
$ticket->ticket_number = $this->ticketNumber($ticket_number);
|
||||
$ticket->user_id = $user_id;
|
||||
$ticket->dept_id = $dept;
|
||||
$ticket->help_topic_id = $helptopic;
|
||||
@@ -1251,8 +1251,8 @@ class TicketController extends Controller {
|
||||
}
|
||||
// store collaborators
|
||||
// dd($headers);
|
||||
$this->store_collaborators($headers, $id);
|
||||
if ($this->ticket_thread($subject, $body, $id, $user_id) == true) {
|
||||
$this->storeCollaborators($headers, $id);
|
||||
if ($this->ticketThread($subject, $body, $id, $user_id) == true) {
|
||||
return $ticket_number;
|
||||
}
|
||||
}
|
||||
@@ -1265,7 +1265,7 @@ class TicketController extends Controller {
|
||||
* @param type $user_id
|
||||
* @return type
|
||||
*/
|
||||
public function ticket_thread($subject, $body, $id, $user_id) {
|
||||
public function ticketThread($subject, $body, $id, $user_id) {
|
||||
$thread = new Ticket_Thread;
|
||||
$thread->user_id = $user_id;
|
||||
$thread->ticket_id = $id;
|
||||
@@ -1601,7 +1601,7 @@ class TicketController extends Controller {
|
||||
* @param type $headers
|
||||
* @return type
|
||||
*/
|
||||
public function store_collaborators($headers, $id) {
|
||||
public function storeCollaborators($headers, $id) {
|
||||
$company = $this->company();
|
||||
if (isset($headers)) {
|
||||
foreach ($headers as $email => $name) {
|
||||
@@ -1610,7 +1610,7 @@ class TicketController extends Controller {
|
||||
}
|
||||
$name = $name;
|
||||
$email = $email;
|
||||
if ($this->check_email($email) == false) {
|
||||
if ($this->checkEmail($email) == false) {
|
||||
$create_user = new User;
|
||||
$create_user->user_name = $name;
|
||||
$create_user->email = $email;
|
||||
@@ -1636,7 +1636,7 @@ class TicketController extends Controller {
|
||||
|
||||
}
|
||||
} else {
|
||||
$user = $this->check_email($email);
|
||||
$user = $this->checkEmail($email);
|
||||
$user_id = $user->id;
|
||||
}
|
||||
$collaborator_store = new Ticket_Collaborator;
|
||||
|
@@ -19,6 +19,7 @@ use App\Model\helpdesk\Manage\Sla_plan;
|
||||
use App\Model\helpdesk\Utility\Priority;
|
||||
use App\Model\helpdesk\Agent\Department;
|
||||
use App\Model\helpdesk\Ticket\Ticket_source;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* -----------------------------------------------------------------------------
|
||||
@@ -111,7 +112,7 @@ class ApiController extends Controller {
|
||||
* @param user_id,subject,body,helptopic,sla,priority,dept
|
||||
* @return json
|
||||
*/
|
||||
public function CreateTicket() {
|
||||
public function createTicket() {
|
||||
try {
|
||||
$v = \Validator::make($this->request->all(), [
|
||||
'user_id' => 'required|exists:users,id',
|
||||
@@ -145,7 +146,7 @@ class ApiController extends Controller {
|
||||
/**
|
||||
* return s ticket number
|
||||
*/
|
||||
$response = $this->ticket->create_ticket($user_id, $subject, $body, $helptopic, $sla, $priority, $source, $headers, $dept, $assignto, $form_data, $attach);
|
||||
$response = $this->ticket->createTicket($user_id, $subject, $body, $helptopic, $sla, $priority, $source, $headers, $dept, $assignto, $form_data, $attach);
|
||||
|
||||
/**
|
||||
* return ticket details
|
||||
@@ -170,11 +171,11 @@ class ApiController extends Controller {
|
||||
* @param TicketRequest $request
|
||||
* @return json
|
||||
*/
|
||||
public function TicketReply() {
|
||||
public function ticketReply() {
|
||||
try {
|
||||
$v = \Validator::make($this->request->all(), [
|
||||
'ticket_ID' => 'required|exists:tickets,id',
|
||||
'ReplyContent' => 'required',
|
||||
'reply_content' => 'required',
|
||||
]);
|
||||
if ($v->fails()) {
|
||||
$error = $v->errors();
|
||||
@@ -198,7 +199,7 @@ class ApiController extends Controller {
|
||||
* Edit a ticket
|
||||
* @return json
|
||||
*/
|
||||
public function EditTicket() {
|
||||
public function editTicket() {
|
||||
try {
|
||||
$v = \Validator::make($this->request->all(), [
|
||||
'ticket_id' => 'required|exists:tickets,id',
|
||||
@@ -213,7 +214,7 @@ class ApiController extends Controller {
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
$ticket_id = $this->request->input('ticket_id');
|
||||
$result = $this->ticket->ticket_edit_post($ticket_id, $this->thread, $this->model);
|
||||
$result = $this->ticket->ticketEditPost($ticket_id, $this->thread, $this->model);
|
||||
return response()->json(compact('result'));
|
||||
} catch (\Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
@@ -230,7 +231,7 @@ class ApiController extends Controller {
|
||||
* Delete The Ticket
|
||||
* @return json
|
||||
*/
|
||||
public function DeleteTicket() {
|
||||
public function deleteTicket() {
|
||||
try {
|
||||
$v = \Validator::make($this->request->all(), [
|
||||
'ticket_id' => 'required|exists:tickets,id',
|
||||
@@ -258,10 +259,31 @@ class ApiController extends Controller {
|
||||
* Get all opened tickets
|
||||
* @return json
|
||||
*/
|
||||
public function OpenedTickets() {
|
||||
public function openedTickets() {
|
||||
try {
|
||||
$result = $this->model->where('status', '=', 1)->where('isanswered', '=', 0)->where('assigned_to', '=', null)->orderBy('id', 'DESC')->get();
|
||||
return response()->json(compact('result'));
|
||||
// $result = $this->model->where('status', '=', 1)->where('isanswered', '=', 0)->where('assigned_to', '=', null)->orderBy('id', 'DESC')->get();
|
||||
// return response()->json(compact('result'));
|
||||
|
||||
$result = $this->user->join('tickets', function($join) {
|
||||
$join->on('users.id', '=', 'tickets.user_id')
|
||||
->where('isanswered','=',0)->where('status','=' ,1)->whereNull('assigned_to');
|
||||
})
|
||||
->join('department', 'department.id', '=', 'tickets.dept_id')
|
||||
->join('ticket_priority', 'ticket_priority.priority_id', '=', 'tickets.priority_id')
|
||||
->join('sla_plan', 'sla_plan.id', '=', 'tickets.sla')
|
||||
->join('help_topic', 'help_topic.id', '=', 'tickets.help_topic_id')
|
||||
->join('ticket_status', 'ticket_status.id', '=', 'tickets.status')
|
||||
->join('ticket_thread', function($join) {
|
||||
$join->on('tickets.id', '=', 'ticket_thread.ticket_id')
|
||||
->whereNotNull('title');
|
||||
})
|
||||
->select('first_name', 'last_name', 'email', 'profile_pic', 'ticket_number', 'tickets.id', 'title', 'tickets.created_at', 'department.name as department_name', 'ticket_priority.priority as priotity_name', 'sla_plan.name as sla_plan_name', 'help_topic.topic as help_topic_name', 'ticket_status.name as ticket_status_name')
|
||||
->groupby('tickets.id')
|
||||
->distinct()
|
||||
->paginate(10)
|
||||
->toJson();
|
||||
return $result;
|
||||
|
||||
} catch (\Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
$line = $e->getLine();
|
||||
@@ -277,10 +299,30 @@ class ApiController extends Controller {
|
||||
* Get Unsigned Tickets
|
||||
* @return json
|
||||
*/
|
||||
public function UnassignedTickets() {
|
||||
public function unassignedTickets() {
|
||||
try {
|
||||
$result = $this->model->where('assigned_to', '=', null)->where('status', '1')->orderBy('id', 'DESC')->get();
|
||||
return response()->json(compact('result'));
|
||||
//dd('sdhjbc');
|
||||
// $result = $this->model->where('assigned_to', '=', null)->where('status', '1')->orderBy('id', 'DESC')->get();
|
||||
// return response()->json(compact('result'));
|
||||
$unassigned = $this->user->join('tickets', function($join) {
|
||||
$join->on('users.id', '=', 'tickets.user_id')
|
||||
->whereNull('assigned_to')->where('status', '=',1);
|
||||
})
|
||||
->join('department', 'department.id', '=', 'tickets.dept_id')
|
||||
->join('ticket_priority', 'ticket_priority.priority_id', '=', 'tickets.priority_id')
|
||||
->join('sla_plan', 'sla_plan.id', '=', 'tickets.sla')
|
||||
->join('help_topic', 'help_topic.id', '=', 'tickets.help_topic_id')
|
||||
->join('ticket_status', 'ticket_status.id', '=', 'tickets.status')
|
||||
->join('ticket_thread', function($join) {
|
||||
$join->on('tickets.id', '=', 'ticket_thread.ticket_id')
|
||||
->whereNotNull('title');
|
||||
})
|
||||
->select('first_name', 'last_name', 'email', 'profile_pic', 'ticket_number', 'tickets.id', 'title', 'tickets.created_at', 'department.name as department_name', 'ticket_priority.priority as priotity_name', 'sla_plan.name as sla_plan_name', 'help_topic.topic as help_topic_name', 'ticket_status.name as ticket_status_name')
|
||||
->groupby('tickets.id')
|
||||
->distinct()
|
||||
->paginate(10)
|
||||
->toJson();
|
||||
return $unassigned;
|
||||
} catch (\Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
$line = $e->getLine();
|
||||
@@ -296,10 +338,30 @@ class ApiController extends Controller {
|
||||
* Get closed Tickets
|
||||
* @return json
|
||||
*/
|
||||
public function CloseTickets() {
|
||||
public function closeTickets() {
|
||||
try {
|
||||
$result = $this->model->where('status', '>', 1)->where('status', '<', 4)->orderBy('id', 'DESC')->get();
|
||||
return response()->json(compact('result'));
|
||||
// $result = $this->model->where('status', '>', 1)->where('status', '<', 4)->orderBy('id', 'DESC')->get();
|
||||
// return response()->json(compact('result'));
|
||||
|
||||
$result = $this->user->join('tickets', function($join) {
|
||||
$join->on('users.id', '=', 'tickets.user_id')
|
||||
->where('isanswered','=',0)->where('status', '>', 1)->where('status', '<', 4);
|
||||
})
|
||||
->join('department', 'department.id', '=', 'tickets.dept_id')
|
||||
->join('ticket_priority', 'ticket_priority.priority_id', '=', 'tickets.priority_id')
|
||||
->join('sla_plan', 'sla_plan.id', '=', 'tickets.sla')
|
||||
->join('help_topic', 'help_topic.id', '=', 'tickets.help_topic_id')
|
||||
->join('ticket_status', 'ticket_status.id', '=', 'tickets.status')
|
||||
->join('ticket_thread', function($join) {
|
||||
$join->on('tickets.id', '=', 'ticket_thread.ticket_id')
|
||||
->whereNotNull('title');
|
||||
})
|
||||
->select('first_name', 'last_name', 'email', 'profile_pic', 'ticket_number', 'tickets.id', 'title', 'tickets.created_at', 'department.name as department_name', 'ticket_priority.priority as priotity_name', 'sla_plan.name as sla_plan_name', 'help_topic.topic as help_topic_name', 'ticket_status.name as ticket_status_name')
|
||||
->groupby('tickets.id')
|
||||
->distinct()
|
||||
->paginate(10)
|
||||
->toJson();
|
||||
return $result;
|
||||
} catch (\Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
$line = $e->getLine();
|
||||
@@ -315,7 +377,7 @@ class ApiController extends Controller {
|
||||
* Get All agents
|
||||
* @return json
|
||||
*/
|
||||
public function GetAgents() {
|
||||
public function getAgents() {
|
||||
try {
|
||||
$result = $this->faveoUser->where('role', 'agent')->orWhere('role', 'admin')->where('active', 1)->get();
|
||||
return response()->json(compact('result'));
|
||||
@@ -334,7 +396,7 @@ class ApiController extends Controller {
|
||||
* Get All Teams
|
||||
* @return json
|
||||
*/
|
||||
public function GetTeams() {
|
||||
public function getTeams() {
|
||||
try {
|
||||
$result = $this->team->get();
|
||||
return response()->json(compact('result'));
|
||||
@@ -353,7 +415,7 @@ class ApiController extends Controller {
|
||||
* To assign a ticket
|
||||
* @return json
|
||||
*/
|
||||
public function AssignTicket() {
|
||||
public function assignTicket() {
|
||||
try {
|
||||
$v = \Validator::make($this->request->all(), [
|
||||
'ticket_id' => 'required',
|
||||
@@ -386,7 +448,7 @@ class ApiController extends Controller {
|
||||
* Get all customers
|
||||
* @return json
|
||||
*/
|
||||
public function GetCustomers() {
|
||||
public function getCustomers() {
|
||||
try {
|
||||
$v = \Validator::make($this->request->all(), [
|
||||
'search' => 'required',
|
||||
@@ -413,7 +475,7 @@ class ApiController extends Controller {
|
||||
* Get a customer by id
|
||||
* @return json
|
||||
*/
|
||||
public function GetCustomer() {
|
||||
public function getCustomer() {
|
||||
try {
|
||||
$v = \Validator::make($this->request->all(), [
|
||||
'user_id' => 'required',
|
||||
@@ -440,7 +502,7 @@ class ApiController extends Controller {
|
||||
* Search tickets
|
||||
* @return json
|
||||
*/
|
||||
public function SearchTicket() {
|
||||
public function searchTicket() {
|
||||
try {
|
||||
$v = \Validator::make($this->request->all(), [
|
||||
'search' => 'required',
|
||||
@@ -467,7 +529,7 @@ class ApiController extends Controller {
|
||||
* Get threads of a ticket
|
||||
* @return json
|
||||
*/
|
||||
public function TicketThreads() {
|
||||
public function ticketThreads() {
|
||||
try {
|
||||
$v = \Validator::make($this->request->all(), [
|
||||
'id' => 'required',
|
||||
@@ -479,7 +541,7 @@ class ApiController extends Controller {
|
||||
$id = $this->request->input('id');
|
||||
$result = $this->thread->where('ticket_id', $id)->get();
|
||||
return response()->json(compact('result'));
|
||||
} catch (Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
$line = $e->getLine();
|
||||
$file = $e->getFile();
|
||||
@@ -494,7 +556,7 @@ class ApiController extends Controller {
|
||||
* Check the url is valid or not
|
||||
* @return json
|
||||
*/
|
||||
public function CheckUrl() {
|
||||
public function checkUrl() {
|
||||
//dd($this->request);
|
||||
try {
|
||||
$v = \Validator::make($this->request->all(), [
|
||||
@@ -506,11 +568,11 @@ class ApiController extends Controller {
|
||||
}
|
||||
|
||||
$url = $this->request->input('url');
|
||||
$url = $url . "/api/v1/helpdesk/check-url?api-key=" . $this->request->input('api-key') . "&token=" . \Config::get('app.token');
|
||||
$url = $url . "/api/v1/helpdesk/check-url?api_key=" . $this->request->input('api_key') . "&token=" . \Config::get('app.token');
|
||||
$result = $this->CallGetApi($url);
|
||||
//dd($result);
|
||||
return response()->json(compact('result'));
|
||||
} catch (Exception $ex) {
|
||||
} catch (\Exception $ex) {
|
||||
$error = $e->getMessage();
|
||||
return response()->json(compact('error'));
|
||||
} catch (\TokenExpiredException $e) {
|
||||
@@ -523,7 +585,7 @@ class ApiController extends Controller {
|
||||
* Success for currect url
|
||||
* @return string
|
||||
*/
|
||||
public function UrlResult() {
|
||||
public function urlResult() {
|
||||
return "success";
|
||||
}
|
||||
|
||||
@@ -532,7 +594,7 @@ class ApiController extends Controller {
|
||||
* @param type $url
|
||||
* @return type int|string|json
|
||||
*/
|
||||
public function CallGetApi($url) {
|
||||
public function callGetApi($url) {
|
||||
|
||||
$curl = curl_init($url);
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
|
||||
@@ -555,7 +617,7 @@ class ApiController extends Controller {
|
||||
* @param type $data
|
||||
* @return type int|string|json
|
||||
*/
|
||||
public function CallPostApi($url, $data) {
|
||||
public function callPostApi($url, $data) {
|
||||
|
||||
$curl = curl_init($url);
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
|
||||
@@ -578,7 +640,7 @@ class ApiController extends Controller {
|
||||
*
|
||||
* @return type | json
|
||||
*/
|
||||
public function GenerateApiKey() {
|
||||
public function generateApiKey() {
|
||||
try {
|
||||
$set = $this->setting->where('id', '1')->first();
|
||||
//dd($set);
|
||||
@@ -592,7 +654,7 @@ class ApiController extends Controller {
|
||||
$result = 'please enable api';
|
||||
return response()->json(compact('result'));
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
$line = $e->getLine();
|
||||
$file = $e->getFile();
|
||||
@@ -607,11 +669,11 @@ class ApiController extends Controller {
|
||||
* Get help topics
|
||||
* @return json
|
||||
*/
|
||||
public function GetHelpTopic() {
|
||||
public function getHelpTopic() {
|
||||
try {
|
||||
$result = $this->helptopic->get();
|
||||
return response()->json(compact('result'));
|
||||
} catch (Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
$line = $e->getLine();
|
||||
$file = $e->getFile();
|
||||
@@ -626,11 +688,11 @@ class ApiController extends Controller {
|
||||
* Get Sla plans
|
||||
* @return json
|
||||
*/
|
||||
public function GetSlaPlan() {
|
||||
public function getSlaPlan() {
|
||||
try {
|
||||
$result = $this->slaPlan->get();
|
||||
return response()->json(compact('result'));
|
||||
} catch (Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
$line = $e->getLine();
|
||||
$file = $e->getFile();
|
||||
@@ -645,11 +707,11 @@ class ApiController extends Controller {
|
||||
* Get priorities
|
||||
* @return json
|
||||
*/
|
||||
public function GetPriority() {
|
||||
public function getPriority() {
|
||||
try {
|
||||
$result = $this->priority->get();
|
||||
return response()->json(compact('result'));
|
||||
} catch (Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
$line = $e->getLine();
|
||||
$file = $e->getFile();
|
||||
@@ -664,11 +726,11 @@ class ApiController extends Controller {
|
||||
* Get departments
|
||||
* @return json
|
||||
*/
|
||||
public function GetDepartment() {
|
||||
public function getDepartment() {
|
||||
try {
|
||||
$result = $this->department->get();
|
||||
return response()->json(compact('result'));
|
||||
} catch (Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
$line = $e->getLine();
|
||||
$file = $e->getFile();
|
||||
@@ -683,12 +745,12 @@ class ApiController extends Controller {
|
||||
* Getting the tickets
|
||||
* @return type json
|
||||
*/
|
||||
public function GetTickets() {
|
||||
public function getTickets() {
|
||||
try {
|
||||
$tickets = $this->model->paginate(10);
|
||||
$tickets->toJson();
|
||||
return $tickets;
|
||||
} catch (Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
$line = $e->getLine();
|
||||
$file = $e->getFile();
|
||||
@@ -703,11 +765,11 @@ class ApiController extends Controller {
|
||||
* Fetching the Inbox details
|
||||
* @return type json
|
||||
*/
|
||||
public function Inbox() {
|
||||
public function inbox() {
|
||||
try {
|
||||
$result = $this->user->join('tickets', 'users.id', '=', 'tickets.user_id')
|
||||
$inbox = $this->user->join('tickets', 'users.id', '=', 'tickets.user_id')
|
||||
->join('department', 'department.id', '=', 'tickets.dept_id')
|
||||
->join('priority', 'priority.id', '=', 'tickets.priority_id')
|
||||
->join('ticket_priority', 'ticket_priority.priority_id', '=', 'tickets.priority_id')
|
||||
->join('sla_plan', 'sla_plan.id', '=', 'tickets.sla')
|
||||
->join('help_topic', 'help_topic.id', '=', 'tickets.help_topic_id')
|
||||
->join('ticket_status', 'ticket_status.id', '=', 'tickets.status')
|
||||
@@ -715,17 +777,20 @@ class ApiController extends Controller {
|
||||
$join->on('tickets.id', '=', 'ticket_thread.ticket_id')
|
||||
->whereNotNull('title');
|
||||
})
|
||||
->select('first_name', 'last_name', 'email', 'profile_pic', 'ticket_number', 'tickets.id', 'title', 'tickets.created_at', 'department.name as department_name', 'priority.name as priotity_name', 'sla_plan.name as sla_plan_name', 'help_topic.topic as help_topic_name', 'ticket_status.name as ticket_status_name')
|
||||
->select('first_name', 'last_name', 'email', 'profile_pic', 'ticket_number', 'tickets.id', 'title', 'tickets.created_at', 'department.name as department_name', 'ticket_priority.priority as priotity_name', 'sla_plan.name as sla_plan_name', 'help_topic.topic as help_topic_name', 'ticket_status.name as ticket_status_name')
|
||||
->groupby('tickets.id')
|
||||
->distinct()
|
||||
->paginate(10)
|
||||
->toJson();
|
||||
return $result;
|
||||
} catch (Exception $ex) {
|
||||
return $inbox;
|
||||
} catch (\Exception $ex) {
|
||||
$error = $e->getMessage();
|
||||
$line = $e->getLine();
|
||||
$file = $e->getFile();
|
||||
return response()->json(compact('error', 'file', 'line'));
|
||||
}catch (\TokenExpiredException $e) {
|
||||
$error = $e->getMessage();
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -733,7 +798,7 @@ class ApiController extends Controller {
|
||||
* Create internal note
|
||||
* @return type json
|
||||
*/
|
||||
public function InternalNote() {
|
||||
public function internalNote() {
|
||||
try {
|
||||
$v = \Validator::make($this->request->all(), [
|
||||
'userid' => 'required|exists:users,id',
|
||||
@@ -750,11 +815,94 @@ class ApiController extends Controller {
|
||||
$body = $this->request->input('body');
|
||||
$thread = $this->thread->create(['ticket_id' => $ticketid, 'user_id' => $userid, 'is_internal' => 1, 'body' => $body]);
|
||||
return response()->json(compact('thread'));
|
||||
} catch (Exception $ex) {
|
||||
} catch (\Exception $ex) {
|
||||
$error = $e->getMessage();
|
||||
$line = $e->getLine();
|
||||
$file = $e->getFile();
|
||||
return response()->json(compact('error', 'file', 'line'));
|
||||
}catch (\TokenExpiredException $e) {
|
||||
$error = $e->getMessage();
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
}
|
||||
|
||||
public function getTrash(){
|
||||
try{
|
||||
$trash = $this->user->join('tickets', function($join) {
|
||||
$join->on('users.id', '=', 'tickets.user_id')
|
||||
->where('status', '=',5);
|
||||
})
|
||||
->join('department', 'department.id', '=', 'tickets.dept_id')
|
||||
->join('ticket_priority', 'ticket_priority.priority_id', '=', 'tickets.priority_id')
|
||||
->join('sla_plan', 'sla_plan.id', '=', 'tickets.sla')
|
||||
->join('help_topic', 'help_topic.id', '=', 'tickets.help_topic_id')
|
||||
->join('ticket_status', 'ticket_status.id', '=', 'tickets.status')
|
||||
->join('ticket_thread', function($join) {
|
||||
$join->on('tickets.id', '=', 'ticket_thread.ticket_id')
|
||||
->whereNotNull('title');
|
||||
})
|
||||
->select('first_name', 'last_name', 'email', 'profile_pic', 'ticket_number', 'tickets.id', 'title', 'tickets.created_at', 'department.name as department_name', 'ticket_priority.priority as priotity_name', 'sla_plan.name as sla_plan_name', 'help_topic.topic as help_topic_name', 'ticket_status.name as ticket_status_name')
|
||||
->groupby('tickets.id')
|
||||
->distinct()
|
||||
->paginate(10)
|
||||
->toJson();
|
||||
return $trash;
|
||||
|
||||
|
||||
} catch (\Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
$line = $e->getLine();
|
||||
$file = $e->getFile();
|
||||
return response()->json(compact('error', 'file', 'line'));
|
||||
}catch (\TokenExpiredException $e) {
|
||||
$error = $e->getMessage();
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
}
|
||||
public function getMyTickets(){
|
||||
|
||||
try{
|
||||
$v = \Validator::make($this->request->all(), [
|
||||
'user_id' => 'required|exists:users,id'
|
||||
]);
|
||||
if ($v->fails()) {
|
||||
$error = $v->errors();
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
$id = $this->request->input('user_id');
|
||||
if($this->user->where('id',$id)->first()->role=='user'){
|
||||
$error = "This user is not an Aget or Admin";
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
$result = $this->user->join('tickets', function($join) use($id){
|
||||
$join->on('users.id', '=', 'tickets.user_id')
|
||||
->where('user_id', '=',$id);
|
||||
})
|
||||
->join('department', 'department.id', '=', 'tickets.dept_id')
|
||||
->join('ticket_priority', 'ticket_priority.priority_id', '=', 'tickets.priority_id')
|
||||
->join('sla_plan', 'sla_plan.id', '=', 'tickets.sla')
|
||||
->join('help_topic', 'help_topic.id', '=', 'tickets.help_topic_id')
|
||||
->join('ticket_status', 'ticket_status.id', '=', 'tickets.status')
|
||||
->join('ticket_thread', function($join) {
|
||||
$join->on('tickets.id', '=', 'ticket_thread.ticket_id')
|
||||
->whereNotNull('title');
|
||||
})
|
||||
->select('first_name', 'last_name', 'email', 'profile_pic', 'ticket_number', 'tickets.id', 'title', 'tickets.created_at', 'department.name as department_name', 'ticket_priority.priority as priotity_name', 'sla_plan.name as sla_plan_name', 'help_topic.topic as help_topic_name', 'ticket_status.name as ticket_status_name')
|
||||
->groupby('tickets.id')
|
||||
->distinct()
|
||||
->paginate(10)
|
||||
->toJson();
|
||||
return $result;
|
||||
|
||||
|
||||
} catch (\Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
$line = $e->getLine();
|
||||
$file = $e->getFile();
|
||||
return response()->json(compact('error', 'file', 'line'));
|
||||
}catch (\TokenExpiredException $e) {
|
||||
$error = $e->getMessage();
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -5,6 +5,7 @@ namespace App\Http\Controllers\Api\v1;
|
||||
use App\Http\Requests;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Exception;
|
||||
|
||||
class TestController extends Controller {
|
||||
|
||||
@@ -20,7 +21,7 @@ class TestController extends Controller {
|
||||
$this->server = "http://" . $_SERVER['HTTP_HOST'] . $server['path'] . "/";
|
||||
}
|
||||
|
||||
static function CallGetApi($url) {
|
||||
static function callGetApi($url) {
|
||||
//dd($url);
|
||||
$curl = curl_init($url);
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
|
||||
@@ -37,7 +38,7 @@ class TestController extends Controller {
|
||||
curl_close($curl);
|
||||
}
|
||||
|
||||
static function CallPostApi($url, $data) {
|
||||
static function callPostApi($url, $data) {
|
||||
//dd($url);
|
||||
$curl = curl_init($url);
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
|
||||
@@ -55,15 +56,15 @@ class TestController extends Controller {
|
||||
curl_close($curl);
|
||||
}
|
||||
|
||||
public function TicketReply() {
|
||||
public function ticketReply() {
|
||||
|
||||
//$file = file_get_contents(base_path() . '/../lb-faveo/Img/Ladybird.png');
|
||||
|
||||
$data = [
|
||||
|
||||
'ticket_ID' => '13',
|
||||
'ReplyContent' => 'reply for the ticket id',
|
||||
'api-key' => 'clYbe1g7BYVEJznBdvCEBR0xDCLDqKgg',
|
||||
'ticket_ID' => '1',
|
||||
'reply_content' => 'reply for the ticket id',
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN',
|
||||
// 'attachments' => [
|
||||
// [
|
||||
// 'name' => 'ladybird',
|
||||
@@ -84,11 +85,11 @@ class TestController extends Controller {
|
||||
$url = $this->server . "helpdesk/reply?token=" . \Config::get('app.token');
|
||||
|
||||
$_this = new self();
|
||||
$respose = $_this->CallPostApi($url, $data);
|
||||
$respose = $_this->callPostApi($url, $data);
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function CreateTicket() {
|
||||
public function createTicket() {
|
||||
|
||||
//$file = file_get_contents(base_path() . '/../lb-faveo/Img/Ladybird.png');
|
||||
|
||||
@@ -101,7 +102,7 @@ class TestController extends Controller {
|
||||
'priority' => '1',
|
||||
'headers' => [0 => 'vijaycodename47@gmail.com'],
|
||||
'dept' => '1',
|
||||
'api-key' => 'clYbe1g7BYVEJznBdvCEBR0xDCLDqKgg',
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN',
|
||||
/** if attachment */
|
||||
// 'attachments' => [
|
||||
// [
|
||||
@@ -123,16 +124,16 @@ class TestController extends Controller {
|
||||
$url = $this->server . "helpdesk/create?token=" . \Config::get('app.token');
|
||||
|
||||
$_this = new self();
|
||||
$respose = $_this->CallPostApi($url, $data);
|
||||
$respose = $_this->callPostApi($url, $data);
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function GenerateToken() {
|
||||
public function generateToken() {
|
||||
$data = [
|
||||
//'email'=>'vijaycodename47@gmail.com',
|
||||
'username' => 'vijay',
|
||||
'password' => 'manjapra',
|
||||
'api-key' => 'clYbe1g7BYVEJznBdvCEBR0xDCLDqKgg'
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN'
|
||||
];
|
||||
|
||||
$data = http_build_query($data, '', '&');
|
||||
@@ -140,237 +141,260 @@ class TestController extends Controller {
|
||||
$url = $this->server . "authenticate";
|
||||
//dd($url);
|
||||
$_this = new self();
|
||||
$respose = $_this->CallPostApi($url, $data);
|
||||
$respose = $_this->callPostApi($url, $data);
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function CreateUser() {
|
||||
public function createUser() {
|
||||
$data = [
|
||||
'email' => 'vijaycodename@gmail.com',
|
||||
'password' => 'manjapra',
|
||||
'api-key' => 'clYbe1g7BYVEJznBdvCEBR0xDCLDqKgg'
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN'
|
||||
];
|
||||
|
||||
$data = http_build_query($data, '', '&');
|
||||
$url = $this->server . "register";
|
||||
$_this = new self();
|
||||
$respose = $_this->CallPostApi($url, $data);
|
||||
$respose = $_this->callPostApi($url, $data);
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function GetAuthUser() {
|
||||
public function getAuthUser() {
|
||||
|
||||
$url = $this->server . "authenticate/user?api-key=clYbe1g7BYVEJznBdvCEBR0xDCLDqKgg&token=" . \Config::get('app.token');
|
||||
$url = $this->server . "authenticate/user?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->CallGetApi($url);
|
||||
$respose = $_this->callGetApi($url);
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function EditTicket() {
|
||||
public function editTicket() {
|
||||
$data = [
|
||||
'ticket_id' => '13',
|
||||
'subject' => 'Api editing ticket via faveo api',
|
||||
'sla_plan' => '2',
|
||||
'help_topic' => '2',
|
||||
'ticket_source' => '2',
|
||||
'api-key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN',
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN',
|
||||
'ticket_priority' => '2',
|
||||
];
|
||||
|
||||
$data = http_build_query($data, '', '&');
|
||||
$url = $this->server . "helpdesk/edit?token=" . \Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->CallPostApi($url, $data);
|
||||
$respose = $_this->callPostApi($url, $data);
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function DeleteTicket() {
|
||||
public function deleteTicket() {
|
||||
$data = [
|
||||
'ticket_id' => [11],
|
||||
'api-key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN'
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN'
|
||||
];
|
||||
|
||||
$data = http_build_query($data, '', '&');
|
||||
$url = $this->server . "helpdesk/delete?token=" . \Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->CallPostApi($url, $data);
|
||||
$respose = $_this->callPostApi($url, $data);
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function OpenedTickets() {
|
||||
$url = $this->server . "helpdesk/open?api-key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
public function openedTickets() {
|
||||
$url = $this->server . "helpdesk/open?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->CallGetApi($url);
|
||||
$respose = $_this->callGetApi($url);
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function UnassignedTickets() {
|
||||
$url = $this->server . "helpdesk/unassigned?api-key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
public function unassignedTickets() {
|
||||
//dd('dsdf');
|
||||
$url = $this->server . "helpdesk/unassigned?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->CallGetApi($url);
|
||||
$respose = $_this->callGetApi($url);
|
||||
//dd($respose);
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function CloseTickets() {
|
||||
$url = $this->server . "helpdesk/closed?api-key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
public function closeTickets() {
|
||||
$url = $this->server . "helpdesk/closed?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->CallGetApi($url);
|
||||
$respose = $_this->callGetApi($url);
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function GetAgents() {
|
||||
$url = $this->server . "helpdesk/agents?api-key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
public function getAgents() {
|
||||
$url = $this->server . "helpdesk/agents?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->CallGetApi($url);
|
||||
$respose = $_this->callGetApi($url);
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function GetTeams() {
|
||||
$url = $this->server . "helpdesk/teams?api-key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
public function getTeams() {
|
||||
$url = $this->server . "helpdesk/teams?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->CallGetApi($url);
|
||||
$respose = $_this->callGetApi($url);
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function AssignTicket() {
|
||||
public function assignTicket() {
|
||||
$data = [
|
||||
'ticket_id' => 1,
|
||||
'user' => 'vijay.sebastian@ladybirdweb.com',
|
||||
'api-key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN'
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN'
|
||||
];
|
||||
$data = http_build_query($data, '', '&');
|
||||
$url = $this->server . "helpdesk/assign?token=" . \Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->CallPostApi($url, $data);
|
||||
$respose = $_this->callPostApi($url, $data);
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function GetCustomers() {
|
||||
public function getCustomers() {
|
||||
$search = [
|
||||
'search' => 'vij',
|
||||
'api-key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN'
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN'
|
||||
];
|
||||
$data = http_build_query($search, '', '&');
|
||||
$url = $this->server . "helpdesk/customers?token=" . \Config::get('app.token');
|
||||
$url = $url . '&' . $data;
|
||||
$_this = new self();
|
||||
$respose = $_this->CallGetApi($url);
|
||||
$respose = $_this->callGetApi($url);
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function GetCustomer() {
|
||||
public function getCustomer() {
|
||||
$search = [
|
||||
'user_id' => '1',
|
||||
'api-key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN'
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN'
|
||||
];
|
||||
$data = http_build_query($search, '', '&');
|
||||
$url = $this->server . "helpdesk/customer?token=" . \Config::get('app.token');
|
||||
$url = $url . '&' . $data;
|
||||
$_this = new self();
|
||||
$respose = $_this->CallGetApi($url);
|
||||
$respose = $_this->callGetApi($url);
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function GetSearch() {
|
||||
public function getSearch() {
|
||||
$search = [
|
||||
'search' => 'api',
|
||||
'api-key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN'
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN'
|
||||
];
|
||||
$data = http_build_query($search, '', '&');
|
||||
$url = $this->server . "helpdesk/ticket-search?token=" . \Config::get('app.token');
|
||||
$url = $url . '&' . $data;
|
||||
$_this = new self();
|
||||
$respose = $_this->CallGetApi($url);
|
||||
$respose = $_this->callGetApi($url);
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function TicketThreads() {
|
||||
public function ticketThreads() {
|
||||
$search = [
|
||||
'id' => '1',
|
||||
'api-key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN'
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN'
|
||||
];
|
||||
$data = http_build_query($search, '', '&');
|
||||
$url = $this->server . "helpdesk/ticket-thread?token=" . \Config::get('app.token');
|
||||
$url = $url . '&' . $data;
|
||||
$_this = new self();
|
||||
$respose = $_this->CallGetApi($url);
|
||||
$respose = $_this->callGetApi($url);
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function Url() {
|
||||
public function url() {
|
||||
$search = [
|
||||
'url' => 'http://localhost/Faveo-HelpDesk-My-Branch/public/',
|
||||
'api-key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN'
|
||||
'url' => 'http://localhost/faveo-helpdesk-github/public/',
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN'
|
||||
];
|
||||
$data = http_build_query($search, '', '&');
|
||||
$url = $this->server . "helpdesk/url?token=" . \Config::get('app.token');
|
||||
$url = $url . '&' . $data;
|
||||
$_this = new self();
|
||||
$respose = $_this->CallGetApi($url);
|
||||
$respose = $_this->callGetApi($url);
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function GenerateApiKey() {
|
||||
$url = $this->server . "helpdesk/api-key?api-key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
public function generateApiKey() {
|
||||
$url = $this->server . "helpdesk/api_key?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->CallGetApi($url);
|
||||
$respose = $_this->callGetApi($url);
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function GetHelpTopic() {
|
||||
$url = $this->server . "helpdesk/help-topic?api-key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
public function getHelpTopic() {
|
||||
$url = $this->server . "helpdesk/help-topic?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->CallGetApi($url);
|
||||
$respose = $_this->callGetApi($url);
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function GetSlaPlan() {
|
||||
$url = $this->server . "helpdesk/sla-plan?api-key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
public function getSlaPlan() {
|
||||
$url = $this->server . "helpdesk/sla-plan?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->CallGetApi($url);
|
||||
$respose = $_this->callGetApi($url);
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function GetPriority() {
|
||||
$url = $this->server . "helpdesk/priority?api-key=clYbe1g7BYVEJznBdvCEBR0xDCLDqKgg&token=" . \Config::get('app.token');
|
||||
public function getPriority() {
|
||||
$url = $this->server . "helpdesk/priority?api_key=clYbe1g7BYVEJznBdvCEBR0xDCLDqKgg&token=" . \Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->CallGetApi($url);
|
||||
$respose = $_this->callGetApi($url);
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function GetDepartment() {
|
||||
$url = $this->server . "helpdesk/department?api-key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
public function getDepartment() {
|
||||
$url = $this->server . "helpdesk/department?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->CallGetApi($url);
|
||||
$respose = $_this->callGetApi($url);
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function GetTickets() {
|
||||
$url = $this->server . "helpdesk/tickets?api-key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
public function getTickets() {
|
||||
$url = $this->server . "helpdesk/tickets?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->CallGetApi($url);
|
||||
$respose = $_this->callGetApi($url);
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function Inbox() {
|
||||
$url = $this->server . "helpdesk/inbox?api-key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
public function inbox() {
|
||||
$url = $this->server . "helpdesk/inbox?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->CallGetApi($url);
|
||||
$respose = $_this->callGetApi($url);
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function InternalNote() {
|
||||
public function internalNote() {
|
||||
$data = [
|
||||
'ticketid' => '23',
|
||||
'ticketid' => '1',
|
||||
'userid' => 1,
|
||||
'body' => 'Testing the api internal note',
|
||||
'api-key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN'
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN'
|
||||
];
|
||||
$data = http_build_query($data, '', '&');
|
||||
$url = $this->server . "helpdesk/internal-note?token=" . \Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->CallPostApi($url, $data);
|
||||
$respose = $_this->callPostApi($url, $data);
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function trash() {
|
||||
$url = $this->server . "helpdesk/trash?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->callGetApi($url);
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function myTickets(){
|
||||
try{
|
||||
$url = $this->server . "helpdesk/my-tickets?user_id=1&api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->callGetApi($url);
|
||||
return $respose;
|
||||
} catch (\Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
$line = $e->getLine();
|
||||
$file = $e->getFile();
|
||||
return response()->json(compact('error', 'file', 'line'));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -39,7 +39,8 @@ class TicketController extends Controller {
|
||||
* Create a new controller instance.
|
||||
* @return type response
|
||||
*/
|
||||
public function __construct(PhpMailController $PhpMailController) {
|
||||
public function __construct() {
|
||||
$PhpMailController = new PhpMailController();
|
||||
$this->PhpMailController = $PhpMailController;
|
||||
}
|
||||
|
||||
@@ -53,7 +54,7 @@ class TicketController extends Controller {
|
||||
* @param type $priority
|
||||
* @return type string
|
||||
*/
|
||||
public function create_ticket($user_id, $subject, $body, $helptopic, $sla, $priority, $source, $headers, $dept, $assignto, $form_data, $attach = '') {
|
||||
public function createTicket($user_id, $subject, $body, $helptopic, $sla, $priority, $source, $headers, $dept, $assignto, $form_data, $attach = '') {
|
||||
try {
|
||||
$max_number = Tickets::whereRaw('id = (select max(`id`) from tickets)')->first();
|
||||
//dd($max_number);
|
||||
@@ -65,8 +66,8 @@ class TicketController extends Controller {
|
||||
}
|
||||
}
|
||||
$ticket = new Tickets;
|
||||
$ticket->ticket_number = $this->ticket_number($ticket_number);
|
||||
//dd($this->ticket_number($ticket_number));
|
||||
$ticket->ticket_number = $this->ticketNumber($ticket_number);
|
||||
//dd($this->ticketNumber($ticket_number));
|
||||
$ticket->user_id = $user_id;
|
||||
$ticket->dept_id = $dept;
|
||||
$ticket->help_topic_id = $helptopic;
|
||||
@@ -97,9 +98,9 @@ class TicketController extends Controller {
|
||||
|
||||
|
||||
|
||||
$this->store_collaborators($headers, $id);
|
||||
$this->storeCollaborators($headers, $id);
|
||||
|
||||
$thread = $this->ticket_thread($subject, $body, $id, $user_id);
|
||||
$thread = $this->ticketThread($subject, $body, $id, $user_id);
|
||||
if (!empty($attach)) {
|
||||
$this->attach($thread, $attach);
|
||||
}
|
||||
@@ -115,14 +116,14 @@ class TicketController extends Controller {
|
||||
* @param type $headers
|
||||
* @return type
|
||||
*/
|
||||
public function store_collaborators($headers, $id) {
|
||||
public function storeCollaborators($headers, $id) {
|
||||
try {
|
||||
$company = $this->company();
|
||||
if (isset($headers)) {
|
||||
foreach ($headers as $email => $name) {
|
||||
$name = $name;
|
||||
$email = $email;
|
||||
if ($this->check_email($email) == false) {
|
||||
if ($this->checkEmail($email) == false) {
|
||||
$create_user = new User;
|
||||
$create_user->user_name = $name;
|
||||
$create_user->email = $email;
|
||||
@@ -139,7 +140,7 @@ class TicketController extends Controller {
|
||||
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $name, 'email' => $email], $message = ['subject' => 'password', 'scenario' => 'registration-notification'], $template_variables = ['user' => $name, 'email_address' => $email, 'user_password' => $password]);
|
||||
|
||||
} else {
|
||||
$user = $this->check_email($email);
|
||||
$user = $this->checkEmail($email);
|
||||
$user_id = $user->id;
|
||||
}
|
||||
$collaborator_store = new Ticket_Collaborator;
|
||||
@@ -164,7 +165,7 @@ class TicketController extends Controller {
|
||||
* @param type $user_id
|
||||
* @return type
|
||||
*/
|
||||
public function ticket_thread($subject, $body, $id, $user_id) {
|
||||
public function ticketThread($subject, $body, $id, $user_id) {
|
||||
try {
|
||||
$thread = new Ticket_Thread;
|
||||
$thread->user_id = $user_id;
|
||||
@@ -184,7 +185,7 @@ class TicketController extends Controller {
|
||||
* @param type $ticket_number
|
||||
* @return type integer
|
||||
*/
|
||||
public function ticket_number($ticket_number) {
|
||||
public function ticketNumber($ticket_number) {
|
||||
try {
|
||||
//dd($ticket_number);
|
||||
$number = $ticket_number;
|
||||
@@ -248,12 +249,12 @@ class TicketController extends Controller {
|
||||
$eventuserid = $eventthread->user_id;
|
||||
$emailadd = User::where('id', $eventuserid)->first()->email;
|
||||
$source = $eventthread->source;
|
||||
$form_data = $request->except('ReplyContent', 'ticket_ID', 'attachment');
|
||||
$form_data = $request->except('reply_content', 'ticket_ID', 'attachment');
|
||||
\Event::fire(new \App\Events\ClientTicketFormPost($form_data, $emailadd, $source));
|
||||
$reply_content = $request->input('ReplyContent');
|
||||
$reply_content = $request->input('reply_content');
|
||||
$thread->ticket_id = $request->input('ticket_ID');
|
||||
$thread->poster = 'support';
|
||||
$thread->body = $request->input('ReplyContent');
|
||||
$thread->body = $request->input('reply_content');
|
||||
$thread->user_id = Auth::user()->id;
|
||||
$ticket_id = $request->input('ticket_ID');
|
||||
$tickets = Tickets::where('id', '=', $ticket_id)->first();
|
||||
@@ -377,7 +378,7 @@ try {
|
||||
* @param type Ticket_Thread $thread
|
||||
* @return type bool
|
||||
*/
|
||||
public function ticket_edit_post($ticket_id, $thread, $ticket) {
|
||||
public function ticketEditPost($ticket_id, $thread, $ticket) {
|
||||
try {
|
||||
|
||||
$ticket = $ticket->where('id', '=', $ticket_id)->first();
|
||||
@@ -517,7 +518,7 @@ try {
|
||||
* @param type $email
|
||||
* @return type bool
|
||||
*/
|
||||
public function check_email($email) {
|
||||
public function checkEmail($email) {
|
||||
try {
|
||||
$check = User::where('email', '=', $email)->first();
|
||||
if ($check == true) {
|
||||
|
@@ -116,7 +116,7 @@ class TokenAuthController extends Controller {
|
||||
* verify the url is existing or not
|
||||
* @return type json
|
||||
*/
|
||||
public function CheckUrl() {
|
||||
public function checkUrl() {
|
||||
try {
|
||||
$v = \Validator::make($request->all(), [
|
||||
'url' => 'required|url'
|
||||
|
@@ -188,7 +188,7 @@ class GuestController extends Controller {
|
||||
$thread->ticket_id = $request->input('ticket_ID');
|
||||
$thread->title = $request->input('To');
|
||||
$thread->user_id = Auth::user()->id;
|
||||
$thread->body = $request->input('ReplyContent');
|
||||
$thread->body = $request->input('reply_content');
|
||||
$thread->poster = 'user';
|
||||
$thread->save();
|
||||
$ticket_id = $request->input('ticket_ID');
|
||||
|
Reference in New Issue
Block a user