Applied fixes from StyleCI
This commit is contained in:

committed by
StyleCI Bot

parent
be5df5334f
commit
d637c2b23f
@@ -13,39 +13,43 @@ use App\Model\helpdesk\Agent\Department;
|
||||
use App\Model\helpdesk\Form\Forms;
|
||||
use App\Model\helpdesk\Manage\Help_topic;
|
||||
use App\Model\helpdesk\Manage\Sla_plan;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Priority;
|
||||
use App\Model\helpdesk\Settings\Ticket;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Priority;
|
||||
use App\User;
|
||||
// classes
|
||||
use DB;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* HelptopicController
|
||||
* HelptopicController.
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class HelptopicController extends Controller {
|
||||
|
||||
class HelptopicController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return type vodi
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
$this->middleware('roles');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @param type Help_topic $topic
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function index(Help_topic $topic) {
|
||||
public function index(Help_topic $topic)
|
||||
{
|
||||
try {
|
||||
$topics = $topic->get();
|
||||
|
||||
return view('themes.default1.admin.helpdesk.manage.helptopic.index', compact('topics'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
@@ -54,12 +58,14 @@ class HelptopicController extends Controller {
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
* @param type Priority $priority
|
||||
*
|
||||
* @param type Priority $priority
|
||||
* @param type Department $department
|
||||
* @param type Help_topic $topic
|
||||
* @param type Form_name $form
|
||||
* @param type Agents $agent
|
||||
* @param type Sla_plan $sla
|
||||
* @param type Form_name $form
|
||||
* @param type Agents $agent
|
||||
* @param type Sla_plan $sla
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
/*
|
||||
@@ -72,7 +78,8 @@ class HelptopicController extends Controller {
|
||||
| 5.Forms Model
|
||||
================================================
|
||||
*/
|
||||
public function create(Ticket_Priority $priority, Department $department, Help_topic $topic, Forms $form, User $agent, Sla_plan $sla) {
|
||||
public function create(Ticket_Priority $priority, Department $department, Help_topic $topic, Forms $form, User $agent, Sla_plan $sla)
|
||||
{
|
||||
try {
|
||||
$departments = $department->get();
|
||||
$topics = $topic->get();
|
||||
@@ -80,6 +87,7 @@ class HelptopicController extends Controller {
|
||||
$agents = $agent->where('role', '=', 'agent')->get();
|
||||
$slas = $sla->get();
|
||||
$priority = $priority->get();
|
||||
|
||||
return view('themes.default1.admin.helpdesk.manage.helptopic.create', compact('priority', 'departments', 'topics', 'forms', 'agents', 'slas'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
@@ -88,11 +96,14 @@ class HelptopicController extends Controller {
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
* @param type Help_topic $topic
|
||||
*
|
||||
* @param type Help_topic $topic
|
||||
* @param type HelptopicRequest $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function store(Help_topic $topic, HelptopicRequest $request) {
|
||||
public function store(Help_topic $topic, HelptopicRequest $request)
|
||||
{
|
||||
try {
|
||||
if ($request->custom_form) {
|
||||
$custom_form = $request->custom_form;
|
||||
@@ -111,22 +122,25 @@ class HelptopicController extends Controller {
|
||||
return redirect('helptopic')->with('success', 'Helptopic Created Successfully');
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('helptopic')->with('fails', 'Helptopic can not Create' . '<li>' . $e->errorInfo[2] . '</li>');
|
||||
return redirect('helptopic')->with('fails', 'Helptopic can not Create'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
* @param type $id
|
||||
* @param type Priority $priority
|
||||
*
|
||||
* @param type $id
|
||||
* @param type Priority $priority
|
||||
* @param type Department $department
|
||||
* @param type Help_topic $topic
|
||||
* @param type Form_name $form
|
||||
* @param type Agents $agent
|
||||
* @param type Sla_plan $sla
|
||||
* @param type Form_name $form
|
||||
* @param type Agents $agent
|
||||
* @param type Sla_plan $sla
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function edit($id, Ticket_Priority $priority, Department $department, Help_topic $topic, Forms $form, Sla_plan $sla) {
|
||||
public function edit($id, Ticket_Priority $priority, Department $department, Help_topic $topic, Forms $form, Sla_plan $sla)
|
||||
{
|
||||
try {
|
||||
$agents = User::where('role', '=', 'agent')->get();
|
||||
$departments = $department->get();
|
||||
@@ -134,20 +148,24 @@ class HelptopicController extends Controller {
|
||||
$forms = $form->get();
|
||||
$slas = $sla->get();
|
||||
$priority = $priority->get();
|
||||
|
||||
return view('themes.default1.admin.helpdesk.manage.helptopic.edit', compact('priority', 'departments', 'topics', 'forms', 'agents', 'slas'));
|
||||
} catch (Exception $e) {
|
||||
return redirect('helptopic')->with('fails', '<li>' . $e->errorInfo[2] . '</li>');
|
||||
return redirect('helptopic')->with('fails', '<li>'.$e->errorInfo[2].'</li>');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
* @param type $id
|
||||
* @param type Help_topic $topic
|
||||
*
|
||||
* @param type $id
|
||||
* @param type Help_topic $topic
|
||||
* @param type HelptopicUpdate $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function update($id, Help_topic $topic, HelptopicUpdate $request) {
|
||||
public function update($id, Help_topic $topic, HelptopicUpdate $request)
|
||||
{
|
||||
// dd($request);
|
||||
try {
|
||||
$topics = $topic->whereId($id)->first();
|
||||
@@ -170,61 +188,62 @@ class HelptopicController extends Controller {
|
||||
return redirect('helptopic')->with('success', 'Helptopic Updated Successfully');
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('helptopic')->with('fails', 'Helptopic can not Update' . '<li>' . $e->errorInfo[2] . '</li>');
|
||||
return redirect('helptopic')->with('fails', 'Helptopic can not Update'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
* @param type int $id
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type Help_topic $topic
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function destroy($id, Help_topic $topic, Ticket $ticket_setting) {
|
||||
public function destroy($id, Help_topic $topic, Ticket $ticket_setting)
|
||||
{
|
||||
$ticket_settings = $ticket_setting->where('id', '=', '1')->first();
|
||||
if ($ticket_settings->help_topic == $id) {
|
||||
return redirect('departments')->with('fails', 'You cannot delete default department');
|
||||
} else {
|
||||
|
||||
$tickets = DB::table('tickets')->where('help_topic_id', '=', $id)->update(['help_topic_id' => $ticket_settings->help_topic]);
|
||||
|
||||
if ($tickets > 0) {
|
||||
if ($tickets > 1) {
|
||||
$text_tickets = "Tickets";
|
||||
$text_tickets = 'Tickets';
|
||||
} else {
|
||||
$text_tickets = "Ticket";
|
||||
$text_tickets = 'Ticket';
|
||||
}
|
||||
$ticket = '<li>' . $tickets . ' ' . $text_tickets . ' have been moved to default Help Topic</li>';
|
||||
$ticket = '<li>'.$tickets.' '.$text_tickets.' have been moved to default Help Topic</li>';
|
||||
} else {
|
||||
$ticket = "";
|
||||
$ticket = '';
|
||||
}
|
||||
|
||||
$emails = DB::table('emails')->where('help_topic', '=', $id)->update(['help_topic' => $ticket_settings->help_topic]);
|
||||
|
||||
if ($emails > 0) {
|
||||
if ($emails > 1) {
|
||||
$text_emails = "Emails";
|
||||
$text_emails = 'Emails';
|
||||
} else {
|
||||
$text_emails = "Email";
|
||||
$text_emails = 'Email';
|
||||
}
|
||||
$email = '<li>' . $emails . ' System ' . $text_emails . ' have been moved to default Help Topic</li>';
|
||||
$email = '<li>'.$emails.' System '.$text_emails.' have been moved to default Help Topic</li>';
|
||||
} else {
|
||||
$email = "";
|
||||
$email = '';
|
||||
}
|
||||
|
||||
$message = $ticket . $email;
|
||||
$message = $ticket.$email;
|
||||
|
||||
$topics = $topic->whereId($id)->first();
|
||||
/* Check whether function success or not */
|
||||
try {
|
||||
$topics->delete();
|
||||
/* redirect to Index page with Success Message */
|
||||
return redirect('helptopic')->with('success', 'Helptopic Deleted Successfully' . $message);
|
||||
return redirect('helptopic')->with('success', 'Helptopic Deleted Successfully'.$message);
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('helptopic')->with('fails', 'Helptopic can not Delete' . '<li>' . $e->errorInfo[2] . '</li>');
|
||||
return redirect('helptopic')->with('fails', 'Helptopic can not Delete'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user