';
+ } else {
+ $helptopic = "";
+ }
+ $message = $ticket . $user . $email . $helptopic;
+ /* Becouse of foreign key we delete group_assign_department first */
+ $group_assign_department = $group_assign_department->where('department_id', $id);
+ $group_assign_department->delete();
+ $departments = $department->whereId($id)->first();
+ /* Check the function is Success or Fail */
+ if ($departments->delete() == true) {
+ return redirect('departments')->with('success', 'Department Deleted sucessfully' . $message);
+ } else {
+ return redirect('departments')->with('fails', 'Department can not Delete');
+ }
+ }
+ }
}
diff --git a/app/Http/Controllers/Admin/helpdesk/EmailsController.php b/app/Http/Controllers/Admin/helpdesk/EmailsController.php
index 1b6ff2035..c8259403c 100644
--- a/app/Http/Controllers/Admin/helpdesk/EmailsController.php
+++ b/app/Http/Controllers/Admin/helpdesk/EmailsController.php
@@ -1,4 +1,7 @@
-middleware('auth');
- $this->middleware('roles');
- }
+ /**
+ * Create a new controller instance.
+ * @return type
+ */
+ public function __construct() {
+ $this->middleware('auth');
+ $this->middleware('roles');
+ }
- /**
- * Display a listing of the resource.
- * @param type Emails $emails
- * @return type Response
- */
- public function index(Emails $emails) {
- try {
- $emails = $emails->get();
- return view('themes.default1.admin.helpdesk.emails.emails.index', compact('emails'));
- } catch (Exception $e) {
- return view('404');
- }
- }
+ /**
+ * Display a listing of the resource.
+ * @param type Emails $emails
+ * @return type Response
+ */
+ public function index(Emails $emails) {
+ try {
+ $emails = $emails->get();
+ return view('themes.default1.admin.helpdesk.emails.emails.index', compact('emails'));
+ } catch (Exception $e) {
+ return view('404');
+ }
+ }
- /**
- * Show the form for creating a new resource.
- * @param type Department $department
- * @param type Help_topic $help
- * @param type Priority $priority
- * @param type MailboxProtocol $mailbox_protocol
- * @return type Response
- */
- public function create(Department $department, Help_topic $help, Ticket_Priority $priority, MailboxProtocol $mailbox_protocol) {
- try {
- $departments = $department->get();
- $helps = $help->get();
- $priority = $priority->get();
- $mailbox_protocols = $mailbox_protocol->get();
- return view('themes.default1.admin.helpdesk.emails.emails.create', compact('mailbox_protocols', 'priority', 'departments', 'helps'));
- } catch (Exception $e) {
- return view('404');
- }
- }
+ /**
+ * Show the form for creating a new resource.
+ * @param type Department $department
+ * @param type Help_topic $help
+ * @param type Priority $priority
+ * @param type MailboxProtocol $mailbox_protocol
+ * @return type Response
+ */
+ public function create(Department $department, Help_topic $help, Ticket_Priority $priority, MailboxProtocol $mailbox_protocol) {
+ try {
+ $departments = $department->get();
+ $helps = $help->get();
+ $priority = $priority->get();
+ $mailbox_protocols = $mailbox_protocol->get();
+ return view('themes.default1.admin.helpdesk.emails.emails.create', compact('mailbox_protocols', 'priority', 'departments', 'helps'));
+ } catch (Exception $e) {
+ return view('404');
+ }
+ }
- /**
- * Store a newly created resource in storage.
- * @param type Emails $email
- * @param type EmailsRequest $request
- * @return type Response
- */
- public function store(Emails $email, EmailsRequest $request) {
- try {
- $password = $request->input('password');
- $encrypted = Crypt::encrypt($password);
- $email->password = $encrypted;
- if ($email->fill($request->except('password'))->save() == true) {
- return redirect('emails')->with('success', 'Email Created sucessfully');
- } else {
- return redirect('emails')->with('fails', 'Email can not Create');
- }
- } catch (Exception $e) {
- return redirect('emails')->with('fails', 'Email can not Create');
- }
- }
+ /**
+ * Store a newly created resource in storage.
+ * @param type Emails $email
+ * @param type EmailsRequest $request
+ * @return type Response
+ */
+ public function store(Emails $email, EmailsRequest $request) {
+ try {
+ $password = $request->input('password');
+ $encrypted = Crypt::encrypt($password);
+ $department = $request->input('department');
+ $priority = $request->input('priority');
+ $help_topic = $request->input('help_topic');
- /**
- * Display the specified resource.
- *
- * @param int $id
- * @return Response
- */
- public function show($id) {
- //
- }
+ if ($email->fill($request->except('password', 'department', 'priority', 'help_topic'))->save() == true) {
+ if ($request->input('department')) {
+ $email->department = $request->input('department');
+ } else {
+ $email->department = null;
+ }
+ if ($request->input('priority')) {
+ $email->priority = $request->input('priority');
+ } else {
+ $email->priority = null;
+ }
+ if ($request->input('help_topic')) {
+ $email->help_topic = $request->input('help_topic');
+ } else {
+ $email->help_topic = null;
+ }
+ $email->password = $encrypted;
+ $email->save();
- /**
- * Show the form for editing the specified resource.
- * @param type int $id
- * @param type Department $department
- * @param type Help_topic $help
- * @param type Emails $email
- * @param type Priority $priority
- * @param type MailboxProtocol $mailbox_protocol
- * @return type Response
- */
- public function edit($id, Department $department, Help_topic $help, Emails $email, Ticket_Priority $priority, MailboxProtocol $mailbox_protocol) {
- try {
- $emails = $email->whereId($id)->first();
- $departments = $department->get();
- $helps = $help->get();
- $priority = $priority->get();
- $mailbox_protocols = $mailbox_protocol->get();
- return view('themes.default1.admin.helpdesk.emails.emails.edit', compact('mailbox_protocols', 'priority', 'departments', 'helps', 'emails'));
- } catch (Exception $e) {
- return view('404');
- }
- }
+ return redirect('emails')->with('success', 'Email Created sucessfully');
+ } else {
+ return redirect('emails')->with('fails', 'Email can not Create');
+ }
+ } catch (Exception $e) {
+ return redirect('emails')->with('fails', 'Email can not Create');
+ }
+ }
- /**
- * Update the specified resource in storage.
- * @param type $id
- * @param type Emails $email
- * @param type EmailsEditRequest $request
- * @return type Response
- */
- public function update($id, Emails $email, EmailsEditRequest $request) {
- $password = $request->input('password');
- $encrypted = Crypt::encrypt($password);
- //echo $encrypted;
- //$value = Crypt::decrypt($encrypted);
- //echo $value;
- try {
- $emails = $email->whereId($id)->first();
- $emails->password = $encrypted;
- $emails->fill($request->except('password'))->save();
- return redirect('emails')->with('success', 'Email Updated sucessfully');
- } catch (Exception $e) {
- return redirect('emails')->with('fails', 'Email not updated');
- }
- }
+ /**
+ * Display the specified resource.
+ *
+ * @param int $id
+ * @return Response
+ */
+ public function show($id) {
+ //
+ }
- /**
- * Remove the specified resource from storage.
- * @param type int $id
- * @param type Emails $email
- * @return type Response
- */
- public function destroy($id, Emails $email) {
- try {
- $emails = $email->whereId($id)->first();
- if ($emails->delete() == true) {
- return redirect('emails')->with('success', 'Email Deleted sucessfully');
- } else {
- return redirect('emails')->with('fails', 'Email can not Delete ');
- }
- } catch (Exception $e) {
- return redirect('emails')->with('fails', 'Email can not Delete ');
- }
- }
+ /**
+ * Show the form for editing the specified resource.
+ * @param type int $id
+ * @param type Department $department
+ * @param type Help_topic $help
+ * @param type Emails $email
+ * @param type Priority $priority
+ * @param type MailboxProtocol $mailbox_protocol
+ * @return type Response
+ */
+ public function edit($id, Department $department, Help_topic $help, Emails $email, Ticket_Priority $priority, MailboxProtocol $mailbox_protocol) {
+ try {
+ $emails = $email->whereId($id)->first();
+ $departments = $department->get();
+ $helps = $help->get();
+ $priority = $priority->get();
+ $mailbox_protocols = $mailbox_protocol->get();
+ return view('themes.default1.admin.helpdesk.emails.emails.edit', compact('mailbox_protocols', 'priority', 'departments', 'helps', 'emails'));
+ } catch (Exception $e) {
+ return view('404');
+ }
+ }
+
+ /**
+ * Update the specified resource in storage.
+ * @param type $id
+ * @param type Emails $email
+ * @param type EmailsEditRequest $request
+ * @return type Response
+ */
+ public function update($id, Emails $email, EmailsEditRequest $request) {
+ $password = $request->input('password');
+ $encrypted = Crypt::encrypt($password);
+ //echo $encrypted;
+ //$value = Crypt::decrypt($encrypted);
+ //echo $value;
+ try {
+ $emails = $email->whereId($id)->first();
+ // $emails->password = $encrypted;
+ $emails->fill($request->except('password', 'department', 'priority', 'help_topic'))->save();
+ if ($request->input('department')) {
+ $emails->department = $request->input('department');
+ } else {
+ $emails->department = null;
+ }
+ if ($request->input('priority')) {
+ $emails->priority = $request->input('priority');
+ } else {
+ $emails->priority = null;
+ }
+ if ($request->input('help_topic')) {
+ $emails->help_topic = $request->input('help_topic');
+ } else {
+ $emails->help_topic = null;
+ }
+ $emails->password = $encrypted;
+ $emails->save();
+ return redirect('emails')->with('success', 'Email Updated sucessfully');
+ } catch (Exception $e) {
+ return redirect('emails')->with('fails', 'Email not updated');
+ }
+ }
+
+ /**
+ * Remove the specified resource from storage.
+ * @param type int $id
+ * @param type Emails $email
+ * @return type Response
+ */
+ public function destroy($id, Emails $email) {
+ $default_system_email = Email::where('id', '=', '1')->first();
+ if ($default_system_email->id) {
+ if ($id == $default_system_email->id) {
+ return redirect('emails')->with('fails', 'You cannot delete system default Email');
+ }
+ }
+ try {
+ $emails = $email->whereId($id)->first();
+ if ($emails->delete() == true) {
+ return redirect('emails')->with('success', 'Email Deleted sucessfully');
+ } else {
+ return redirect('emails')->with('fails', 'Email can not Delete ');
+ }
+ } catch (Exception $e) {
+ return redirect('emails')->with('fails', 'Email can not Delete ');
+ }
+ }
}
diff --git a/app/Http/Controllers/Admin/helpdesk/FormController.php b/app/Http/Controllers/Admin/helpdesk/FormController.php
index 5f8640ed3..4aa013c55 100644
--- a/app/Http/Controllers/Admin/helpdesk/FormController.php
+++ b/app/Http/Controllers/Admin/helpdesk/FormController.php
@@ -1,16 +1,15 @@
-
*/
class FormController extends Controller {
- private $fields;
+
+ private $fields;
private $forms;
-
- public function __construct(Fields $fields,Forms $forms) {
+ public function __construct(Fields $fields, Forms $forms) {
$this->fields = $fields;
$this->forms = $forms;
- // $this->middleware('auth');
+ // $this->middleware('auth');
}
/**
* home
* @return type
*/
- public function home() {
+ public function home() {
return view('forms.home');
}
@@ -49,7 +48,7 @@ class FormController extends Controller {
* @return Response
*/
public function index(Forms $forms) {
- return view('themes.default1.admin.helpdesk.manage.form.index',compact('forms'));
+ return view('themes.default1.admin.helpdesk.manage.form.index', compact('forms'));
}
/**
@@ -61,70 +60,64 @@ class FormController extends Controller {
}
/**
- * Display the specified resource.
- * @param int $id
- * @return Response
- */
+ * Display the specified resource.
+ * @param int $id
+ * @return Response
+ */
public function show($id) {
- return view('themes.default1.admin.helpdesk.manage.form.preview',compact('id'));
+ return view('themes.default1.admin.helpdesk.manage.form.preview', compact('id'));
}
-
+
/**
* Store a newly created resource in storage.
*
* @return Response
*/
- public function store(Forms $forms) {
- if(!Input::get('formname')) {
- return Redirect::back()->with('fails','Please fill Form name');
+ public function store(Forms $forms) {
+ if (!Input::get('formname')) {
+ return Redirect::back()->with('fails', 'Please fill Form name');
+ }
+ $required = Input::get('required');
+ $count = count($required);
+ $require = array();
+ for ($i = 2; $i < $count + 2; $i++) {
+ for ($j = 0; $j < 1; $j++) {
+ array_push($require, $required[$i][$j]);
+ }
}
- $required = Input::get('required');
- $count = count($required);
- $require = array();
- for($i=2;$i<$count+2;$i++) {
- for($j=0;$j<1;$j++) {
- array_push($require,$required[$i][$j]);
- }
- }
$forms->formname = Input::get('formname');
$forms->save();
- $count = count(Input::get('name'));
+ $count = count(Input::get('name'));
$fields = array();
- for($i=0; $i<=$count; $i++) {
- if(!empty(Input::get('name')[$i])) {
- array_push($fields, array(
- 'forms_id' => $forms->id,
- 'label' => Input::get('label')[$i],
- 'name' => Input::get('name')[$i],
- 'type' => Input::get('type')[$i],
- 'value' => Input::get('value')[$i],
- 'required'=>$require[$i],
- ));
- }
- }
+ for ($i = 0; $i <= $count; $i++) {
+ if (!empty(Input::get('name')[$i])) {
+ array_push($fields, array(
+ 'forms_id' => $forms->id,
+ 'label' => Input::get('label')[$i],
+ 'name' => Input::get('name')[$i],
+ 'type' => Input::get('type')[$i],
+ 'value' => Input::get('value')[$i],
+ 'required' => $require[$i],
+ ));
+ }
+ }
Fields::insert($fields);
- return Redirect::back()->with('success','Successfully created Form');
+ return Redirect::back()->with('success', 'Successfully created Form');
}
-
-
- public function delete($id,Forms $forms, Fields $field, Help_topic $help_topic) {
- $fields = $field->where('forms_id',$id)->get();
- $help_topics = $help_topic->where('custom_form','=',$id)->get();
- foreach($help_topics as $help_topic) {
+ public function delete($id, Forms $forms, Fields $field, Help_topic $help_topic) {
+ $fields = $field->where('forms_id', $id)->get();
+ $help_topics = $help_topic->where('custom_form', '=', $id)->get();
+ foreach ($help_topics as $help_topic) {
$help_topic->custom_form = null;
$help_topic->save();
}
- foreach($fields as $field) {
+ foreach ($fields as $field) {
$field->delete();
}
- $forms = $forms->where('id',$id)->first();
+ $forms = $forms->where('id', $id)->first();
$forms->delete();
return redirect()->back()->with('success', 'Deleted Successfully');
- }
+ }
-
}
-
-
-
diff --git a/app/Http/Controllers/Admin/helpdesk/GroupController.php b/app/Http/Controllers/Admin/helpdesk/GroupController.php
index cec707098..139b55b54 100644
--- a/app/Http/Controllers/Admin/helpdesk/GroupController.php
+++ b/app/Http/Controllers/Admin/helpdesk/GroupController.php
@@ -1,4 +1,7 @@
-middleware('auth');
- $this->middleware('roles');
- }
+ /**
+ * Create a new controller instance.
+ * @return type void
+ */
+ public function __construct() {
+ $this->middleware('auth');
+ $this->middleware('roles');
+ }
- /**
- * Display a listing of the resource.
- * @param type Groups $group
- * @param type Department $department
- * @param type Group_assign_department $group_assign_department
- * @return type Response
- */
- public function index(Groups $group, Department $department, Group_assign_department $group_assign_department) {
- try {
- $groups = $group->get();
- $departments = $department->lists('id');
- return view('themes.default1.admin.helpdesk.agent.groups.index', compact('departments', 'group_assign_department', 'groups'));
- } catch (Exception $e) {
- return view('404');
- }
- }
+ /**
+ * Display a listing of the resource.
+ * @param type Groups $group
+ * @param type Department $department
+ * @param type Group_assign_department $group_assign_department
+ * @return type Response
+ */
+ public function index(Groups $group, Department $department, Group_assign_department $group_assign_department) {
+ try {
+ $groups = $group->get();
+ $departments = $department->lists('id');
+ return view('themes.default1.admin.helpdesk.agent.groups.index', compact('departments', 'group_assign_department', 'groups'));
+ } catch (Exception $e) {
+ return view('404');
+ }
+ }
- /**
- * Show the form for creating a new resource.
- * @return type Response
- */
- public function create() {
- try {
- return view('themes.default1.admin.helpdesk.agent.groups.create');
- } catch (Exception $e) {
- return view('404');
- }
- }
+ /**
+ * Show the form for creating a new resource.
+ * @return type Response
+ */
+ public function create() {
+ try {
+ return view('themes.default1.admin.helpdesk.agent.groups.create');
+ } catch (Exception $e) {
+ return view('404');
+ }
+ }
- /**
- * Store a newly created resource in storage.
- * @param type Groups $group
- * @param type GroupRequest $request
- * @return type Response
- */
- public function store(Groups $group, GroupRequest $request) {
- try {
- /* Check Whether function success or not */
- $group->fill($request->input())->save();
- return redirect('groups')->with('success', 'Group Created Successfully');
- } catch (Exception $e) {
- /* redirect to Index page with Fails Message */
- return redirect('groups')->with('fails', 'Groups can not Create'.'
'.$e->errorInfo[2].'
');
- }
- }
+ /**
+ * Store a newly created resource in storage.
+ * @param type Groups $group
+ * @param type GroupRequest $request
+ * @return type Response
+ */
+ public function store(Groups $group, GroupRequest $request) {
+ try {
+ /* Check Whether function success or not */
+ $group->fill($request->input())->save();
+ return redirect('groups')->with('success', 'Group Created Successfully');
+ } catch (Exception $e) {
+ /* redirect to Index page with Fails Message */
+ return redirect('groups')->with('fails', 'Groups can not Create' . '
' . $e->errorInfo[2] . '
');
+ }
+ }
- /**
- * Show the form for editing the specified resource.
- * @param type int $id
- * @param type Groups $group
- * @return type Response
- */
- public function edit($id, Groups $group) {
- try {
- $groups = $group->whereId($id)->first();
- return view('themes.default1.admin.helpdesk.agent.groups.edit', compact('groups'));
- } catch (Exception $e) {
- return redirect('groups')->with('fails', 'Groups can not Create'.'
'.$e->errorInfo[2].'
');
- }
- }
+ /**
+ * Show the form for editing the specified resource.
+ * @param type int $id
+ * @param type Groups $group
+ * @return type Response
+ */
+ public function edit($id, Groups $group) {
+ try {
+ $groups = $group->whereId($id)->first();
+ return view('themes.default1.admin.helpdesk.agent.groups.edit', compact('groups'));
+ } catch (Exception $e) {
+ return redirect('groups')->with('fails', 'Groups can not Create' . '
' . $e->errorInfo[2] . '
');
+ }
+ }
- /**
- * Update the specified resource in storage.
- * @param type int $id
- * @param type Groups $group
- * @param type Request $request
- * @return type Response
- */
- public function update($id, Groups $group, Request $request) {
- $var = $group->whereId($id)->first();
- //Updating Status
- $status = $request->Input('group_status');
- $var->group_status = $status;
- //Updating can_create_ticket field
- $createTicket = $request->Input('can_create_ticket');
- $var->can_create_ticket = $createTicket;
- //Updating can_edit_ticket field
- $editTicket = $request->Input('can_edit_ticket');
- $var->can_edit_ticket = $editTicket;
- //Updating can_post_ticket field
- $postTicket = $request->Input('can_post_ticket');
- $var->can_post_ticket = $postTicket;
- //Updating can_close_ticket field
- $closeTicket = $request->Input('can_close_ticket');
- $var->can_close_ticket = $closeTicket;
- //Updating can_assign_ticket field
- $assignTicket = $request->Input('can_assign_ticket');
- $var->can_assign_ticket = $assignTicket;
- //Updating can_trasfer_ticket field
- $trasferTicket = $request->Input('can_trasfer_ticket');
- $var->can_trasfer_ticket = $trasferTicket;
- //Updating can_delete_ticket field
- $deleteTicket = $request->Input('can_delete_ticket');
- $var->can_delete_ticket = $deleteTicket;
- //Updating can_ban_email field
- $banEmail = $request->Input('can_ban_email');
- $var->can_ban_email = $banEmail;
- //Updating can_manage_canned field
- $manageCanned = $request->Input('can_manage_canned');
- $var->can_manage_canned = $manageCanned;
- //Updating can_manage_faq field
- $manageFaq = $request->Input('can_manage_faq');
- $var->can_manage_faq = $manageFaq;
- //Updating can_view_agent_stats field
- $viewAgentStats = $request->Input('can_view_agent_stats');
- $var->can_view_agent_stats = $viewAgentStats;
- //Updating department_access field
- $departmentAccess = $request->Input('department_access');
- $var->department_access = $departmentAccess;
- //Updating admin_notes field
- $adminNotes = $request->Input('admin_notes');
- $var->admin_notes = $adminNotes;
- /* Check whether function success or not */
- try {
- $var->save();
- /* redirect to Index page with Success Message */
- return redirect('groups')->with('success', 'Group Updated Successfully');
- } catch (Exception $e) {
- /* redirect to Index page with Fails Message */
- return redirect('groups')->with('fails', 'Groups can not Create'.'
'.$e->errorInfo[2].'
');
- }
- }
+ /**
+ * Update the specified resource in storage.
+ * @param type int $id
+ * @param type Groups $group
+ * @param type Request $request
+ * @return type Response
+ */
+ public function update($id, Groups $group, Request $request) {
+ $var = $group->whereId($id)->first();
+ //Updating Status
+ $status = $request->Input('group_status');
+ $var->group_status = $status;
+ //Updating can_create_ticket field
+ $createTicket = $request->Input('can_create_ticket');
+ $var->can_create_ticket = $createTicket;
+ //Updating can_edit_ticket field
+ $editTicket = $request->Input('can_edit_ticket');
+ $var->can_edit_ticket = $editTicket;
+ //Updating can_post_ticket field
+ $postTicket = $request->Input('can_post_ticket');
+ $var->can_post_ticket = $postTicket;
+ //Updating can_close_ticket field
+ $closeTicket = $request->Input('can_close_ticket');
+ $var->can_close_ticket = $closeTicket;
+ //Updating can_assign_ticket field
+ $assignTicket = $request->Input('can_assign_ticket');
+ $var->can_assign_ticket = $assignTicket;
+ //Updating can_trasfer_ticket field
+ $trasferTicket = $request->Input('can_trasfer_ticket');
+ $var->can_trasfer_ticket = $trasferTicket;
+ //Updating can_delete_ticket field
+ $deleteTicket = $request->Input('can_delete_ticket');
+ $var->can_delete_ticket = $deleteTicket;
+ //Updating can_ban_email field
+ $banEmail = $request->Input('can_ban_email');
+ $var->can_ban_email = $banEmail;
+ //Updating can_manage_canned field
+ $manageCanned = $request->Input('can_manage_canned');
+ $var->can_manage_canned = $manageCanned;
+ //Updating can_manage_faq field
+ $manageFaq = $request->Input('can_manage_faq');
+ $var->can_manage_faq = $manageFaq;
+ //Updating can_view_agent_stats field
+ $viewAgentStats = $request->Input('can_view_agent_stats');
+ $var->can_view_agent_stats = $viewAgentStats;
+ //Updating department_access field
+ $departmentAccess = $request->Input('department_access');
+ $var->department_access = $departmentAccess;
+ //Updating admin_notes field
+ $adminNotes = $request->Input('admin_notes');
+ $var->admin_notes = $adminNotes;
+ /* Check whether function success or not */
+ try {
+ $var->save();
+ /* redirect to Index page with Success Message */
+ return redirect('groups')->with('success', 'Group Updated Successfully');
+ } catch (Exception $e) {
+ /* redirect to Index page with Fails Message */
+ return redirect('groups')->with('fails', 'Groups can not Create' . '
' . $e->errorInfo[2] . '
');
+ }
+ }
+
+ /**
+ * Remove the specified resource from storage.
+ * @param type int $id
+ * @param type Groups $group
+ * @param type Group_assign_department $group_assign_department
+ * @return type Response
+ */
+ public function destroy($id, Groups $group, Group_assign_department $group_assign_department) {
+ $users = User::where('assign_group', '=', $id)->first();
+ if ($users) {
+ $user = '
There are agents assigned to this group. Please unassign them from this group to delete
';
+ return redirect('groups')->with('fails', 'Group cannot Delete ' . $user);
+ }
+ $group_assign_department->where('group_id', $id)->delete();
+ $groups = $group->whereId($id)->first();
+ /* Check whether function success or not */
+ try {
+ $groups->delete();
+ /* redirect to Index page with Success Message */
+ return redirect('groups')->with('success', 'Group Deleted Successfully');
+ } catch (Exception $e) {
+ /* redirect to Index page with Fails Message */
+ return redirect('groups')->with('fails', 'Groups cannot Create' . '
' . $e->errorInfo[2] . '
');
+ }
+ }
- /**
- * Remove the specified resource from storage.
- * @param type int $id
- * @param type Groups $group
- * @param type Group_assign_department $group_assign_department
- * @return type Response
- */
- public function destroy($id, Groups $group, Group_assign_department $group_assign_department) {
- $users = User::where('assign_group', '=', $id)->first();
- if($users){
- $user = '
There are agents assigned to this group. Please unassign them from this group to delete
';
- return redirect('groups')->with('fails', 'Group cannot Delete ' . $user);
- }
- $group_assign_department->where('group_id', $id)->delete();
- $groups = $group->whereId($id)->first();
- /* Check whether function success or not */
- try {
- $groups->delete();
- /* redirect to Index page with Success Message */
- return redirect('groups')->with('success', 'Group Deleted Successfully');
- } catch (Exception $e) {
- /* redirect to Index page with Fails Message */
- return redirect('groups')->with('fails', 'Groups cannot Create'.'
'.$e->errorInfo[2].'
');
- }
- }
}
diff --git a/app/Http/Controllers/Admin/helpdesk/HelptopicController.php b/app/Http/Controllers/Admin/helpdesk/HelptopicController.php
index e79e011a8..c223b8965 100644
--- a/app/Http/Controllers/Admin/helpdesk/HelptopicController.php
+++ b/app/Http/Controllers/Admin/helpdesk/HelptopicController.php
@@ -1,4 +1,7 @@
-middleware('auth');
- $this->middleware('roles');
- }
+ /**
+ * Create a new controller instance.
+ * @return type vodi
+ */
+ 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) {
- try {
- $topics = $topic->get();
- return view('themes.default1.admin.helpdesk.manage.helptopic.index', compact('topics'));
- } catch (Exception $e) {
- return view('404');
- }
- }
+ /**
+ * Display a listing of the resource.
+ * @param type Help_topic $topic
+ * @return type Response
+ */
+ 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');
+ }
+ }
- /**
- * Show the form for creating a new resource.
- * @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
- * @return type Response
- */
- /*
- ================================================
- | Route to Create view file passing Model Values
- | 1.Department Model
- | 2.Help_topic Model
- | 3.Agents Model
- | 4.Sla_plan Model
- | 5.Forms Model
- ================================================
- */
- 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();
- $forms = $form->get();
- $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');
- }
- }
+ /**
+ * Show the form for creating a new resource.
+ * @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
+ * @return type Response
+ */
+ /*
+ ================================================
+ | Route to Create view file passing Model Values
+ | 1.Department Model
+ | 2.Help_topic Model
+ | 3.Agents Model
+ | 4.Sla_plan Model
+ | 5.Forms Model
+ ================================================
+ */
+ 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();
+ $forms = $form->get();
+ $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');
+ }
+ }
- /**
- * Store a newly created resource in storage.
- * @param type Help_topic $topic
- * @param type HelptopicRequest $request
- * @return type Response
- */
- public function store(Help_topic $topic, HelptopicRequest $request) {
- try {
- if($request->custom_form){
- $custom_form = $request->custom_form;
- } else {
- $custom_form = null;
- }
- if($request->auto_assign){
- $auto_assign = $request->auto_assign;
- } else {
- $auto_assign = null;
- }
- /* Check whether function success or not */
- $topic->fill($request->except('custom_form','auto_assign'))->save();
- // $topics->fill($request->except('custom_form','auto_assign'))->save();
- /* redirect to Index page with Success Message */
- 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'.'
'.$e->errorInfo[2].'
');
- }
- }
+ /**
+ * Store a newly created resource in storage.
+ * @param type Help_topic $topic
+ * @param type HelptopicRequest $request
+ * @return type Response
+ */
+ public function store(Help_topic $topic, HelptopicRequest $request) {
+ try {
+ if ($request->custom_form) {
+ $custom_form = $request->custom_form;
+ } else {
+ $custom_form = null;
+ }
+ if ($request->auto_assign) {
+ $auto_assign = $request->auto_assign;
+ } else {
+ $auto_assign = null;
+ }
+ /* Check whether function success or not */
+ $topic->fill($request->except('custom_form', 'auto_assign'))->save();
+ // $topics->fill($request->except('custom_form','auto_assign'))->save();
+ /* redirect to Index page with Success Message */
+ 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' . '
' . $e->errorInfo[2] . '
');
+ }
+ }
- /**
- * Show the form for editing the specified resource.
- * @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
- * @return type Response
- */
- 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();
- $topics = $topic->whereId($id)->first();
- $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', '
'.$e->errorInfo[2].'
');
- }
- }
+ /**
+ * Show the form for editing the specified resource.
+ * @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
+ * @return type Response
+ */
+ 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();
+ $topics = $topic->whereId($id)->first();
+ $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', '
' . $e->errorInfo[2] . '
');
+ }
+ }
- /**
- * Update the specified resource in storage.
- * @param type $id
- * @param type Help_topic $topic
- * @param type HelptopicUpdate $request
- * @return type Response
- */
- public function update($id, Help_topic $topic, HelptopicUpdate $request) {
- // dd($request);
- try {
- $topics = $topic->whereId($id)->first();
- if($request->custom_form){
- $custom_form = $request->custom_form;
- } else {
- $custom_form = null;
- }
- if($request->auto_assign){
- $auto_assign = $request->auto_assign;
- } else {
- $auto_assign = null;
- }
- /* Check whether function success or not */
- $topics->fill($request->except('custom_form','auto_assign'))->save();
- $topics->custom_form = $custom_form;
- $topics->auto_assign = $auto_assign;
- $topics->save();
- /* redirect to Index page with Success Message */
- 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'.'
'.$e->errorInfo[2].'
');
- }
- }
+ /**
+ * Update the specified resource in storage.
+ * @param type $id
+ * @param type Help_topic $topic
+ * @param type HelptopicUpdate $request
+ * @return type Response
+ */
+ public function update($id, Help_topic $topic, HelptopicUpdate $request) {
+ // dd($request);
+ try {
+ $topics = $topic->whereId($id)->first();
+ if ($request->custom_form) {
+ $custom_form = $request->custom_form;
+ } else {
+ $custom_form = null;
+ }
+ if ($request->auto_assign) {
+ $auto_assign = $request->auto_assign;
+ } else {
+ $auto_assign = null;
+ }
+ /* Check whether function success or not */
+ $topics->fill($request->except('custom_form', 'auto_assign'))->save();
+ $topics->custom_form = $custom_form;
+ $topics->auto_assign = $auto_assign;
+ $topics->save();
+ /* redirect to Index page with Success Message */
+ 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' . '
' . $e->errorInfo[2] . '
');
+ }
+ }
- /**
- * Remove the specified resource from storage.
- * @param type int $id
- * @param type Help_topic $topic
- * @return type Response
- */
- 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 {
+ /**
+ * Remove the specified resource from storage.
+ * @param type int $id
+ * @param type Help_topic $topic
+ * @return type Response
+ */
+ 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]);
+ $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";
- } else {
- $text_tickets = "Ticket";
- }
- $ticket = '
'.$tickets.' '.$text_tickets.' have been moved to default Help Topic
' . $emails . ' System ' . $text_emails . ' have been moved to default Help Topic
';
+ } else {
+ $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);
+ } catch (Exception $e) {
+ /* redirect to Index page with Fails Message */
+ return redirect('helptopic')->with('fails', 'Helptopic can not Delete' . '
' . $e->errorInfo[2] . '
');
+ }
+ }
+ }
- $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);
- } catch (Exception $e) {
- /* redirect to Index page with Fails Message */
- return redirect('helptopic')->with('fails', 'Helptopic can not Delete'.'
'.$e->errorInfo[2].'
');
- }
- }
- }
}
diff --git a/app/Http/Controllers/Admin/helpdesk/HomeController.php b/app/Http/Controllers/Admin/helpdesk/HomeController.php
index b28af7b62..7a2744c8d 100644
--- a/app/Http/Controllers/Admin/helpdesk/HomeController.php
+++ b/app/Http/Controllers/Admin/helpdesk/HomeController.php
@@ -1,4 +1,6 @@
-middleware('auth');
- }
+ /**
+ * Create a new controller instance.
+ * @return void
+ */
+ public function __construct() {
+ $this->middleware('auth');
+ }
- /**
- * Show the application dashboard to the user.
- *
- * @return Response
- */
- public function index() {
- return view('themes/default1/admin/dashboard');
- }
+ /**
+ * Show the application dashboard to the user.
+ *
+ * @return Response
+ */
+ public function index() {
+ return view('themes/default1/admin/dashboard');
+ }
}
diff --git a/app/Http/Controllers/Admin/helpdesk/LanguageController.php b/app/Http/Controllers/Admin/helpdesk/LanguageController.php
index 520d754f5..c7a178bdd 100644
--- a/app/Http/Controllers/Admin/helpdesk/LanguageController.php
+++ b/app/Http/Controllers/Admin/helpdesk/LanguageController.php
@@ -1,4 +1,7 @@
-setLocale($lang);
+ //if(Cache::has('language'))
+ //{
+ // return Cache::get('language');
+ //} else return 'false';
+ // Cache::put('language',$)
+ $path = '../resources/lang'; // Path to check available language packages
+ if (array_key_exists($lang, Config::get('languages')) && in_array($lang, scandir($path))) {
+ // dd(array_key_exists($lang, Config::get('languages')));
+ // app()->setLocale($lang);
- Cache::forever('language', $lang);
- // dd(Cache::get('language'));
- // dd()
- } else {
- return Redirect::back()->with('fails', Lang::get("lang.language-error"));
- }
- return Redirect::back();
+ Cache::forever('language', $lang);
+ // dd(Cache::get('language'));
+ // dd()
+ } else {
+ return Redirect::back()->with('fails', Lang::get("lang.language-error"));
}
-
-
+ return Redirect::back();
+ }
/**
- *Shows language page
- *@return type response
+ * Shows language page
+ * @return type response
*/
- public function index(){
+ public function index() {
return view('themes.default1.admin.helpdesk.language.index');
}
-
/**
- *Shows Language upload form
- *@return type response
+ * Shows Language upload form
+ * @return type response
*/
- public function getForm(){
+ public function getForm() {
return view('themes.default1.admin.helpdesk.language.create');
}
-
/**
- *Provide language datatable to language page
- *@return type
+ * Provide language datatable to language page
+ * @return type
*/
- public function getLanguages()
- {
+ public function getLanguages() {
$path = '../resources/lang';
$values = scandir($path); //Extracts names of directories present in lang directory
$values = array_slice($values, 2); // skips array element $value[0] = '.' & $value[1] = '..'
return \Datatable::collection(new Collection($values))
-
- ->addColumn('language', function($model){
- return Config::get('languages.'.$model);
- })
-
- ->addColumn('id', function($model){
- return $model;
- })
-
- ->addColumn('status',function($model){
- if(Lang::getLocale()===$model){return "".Lang::trans("lang.active").""; } else return "".Lang::trans("lang.inactive")."";
- })
-
- ->addColumn('Action', function($model){
- if(Lang::getLocale()===$model){
- return "
- ". Lang::trans("lang.delete")."";
- } else {
- return "
- ". Lang::trans("lang.delete")."";
- }
- })
- ->searchColumns('language','id')
-
- ->make();
+ ->addColumn('language', function($model) {
+ return Config::get('languages.' . $model);
+ })
+ ->addColumn('id', function($model) {
+ return $model;
+ })
+ ->addColumn('status', function($model) {
+ if (Lang::getLocale() === $model) {
+ return "" . Lang::trans("lang.active") . "";
+ } else
+ return "" . Lang::trans("lang.inactive") . "";
+ })
+ ->addColumn('Action', function($model) {
+ if (Lang::getLocale() === $model) {
+ return "
+ " . Lang::trans("lang.delete") . "";
+ } else {
+ return "
+ " . Lang::trans("lang.delete") . "";
+ }
+ })
+ ->searchColumns('language', 'id')
+ ->make();
}
-
/**
- *handle language file uploading
- *@return response
+ * handle language file uploading
+ * @return response
*/
public function postForm() {
// getting all of the post data
$file = array(
- 'File' => Input::file('File'),
- 'language-name' => Input::input('language-name'),
- 'iso-code' => Input::input('iso-code')
- );
-
+ 'File' => Input::file('File'),
+ 'language-name' => Input::input('language-name'),
+ 'iso-code' => Input::input('iso-code')
+ );
+
// setting up rules
- $rules = array(
- 'File' => 'required|mimes:zip|max:30000',
- 'language-name' => 'required',
- 'iso-code' => 'required|max:2'
- ); // and for max size
-
+ $rules = array(
+ 'File' => 'required|mimes:zip|max:30000',
+ 'language-name' => 'required',
+ 'iso-code' => 'required|max:2'
+ ); // and for max size
// doing the validation, passing post data, rules and the messages
$validator = Validator::make($file, $rules);
if ($validator->fails()) {
-
+
// send back to the page with the input data and errors
return Redirect::back()->withInput()->withErrors($validator);
-
} else {
-
-
+
+
//Checking if package already exists or not in lang folder
$path = '../resources/lang';
if (in_array(strtolower(Input::get('iso-code')), scandir($path))) {
-
+
//sending back with error message
Session::flash('fails', Lang::get('lang.package_exist'));
- Session::flash('link',"change-language/".strtolower(Input::get('iso-code')));
+ Session::flash('link', "change-language/" . strtolower(Input::get('iso-code')));
return Redirect::back()->withInput();
-
- } elseif (!array_key_exists(strtolower(Input::get('iso-code')), Config::get('languages'))){//Checking Valid ISO code form Languages.php
-
+ } elseif (!array_key_exists(strtolower(Input::get('iso-code')), Config::get('languages'))) {//Checking Valid ISO code form Languages.php
//sending back with error message
Session::flash('fails', Lang::get('lang.iso-code-error'));
return Redirect::back()->withInput();
-
} else {
-
+
// checking file is valid.
if (Input::file('File')->isValid()) {
$name = Input::file('File')->getClientOriginalName(); //uploaded file's original name
$destinationPath = '../public/uploads/'; // defining uploading path
- $extractpath = '../resources/lang/'.strtolower(Input::get('iso-code'));//defining extracting path
+ $extractpath = '../resources/lang/' . strtolower(Input::get('iso-code')); //defining extracting path
mkdir($extractpath); //creating directroy for extracting uploadd file
//mkdir($destinationPath);
Input::file('File')->move($destinationPath, $name); // uploading file to given path
- \Zipper::make($destinationPath.'/'.$name)->extractTo($extractpath);//extracting file to give path
-
+ \Zipper::make($destinationPath . '/' . $name)->extractTo($extractpath); //extracting file to give path
//check if Zip extract foldercontains any subfolder
$directories = File::directories($extractpath);
//$directories = glob($extractpath. '/*' , GLOB_ONLYDIR);
- if(!empty($directories)){ //if extract folder contains subfolder
+ if (!empty($directories)) { //if extract folder contains subfolder
$success = File::deleteDirectory($extractpath); //remove extracted folder and it's subfolder from lang
//$success2 = File::delete($destinationPath.'/'.$name);
- if($success){
+ if ($success) {
//sending back with error message
Session::flash('fails', Lang::get('lang.zipp-error'));
- Session::flash('link2',"http://www.ladybirdweb.com/support/show/how-to-translate-faveo-into-multiple-languages");
- return Redirect::back()->withInput();
- }
+ Session::flash('link2', "http://www.ladybirdweb.com/support/show/how-to-translate-faveo-into-multiple-languages");
+ return Redirect::back()->withInput();
+ }
} else {
- // sending back with success message
- Session::flash('success', Lang::get("lang.upload-success"));
- Session::flash('link',"change-language/".strtolower(Input::get('iso-code')));
- return Redirect::route('LanguageController');
+ // sending back with success message
+ Session::flash('success', Lang::get("lang.upload-success"));
+ Session::flash('link', "change-language/" . strtolower(Input::get('iso-code')));
+ return Redirect::route('LanguageController');
}
} else {
// sending back with error message.
@@ -204,8 +193,8 @@ class LanguageController extends Controller {
}
/**
- *allow user to download language template file
- *@return type
+ * allow user to download language template file
+ * @return type
*/
Public function download() {
return response()->download('../public/downloads/en.zip');
@@ -216,23 +205,24 @@ class LanguageController extends Controller {
* @param type $lang
* @return type response
*/
- public function deleteLanguage($lang){
- if($lang !== App::getLocale()){
- $deletePath = '../resources/lang/'.$lang; //define file path to delete
+ public function deleteLanguage($lang) {
+ if ($lang !== App::getLocale()) {
+ $deletePath = '../resources/lang/' . $lang; //define file path to delete
$success = File::deleteDirectory($deletePath); //remove extracted folder and it's subfolder from lang
- if($success) {
+ if ($success) {
//sending back with success message
Session::flash('success', Lang::get('lang.delete-success'));
- return Redirect::back();
+ return Redirect::back();
} else {
//sending back with error message
Session::flash('fails', Lang::get('lang.lang-doesnot-exist'));
- return Redirect::back();
+ return Redirect::back();
}
} else {
//sending back with error message
Session::flash('fails', Lang::get('lang.active-lang-error'));
- return redirect('languages');
+ return redirect('languages');
}
}
+
}
diff --git a/app/Http/Controllers/Admin/helpdesk/ProfileController.php b/app/Http/Controllers/Admin/helpdesk/ProfileController.php
index 157d97209..cb34fb0eb 100644
--- a/app/Http/Controllers/Admin/helpdesk/ProfileController.php
+++ b/app/Http/Controllers/Admin/helpdesk/ProfileController.php
@@ -1,4 +1,7 @@
-middleware('auth');
- $this->middleware('roles');
- }
+ /**
+ * Create a new controller instance.
+ * @return type void
+ */
+ public function __construct() {
+ $this->middleware('auth');
+ $this->middleware('roles');
+ }
- /**
- * Get profile page
- * @return type Response
- */
- public function getProfile() {
- try {
- $user = Auth::user();
- if ($user) {
- return view('themes.default1.agent.helpdesk.user.profile', compact('user'));
- } else {
- return redirect('404');
- }
- } catch (Exception $e) {
- return redirect('404');
- }
- }
+ /**
+ * Get profile page
+ * @return type Response
+ */
+ public function getProfile() {
+ try {
+ $user = Auth::user();
+ if ($user) {
+ return view('themes.default1.agent.helpdesk.user.profile', compact('user'));
+ } else {
+ return redirect('404');
+ }
+ } catch (Exception $e) {
+ return redirect('404');
+ }
+ }
- /**
- * Get profile Edit page
- * @return type Response
- */
- public function getProfileedit() {
- try {
- $user = Auth::user();
- if ($user) {
- return view('themes.default1.agent.helpdesk.user.profile-edit', compact('user'));
- } else {
- return redirect('404');
- }
- } catch (Exception $e) {
- return redirect('404');
- }
- }
+ /**
+ * Get profile Edit page
+ * @return type Response
+ */
+ public function getProfileedit() {
+ try {
+ $user = Auth::user();
+ if ($user) {
+ return view('themes.default1.agent.helpdesk.user.profile-edit', compact('user'));
+ } else {
+ return redirect('404');
+ }
+ } catch (Exception $e) {
+ return redirect('404');
+ }
+ }
- /**
- * Post profile page
- * @param type int $id
- * @param type ProfileRequest $request
- * @return type Response
- */
- public function postProfile($id, ProfileRequest $request) {
- $user = Auth::user();
- $user->gender = $request->input('gender');
- $user->save();
- if ($user->profile_pic == 'avatar5.png' || $user->profile_pic == 'avatar2.png') {
- if ($request->input('gender') == 1) {
- $name = 'avatar5.png';
- $destinationPath = 'lb-faveo/profilepic';
- $user->profile_pic = $name;
- } elseif ($request->input('gender') == 0) {
- $name = 'avatar2.png';
- $destinationPath = 'lb-faveo/profilepic';
- $user->profile_pic = $name;
- }
- }
- if (Input::file('profile_pic')) {
- //$extension = Input::file('profile_pic')->getClientOriginalExtension();
- $name = Input::file('profile_pic')->getClientOriginalName();
- $destinationPath = 'lb-faveo/profilepic';
- $fileName = rand(0000, 9999) . '.' . $name;
- //echo $fileName;
- Input::file('profile_pic')->move($destinationPath, $fileName);
- $user->profile_pic = $fileName;
- } else {
- $user->fill($request->except('profile_pic', 'gender'))->save();
- return redirect('guest')->with('success', 'Profile Updated sucessfully');
- }
- if ($user->fill($request->except('profile_pic'))->save()) {
- return redirect('guest')->with('success', 'Profile Updated sucessfully');
- }
- }
+ /**
+ * Post profile page
+ * @param type int $id
+ * @param type ProfileRequest $request
+ * @return type Response
+ */
+ public function postProfile($id, ProfileRequest $request) {
+ $user = Auth::user();
+ $user->gender = $request->input('gender');
+ $user->save();
+ if ($user->profile_pic == 'avatar5.png' || $user->profile_pic == 'avatar2.png') {
+ if ($request->input('gender') == 1) {
+ $name = 'avatar5.png';
+ $destinationPath = 'lb-faveo/profilepic';
+ $user->profile_pic = $name;
+ } elseif ($request->input('gender') == 0) {
+ $name = 'avatar2.png';
+ $destinationPath = 'lb-faveo/profilepic';
+ $user->profile_pic = $name;
+ }
+ }
+ if (Input::file('profile_pic')) {
+ //$extension = Input::file('profile_pic')->getClientOriginalExtension();
+ $name = Input::file('profile_pic')->getClientOriginalName();
+ $destinationPath = 'lb-faveo/profilepic';
+ $fileName = rand(0000, 9999) . '.' . $name;
+ //echo $fileName;
+ Input::file('profile_pic')->move($destinationPath, $fileName);
+ $user->profile_pic = $fileName;
+ } else {
+ $user->fill($request->except('profile_pic', 'gender'))->save();
+ return redirect('guest')->with('success', 'Profile Updated sucessfully');
+ }
+ if ($user->fill($request->except('profile_pic'))->save()) {
+ return redirect('guest')->with('success', 'Profile Updated sucessfully');
+ }
+ }
+
+ /**
+ * Post Profile password page
+ * @param type int $id
+ * @param type User $user
+ * @param type ProfilePassword $request
+ * @return type Response
+ */
+ public function postProfilePassword($id, User $user, ProfilePassword $request) {
+ $user = Auth::user();
+ //echo $user->password;
+ if (Hash::check($request->input('old_password'), $user->getAuthPassword())) {
+ $user->password = Hash::make($request->input('new_password'));
+ $user->save();
+ return redirect('guest')->with('success', 'Password Updated sucessfully');
+ } else {
+ return redirect('guest')->with('fails', 'Password was not Updated');
+ }
+ }
- /**
- * Post Profile password page
- * @param type int $id
- * @param type User $user
- * @param type ProfilePassword $request
- * @return type Response
- */
- public function postProfilePassword($id, User $user, ProfilePassword $request) {
- $user = Auth::user();
- //echo $user->password;
- if (Hash::check($request->input('old_password'), $user->getAuthPassword())) {
- $user->password = Hash::make($request->input('new_password'));
- $user->save();
- return redirect('guest')->with('success', 'Password Updated sucessfully');
- } else {
- return redirect('guest')->with('fails', 'Password was not Updated');
- }
- }
}
diff --git a/app/Http/Controllers/Admin/helpdesk/SettingsController.php b/app/Http/Controllers/Admin/helpdesk/SettingsController.php
index 4b3e18aea..1c9b1c49f 100644
--- a/app/Http/Controllers/Admin/helpdesk/SettingsController.php
+++ b/app/Http/Controllers/Admin/helpdesk/SettingsController.php
@@ -1,4 +1,7 @@
-smtp();
- $this->middleware('auth');
- $this->middleware('roles');
- }
+ /**
+ * Create a new controller instance.
+ * @return void
+ */
+ public function __construct() {
+ // $this->smtp();
+ $this->middleware('auth');
+ $this->middleware('roles');
+ }
- /**
- * Main Settings Page
- * @return type view
- */
+ /**
+ * Main Settings Page
+ * @return type view
+ */
public function settings() {
- return view('themes.default1.admin.helpdesk.setting');
- }
-public function RatingSettings() {
- $ratings = DB::table('settings_ratings')->get();
-
- return view('themes.default1.admin.helpdesk.settings.ratings',compact('ratings'));
- }
- public function PostRatingSettings($slug) {
- $name = Input::get('rating_name');
- $publish = Input::get('publish');
- $modify = Input::get('modify');
-
- DB::table('settings_ratings')->whereSlug($slug)->update(array('rating_name' => $name,'publish' => $publish, 'modify' => $modify));
-
- return redirect()->back()->with('success', 'Successfully updated');
- }
- public function RatingDelete($slug) {
- DB::table('settings_ratings')->whereSlug($slug)->delete();
-
- return redirect()->back()->with('success', 'Successfully Deleted');
- }
- /**
- * @param int $id
- * @return Response
- * @param $compant instance of company table
- *
- * get the form for company setting page
- */
- public function getcompany(Company $company) {
- try {
- /* fetch the values of company from company table */
- $companys = $company->whereId('1')->first();
- /* Direct to Company Settings Page */
- return view('themes.default1.admin.helpdesk.settings.company', compact('companys'));
- } catch (Exception $e) {
- return redirect()->back()->with('fails',$e->errorInfo[2]);
- }
- }
+ return view('themes.default1.admin.helpdesk.setting');
+ }
- /**
- * Update the specified resource in storage.
- * @param type int $id
- * @param type Company $company
- * @param type CompanyRequest $request
- * @return Response
- */
- public function postcompany($id, Company $company, CompanyRequest $request) {
- /* fetch the values of company request */
- $companys = $company->whereId('1')->first();
- if (Input::file('logo')) {
- $name = Input::file('logo')->getClientOriginalName();
- $destinationPath = 'lb-faveo/media/company/';
- $fileName = rand(0000, 9999) . '.' . $name;
- Input::file('logo')->move($destinationPath, $fileName);
- $companys->logo = $fileName;
- }
- if($request->input('use_logo')==null) {
- $companys->use_logo = '0';
- }
- /* Check whether function success or not */
- try {
- $companys->fill($request->except('logo'))->save();
- /* redirect to Index page with Success Message */
- return redirect('getcompany')->with('success', 'Company Updated Successfully');
- } catch (Exception $e) {
- /* redirect to Index page with Fails Message */
- return redirect('getcompany')->with('fails', 'Company can not Updated'.'
'.$e->errorInfo[2].'
');
- }
- }
+ /**
+ * @param int $id
+ * @return Response
+ * @param $compant instance of company table
+ *
+ * get the form for company setting page
+ */
+ public function getcompany(Company $company) {
+ try {
+ /* fetch the values of company from company table */
+ $companys = $company->whereId('1')->first();
+ /* Direct to Company Settings Page */
+ return view('themes.default1.admin.helpdesk.settings.company', compact('companys'));
+ } catch (Exception $e) {
+ return redirect()->back()->with('fails', $e->errorInfo[2]);
+ }
+ }
- /**
- * get the form for System setting page
- * @param type System $system
- * @param type Department $department
- * @param type Timezones $timezone
- * @param type Date_format $date
- * @param type Date_time_format $date_time
- * @param type Time_format $time
- * @return type Response
- */
- public function getsystem(System $system, Department $department, Timezones $timezone, Date_format $date, Date_time_format $date_time, Time_format $time) {
- try {
- /* fetch the values of system from system table */
- $systems = $system->whereId('1')->first();
- /* Fetch the values from Department table */
- $departments = $department->get();
- /* Fetch the values from Timezones table */
- $timezones = $timezone->get();
- /* Direct to System Settings Page */
- return view('themes.default1.admin.helpdesk.settings.system', compact('systems', 'departments', 'timezones', 'time', 'date', 'date_time'));
- } catch (Exception $e) {
- return redirect()->back()->with('fails',$e->errorInfo[2]);
- }
- }
+ /**
+ * Update the specified resource in storage.
+ * @param type int $id
+ * @param type Company $company
+ * @param type CompanyRequest $request
+ * @return Response
+ */
+ public function postcompany($id, Company $company, CompanyRequest $request) {
+ /* fetch the values of company request */
+ $companys = $company->whereId('1')->first();
+ if (Input::file('logo')) {
+ $name = Input::file('logo')->getClientOriginalName();
+ $destinationPath = 'lb-faveo/media/company/';
+ $fileName = rand(0000, 9999) . '.' . $name;
+ Input::file('logo')->move($destinationPath, $fileName);
+ $companys->logo = $fileName;
+ }
+ if ($request->input('use_logo') == null) {
+ $companys->use_logo = '0';
+ }
+ /* Check whether function success or not */
+ try {
+ $companys->fill($request->except('logo'))->save();
+ /* redirect to Index page with Success Message */
+ return redirect('getcompany')->with('success', 'Company Updated Successfully');
+ } catch (Exception $e) {
+ /* redirect to Index page with Fails Message */
+ return redirect('getcompany')->with('fails', 'Company can not Updated' . '
' . $e->errorInfo[2] . '
');
+ }
+ }
- /**
- * Update the specified resource in storage.
- * @param type int $id
- * @param type System $system
- * @param type SystemRequest $request
- * @return type Response
- */
- public function postsystem($id, System $system, SystemRequest $request) {
- try {
- // dd($request);
- /* fetch the values of system request */
- $systems = $system->whereId('1')->first();
- /* fill the values to coompany table */
- /* Check whether function success or not */
- $systems->fill($request->input())->save();
- /* redirect to Index page with Success Message */
- return redirect('getsystem')->with('success', 'System Updated Successfully');
- } catch (Exception $e) {
- /* redirect to Index page with Fails Message */
- return redirect('getsystem')->with('fails', 'System can not Updated'.'
'.$e->errorInfo[2].'
');
- }
- }
+ /**
+ * get the form for System setting page
+ * @param type System $system
+ * @param type Department $department
+ * @param type Timezones $timezone
+ * @param type Date_format $date
+ * @param type Date_time_format $date_time
+ * @param type Time_format $time
+ * @return type Response
+ */
+ public function getsystem(System $system, Department $department, Timezones $timezone, Date_format $date, Date_time_format $date_time, Time_format $time) {
+ try {
+ /* fetch the values of system from system table */
+ $systems = $system->whereId('1')->first();
+ /* Fetch the values from Department table */
+ $departments = $department->get();
+ /* Fetch the values from Timezones table */
+ $timezones = $timezone->get();
+ /* Direct to System Settings Page */
+ return view('themes.default1.admin.helpdesk.settings.system', compact('systems', 'departments', 'timezones', 'time', 'date', 'date_time'));
+ } catch (Exception $e) {
+ return redirect()->back()->with('fails', $e->errorInfo[2]);
+ }
+ }
- /**
- * get the form for Ticket setting page
- * @param type Ticket $ticket
- * @param type Sla_plan $sla
- * @param type Help_topic $topic
- * @param type Priority $priority
- * @return type Response
- */
- public function getticket(Ticket $ticket, Sla_plan $sla, Help_topic $topic, Ticket_Priority $priority) {
- try {
- /* fetch the values of ticket from ticket table */
- $tickets = $ticket->whereId('1')->first();
- /* Fetch the values from SLA Plan table */
- $slas = $sla->get();
- /* Fetch the values from Help_topic table */
- $topics = $topic->get();
- /* Direct to Ticket Settings Page */
- return view('themes.default1.admin.helpdesk.settings.ticket', compact('tickets', 'slas', 'topics', 'priority'));
- } catch (Exception $e) {
- return redirect()->back()->with('fails',$e->errorInfo[2]);
- }
- }
+ /**
+ * Update the specified resource in storage.
+ * @param type int $id
+ * @param type System $system
+ * @param type SystemRequest $request
+ * @return type Response
+ */
+ public function postsystem($id, System $system, SystemRequest $request) {
+ try {
+ // dd($request);
+ /* fetch the values of system request */
+ $systems = $system->whereId('1')->first();
+ /* fill the values to coompany table */
+ /* Check whether function success or not */
+ $systems->fill($request->input())->save();
+ /* redirect to Index page with Success Message */
+ return redirect('getsystem')->with('success', 'System Updated Successfully');
+ } catch (Exception $e) {
+ /* redirect to Index page with Fails Message */
+ return redirect('getsystem')->with('fails', 'System can not Updated' . '
' . $e->errorInfo[2] . '
');
+ }
+ }
- /**
- * Update the specified resource in storage.
- * @param type int $id
- * @param type Ticket $ticket
- * @param type Request $request
- * @return type Response
- */
- public function postticket($id, Ticket $ticket, Request $request) {
- try {
- /* fetch the values of ticket request */
- $tickets = $ticket->whereId('1')->first();
- /* fill the values to coompany table */
- $tickets->fill($request->except('captcha', 'claim_response', 'assigned_ticket', 'answered_ticket', 'agent_mask', 'html', 'client_update'))->save();
- /* insert checkbox to Database */
- $tickets->captcha = $request->input('captcha');
- $tickets->claim_response = $request->input('claim_response');
- $tickets->assigned_ticket = $request->input('assigned_ticket');
- $tickets->answered_ticket = $request->input('answered_ticket');
- $tickets->agent_mask = $request->input('agent_mask');
- $tickets->html = $request->input('html');
- $tickets->client_update = $request->input('client_update');
- /* Check whether function success or not */
- $tickets->save();
- /* redirect to Index page with Success Message */
- return redirect('getticket')->with('success', 'Ticket Updated Successfully');
- } catch (Exception $e) {
- /* redirect to Index page with Fails Message */
- return redirect('getticket')->with('fails', 'Ticket can not Updated'.'
'.$e->errorInfo[2].'
');
- }
- }
+ /**
+ * get the form for Ticket setting page
+ * @param type Ticket $ticket
+ * @param type Sla_plan $sla
+ * @param type Help_topic $topic
+ * @param type Priority $priority
+ * @return type Response
+ */
+ public function getticket(Ticket $ticket, Sla_plan $sla, Help_topic $topic, Ticket_Priority $priority) {
+ try {
+ /* fetch the values of ticket from ticket table */
+ $tickets = $ticket->whereId('1')->first();
+ /* Fetch the values from SLA Plan table */
+ $slas = $sla->get();
+ /* Fetch the values from Help_topic table */
+ $topics = $topic->get();
+ /* Direct to Ticket Settings Page */
+ return view('themes.default1.admin.helpdesk.settings.ticket', compact('tickets', 'slas', 'topics', 'priority'));
+ } catch (Exception $e) {
+ return redirect()->back()->with('fails', $e->errorInfo[2]);
+ }
+ }
- /**
- * get the form for Email setting page
- * @param type Email $email
- * @param type Template $template
- * @param type Emails $email1
- * @return type Response
- */
- public function getemail(Email $email, Template $template, Emails $email1) {
- try {
- /* fetch the values of email from Email table */
- $emails = $email->whereId('1')->first();
- /* Fetch the values from Template table */
- $templates = $template->get();
- /* Fetch the values from Emails table */
- $emails1 = $email1->get();
- /* Direct to Email Settings Page */
- return view('themes.default1.admin.helpdesk.settings.email', compact('emails', 'templates', 'emails1'));
- } catch (Exception $e) {
- return redirect()->back()->with('fails',$e->errorInfo[2]);
- }
- }
+ /**
+ * Update the specified resource in storage.
+ * @param type int $id
+ * @param type Ticket $ticket
+ * @param type Request $request
+ * @return type Response
+ */
+ public function postticket($id, Ticket $ticket, Request $request) {
+ try {
+ /* fetch the values of ticket request */
+ $tickets = $ticket->whereId('1')->first();
+ /* fill the values to coompany table */
+ $tickets->fill($request->except('captcha', 'claim_response', 'assigned_ticket', 'answered_ticket', 'agent_mask', 'html', 'client_update'))->save();
+ /* insert checkbox to Database */
+ $tickets->captcha = $request->input('captcha');
+ $tickets->claim_response = $request->input('claim_response');
+ $tickets->assigned_ticket = $request->input('assigned_ticket');
+ $tickets->answered_ticket = $request->input('answered_ticket');
+ $tickets->agent_mask = $request->input('agent_mask');
+ $tickets->html = $request->input('html');
+ $tickets->client_update = $request->input('client_update');
+ $tickets->collision_avoid = $request->input('collision_avoid');
+ /* Check whether function success or not */
+ $tickets->save();
+ /* redirect to Index page with Success Message */
+ return redirect('getticket')->with('success', 'Ticket Updated Successfully');
+ } catch (Exception $e) {
+ /* redirect to Index page with Fails Message */
+ return redirect('getticket')->with('fails', 'Ticket can not Updated' . '
' . $e->errorInfo[2] . '
');
+ }
+ }
- /**
- * Update the specified resource in storage.
- * @param type int $id
- * @param type Email $email
- * @param type EmailRequest $request
- * @return type Response
- */
- public function postemail($id, Email $email, EmailRequest $request) {
- try {
- /* fetch the values of email request */
- $emails = $email->whereId('1')->first();
- /* fill the values to email table */
- $emails->fill($request->except('email_fetching', 'all_emails', 'email_collaborator', 'strip', 'attachment'))->save();
- /* insert checkboxes to database */
- $emails->email_fetching = $request->input('email_fetching');
- $emails->notification_cron = $request->input('notification_cron');
- $emails->all_emails = $request->input('all_emails');
- $emails->email_collaborator = $request->input('email_collaborator');
- $emails->strip = $request->input('strip');
- $emails->attachment = $request->input('attachment');
- /* Check whether function success or not */
- $emails->save();
- /* redirect to Index page with Success Message */
- return redirect('getemail')->with('success', 'Email Updated Successfully');
- } catch (Exception $e) {
- /* redirect to Index page with Fails Message */
- return redirect('getemail')->with('fails', 'Email can not Updated'.'
'.$e->errorInfo[2].'
');
- }
- }
+ /**
+ * get the form for Email setting page
+ * @param type Email $email
+ * @param type Template $template
+ * @param type Emails $email1
+ * @return type Response
+ */
+ public function getemail(Email $email, Template $template, Emails $email1) {
+ try {
+ /* fetch the values of email from Email table */
+ $emails = $email->whereId('1')->first();
+ /* Fetch the values from Template table */
+ $templates = $template->get();
+ /* Fetch the values from Emails table */
+ $emails1 = $email1->get();
+ /* Direct to Email Settings Page */
+ return view('themes.default1.admin.helpdesk.settings.email', compact('emails', 'templates', 'emails1'));
+ } catch (Exception $e) {
+ return redirect()->back()->with('fails', $e->errorInfo[2]);
+ }
+ }
- /**
- * get the form for Access setting page
- * @param type Access $access
- * @return type Response
- */
- // public function getaccess(Access $access) {
- // try {
- // /* fetch the values of access from access table */
- // $accesses = $access->whereId('1')->first();
+ /**
+ * Update the specified resource in storage.
+ * @param type int $id
+ * @param type Email $email
+ * @param type EmailRequest $request
+ * @return type Response
+ */
+ public function postemail($id, Email $email, EmailRequest $request) {
+ try {
+ /* fetch the values of email request */
+ $emails = $email->whereId('1')->first();
+ /* fill the values to email table */
+ $emails->fill($request->except('email_fetching', 'all_emails', 'email_collaborator', 'strip', 'attachment'))->save();
+ /* insert checkboxes to database */
+ $emails->email_fetching = $request->input('email_fetching');
+ $emails->notification_cron = $request->input('notification_cron');
+ $emails->all_emails = $request->input('all_emails');
+ $emails->email_collaborator = $request->input('email_collaborator');
+ $emails->strip = $request->input('strip');
+ $emails->attachment = $request->input('attachment');
+ /* Check whether function success or not */
+ $emails->save();
+ /* redirect to Index page with Success Message */
+ return redirect('getemail')->with('success', 'Email Updated Successfully');
+ } catch (Exception $e) {
+ /* redirect to Index page with Fails Message */
+ return redirect('getemail')->with('fails', 'Email can not Updated' . '
' . $e->errorInfo[2] . '
');
+ }
+ }
+
+ /**
+ * get the form for Access setting page
+ * @param type Access $access
+ * @return type Response
+ */
+ // public function getaccess(Access $access) {
+ // try {
+ // /* fetch the values of access from access table */
+ // $accesses = $access->whereId('1')->first();
// // Direct to Access Settings Page
- // return view('themes.default1.admin.helpdesk.settings.access', compact('accesses'));
- // } catch (Exception $e) {
- // return view('404');
- // }
- // }
+ // return view('themes.default1.admin.helpdesk.settings.access', compact('accesses'));
+ // } catch (Exception $e) {
+ // return view('404');
+ // }
+ // }
- /**
- * Update the specified resource in storage.
- * @param type Access $access
- * @param type Request $request
- * @return type Response
- */
- // public function postaccess(Access $access, Request $request) {
- // try {
- // /* fetch the values of access request */
- // $accesses = $access->whereId('1')->first();
- // /* fill the values to access table */
- // $accesses->fill($request->except('password_reset', 'bind_agent_ip', 'reg_require', 'quick_access'))->save();
- // /* insert checkbox value to DB */
- // $accesses->password_reset = $request->input('password_reset');
- // $accesses->bind_agent_ip = $request->input('bind_agent_ip');
- // $accesses->reg_require = $request->input('reg_require');
- // $accesses->quick_access = $request->input('quick_access');
- // /* Check whether function success or not */
- // if ($accesses->save() == true) {
- // /* redirect to Index page with Success Message */
- // return redirect('getaccess')->with('success', 'Access Updated Successfully');
- // } else {
- // /* redirect to Index page with Fails Message */
- // return redirect('getaccess')->with('fails', 'Access can not Updated');
- // }
- // } catch (Exception $e) {
- // /* redirect to Index page with Fails Message */
- // return redirect('getaccess')->with('fails', 'Access can not Updated');
- // }
- // }
+ /**
+ * Update the specified resource in storage.
+ * @param type Access $access
+ * @param type Request $request
+ * @return type Response
+ */
+ // public function postaccess(Access $access, Request $request) {
+ // try {
+ // /* fetch the values of access request */
+ // $accesses = $access->whereId('1')->first();
+ // /* fill the values to access table */
+ // $accesses->fill($request->except('password_reset', 'bind_agent_ip', 'reg_require', 'quick_access'))->save();
+ // /* insert checkbox value to DB */
+ // $accesses->password_reset = $request->input('password_reset');
+ // $accesses->bind_agent_ip = $request->input('bind_agent_ip');
+ // $accesses->reg_require = $request->input('reg_require');
+ // $accesses->quick_access = $request->input('quick_access');
+ // /* Check whether function success or not */
+ // if ($accesses->save() == true) {
+ // /* redirect to Index page with Success Message */
+ // return redirect('getaccess')->with('success', 'Access Updated Successfully');
+ // } else {
+ // /* redirect to Index page with Fails Message */
+ // return redirect('getaccess')->with('fails', 'Access can not Updated');
+ // }
+ // } catch (Exception $e) {
+ // /* redirect to Index page with Fails Message */
+ // return redirect('getaccess')->with('fails', 'Access can not Updated');
+ // }
+ // }
- /**
- * get the form for Responder setting page
- * @param type Responder $responder
- * @return type Response
- */
- public function getresponder(Responder $responder) {
- try {
- /* fetch the values of responder from responder table */
- $responders = $responder->whereId('1')->first();
- /* Direct to Responder Settings Page */
- return view('themes.default1.admin.helpdesk.settings.responder', compact('responders'));
- } catch (Exception $e) {
- return redirect()->back()->with('fails',$e->errorInfo[2]);
- }
- }
+ /**
+ * get the form for Responder setting page
+ * @param type Responder $responder
+ * @return type Response
+ */
+ public function getresponder(Responder $responder) {
+ try {
+ /* fetch the values of responder from responder table */
+ $responders = $responder->whereId('1')->first();
+ /* Direct to Responder Settings Page */
+ return view('themes.default1.admin.helpdesk.settings.responder', compact('responders'));
+ } catch (Exception $e) {
+ return redirect()->back()->with('fails', $e->errorInfo[2]);
+ }
+ }
- /**
- * Update the specified resource in storage.
- * @param type Responder $responder
- * @param type Request $request
- * @return type
- */
- public function postresponder(Responder $responder, Request $request) {
- try {
- /* fetch the values of responder request */
- $responders = $responder->whereId('1')->first();
- /* insert Checkbox value to DB */
- $responders->new_ticket = $request->input('new_ticket');
- $responders->agent_new_ticket = $request->input('agent_new_ticket');
- $responders->submitter = $request->input('submitter');
- $responders->participants = $request->input('participants');
- $responders->overlimit = $request->input('overlimit');
- /* fill the values to coompany table */
- /* Check whether function success or not */
- $responders->save();
- /* redirect to Index page with Success Message */
- return redirect('getresponder')->with('success', 'Responder Updated Successfully');
- } catch (Exception $e) {
- /* redirect to Index page with Fails Message */
- return redirect('getresponder')->with('fails', 'Responder can not Updated'.'
'.$e->errorInfo[2].'
');
- }
- }
+ /**
+ * Update the specified resource in storage.
+ * @param type Responder $responder
+ * @param type Request $request
+ * @return type
+ */
+ public function postresponder(Responder $responder, Request $request) {
+ try {
+ /* fetch the values of responder request */
+ $responders = $responder->whereId('1')->first();
+ /* insert Checkbox value to DB */
+ $responders->new_ticket = $request->input('new_ticket');
+ $responders->agent_new_ticket = $request->input('agent_new_ticket');
+ $responders->submitter = $request->input('submitter');
+ $responders->participants = $request->input('participants');
+ $responders->overlimit = $request->input('overlimit');
+ /* fill the values to coompany table */
+ /* Check whether function success or not */
+ $responders->save();
+ /* redirect to Index page with Success Message */
+ return redirect('getresponder')->with('success', 'Responder Updated Successfully');
+ } catch (Exception $e) {
+ /* redirect to Index page with Fails Message */
+ return redirect('getresponder')->with('fails', 'Responder can not Updated' . '
' . $e->errorInfo[2] . '
');
+ }
+ }
- /**
- * get the form for Alert setting page
- * @param type Alert $alert
- * @return type Response
- */
- public function getalert(Alert $alert) {
- try {
- /* fetch the values of alert from alert table */
- $alerts = $alert->whereId('1')->first();
- /* Direct to Alert Settings Page */
- return view('themes.default1.admin.helpdesk.settings.alert', compact('alerts'));
- } catch (Exception $e) {
- return redirect()->back()->with('fails',$e->errorInfo[2]);
- }
- }
+ /**
+ * get the form for Alert setting page
+ * @param type Alert $alert
+ * @return type Response
+ */
+ public function getalert(Alert $alert) {
+ try {
+ /* fetch the values of alert from alert table */
+ $alerts = $alert->whereId('1')->first();
+ /* Direct to Alert Settings Page */
+ return view('themes.default1.admin.helpdesk.settings.alert', compact('alerts'));
+ } catch (Exception $e) {
+ return redirect()->back()->with('fails', $e->errorInfo[2]);
+ }
+ }
- /**
- * Update the specified resource in storage.
- * @param type $id
- * @param type Alert $alert
- * @param type Request $request
- * @return type Response
- */
- public function postalert($id, Alert $alert, Request $request) {
- try {
- /* fetch the values of alert request */
- $alerts = $alert->whereId('1')->first();
- /* Insert Checkbox to DB */
- $alerts->assignment_status = $request->input('assignment_status');
- $alerts->ticket_status = $request->input('ticket_status');
- $alerts->overdue_department_member = $request->input('overdue_department_member');
- $alerts->sql_error = $request->input('sql_error');
- $alerts->excessive_failure = $request->input('excessive_failure');
- $alerts->overdue_status = $request->input('overdue_status');
- $alerts->overdue_assigned_agent = $request->input('overdue_assigned_agent');
- $alerts->overdue_department_manager = $request->input('overdue_department_manager');
- $alerts->internal_status = $request->input('internal_status');
- $alerts->internal_last_responder = $request->input('internal_last_responder');
- $alerts->internal_assigned_agent = $request->input('internal_assigned_agent');
- $alerts->internal_department_manager = $request->input('internal_department_manager');
- $alerts->assignment_assigned_agent = $request->input('assignment_assigned_agent');
- $alerts->assignment_team_leader = $request->input('assignment_team_leader');
- $alerts->assignment_team_member = $request->input('assignment_team_member');
- $alerts->system_error = $request->input('system_error');
- $alerts->transfer_department_member = $request->input('transfer_department_member');
- $alerts->transfer_department_manager = $request->input('transfer_department_manager');
- $alerts->transfer_assigned_agent = $request->input('transfer_assigned_agent');
- $alerts->transfer_status = $request->input('transfer_status');
- $alerts->message_organization_accmanager = $request->input('message_organization_accmanager');
- $alerts->message_department_manager = $request->input('message_department_manager');
- $alerts->message_assigned_agent = $request->input('message_assigned_agent');
- $alerts->message_last_responder = $request->input('message_last_responder');
- $alerts->message_status = $request->input('message_status');
- $alerts->ticket_organization_accmanager = $request->input('ticket_organization_accmanager');
- $alerts->ticket_department_manager = $request->input('ticket_department_manager');
- $alerts->ticket_department_member = $request->input('ticket_department_member');
- $alerts->ticket_admin_email = $request->input('ticket_admin_email');
+ /**
+ * Update the specified resource in storage.
+ * @param type $id
+ * @param type Alert $alert
+ * @param type Request $request
+ * @return type Response
+ */
+ public function postalert($id, Alert $alert, Request $request) {
+ try {
+ /* fetch the values of alert request */
+ $alerts = $alert->whereId('1')->first();
+ /* Insert Checkbox to DB */
+ $alerts->assignment_status = $request->input('assignment_status');
+ $alerts->ticket_status = $request->input('ticket_status');
+ $alerts->overdue_department_member = $request->input('overdue_department_member');
+ $alerts->sql_error = $request->input('sql_error');
+ $alerts->excessive_failure = $request->input('excessive_failure');
+ $alerts->overdue_status = $request->input('overdue_status');
+ $alerts->overdue_assigned_agent = $request->input('overdue_assigned_agent');
+ $alerts->overdue_department_manager = $request->input('overdue_department_manager');
+ $alerts->internal_status = $request->input('internal_status');
+ $alerts->internal_last_responder = $request->input('internal_last_responder');
+ $alerts->internal_assigned_agent = $request->input('internal_assigned_agent');
+ $alerts->internal_department_manager = $request->input('internal_department_manager');
+ $alerts->assignment_assigned_agent = $request->input('assignment_assigned_agent');
+ $alerts->assignment_team_leader = $request->input('assignment_team_leader');
+ $alerts->assignment_team_member = $request->input('assignment_team_member');
+ $alerts->system_error = $request->input('system_error');
+ $alerts->transfer_department_member = $request->input('transfer_department_member');
+ $alerts->transfer_department_manager = $request->input('transfer_department_manager');
+ $alerts->transfer_assigned_agent = $request->input('transfer_assigned_agent');
+ $alerts->transfer_status = $request->input('transfer_status');
+ $alerts->message_organization_accmanager = $request->input('message_organization_accmanager');
+ $alerts->message_department_manager = $request->input('message_department_manager');
+ $alerts->message_assigned_agent = $request->input('message_assigned_agent');
+ $alerts->message_last_responder = $request->input('message_last_responder');
+ $alerts->message_status = $request->input('message_status');
+ $alerts->ticket_organization_accmanager = $request->input('ticket_organization_accmanager');
+ $alerts->ticket_department_manager = $request->input('ticket_department_manager');
+ $alerts->ticket_department_member = $request->input('ticket_department_member');
+ $alerts->ticket_admin_email = $request->input('ticket_admin_email');
- if($request->input('system_error') == null){
- $str = '%0%';
- $path = app_path('../config/app.php');
- $content = \File::get($path);
- $content = str_replace('%1%', $str, $content);
- \File::put($path, $content);
- } else {
- $str = '%1%';
- $path = app_path('../config/app.php');
- $content = \File::get($path);
- $content = str_replace('%0%', $str, $content);
- \File::put($path, $content);
- }
- /* fill the values to coompany table */
- /* Check whether function success or not */
- $alerts->save();
- /* redirect to Index page with Success Message */
- return redirect('getalert')->with('success', 'Alert Updated Successfully');
- } catch (Exception $e) {
- /* redirect to Index page with Fails Message */
- return redirect('getalert')->with('fails', 'Alert can not Updated'.'
'.$e->errorInfo[2].'
');
- }
- }
+ if ($request->input('system_error') == null) {
+ $str = '%0%';
+ $path = app_path('../config/app.php');
+ $content = \File::get($path);
+ $content = str_replace('%1%', $str, $content);
+ \File::put($path, $content);
+ } else {
+ $str = '%1%';
+ $path = app_path('../config/app.php');
+ $content = \File::get($path);
+ $content = str_replace('%0%', $str, $content);
+ \File::put($path, $content);
+ }
+ /* fill the values to coompany table */
+ /* Check whether function success or not */
+ $alerts->save();
+ /* redirect to Index page with Success Message */
+ return redirect('getalert')->with('success', 'Alert Updated Successfully');
+ } catch (Exception $e) {
+ /* redirect to Index page with Fails Message */
+ return redirect('getalert')->with('fails', 'Alert can not Updated' . '
' . $e->errorInfo[2] . '
');
+ }
+ }
+
+ /**
+ * To display the list of ratings in the system
+ * @return type View
+ */
+ public function RatingSettings() {
+ $ratings = DB::table('settings_ratings')->get();
+ return view('themes.default1.admin.helpdesk.settings.ratings', compact('ratings'));
+ }
+
+ /**
+ * To store rating data
+ * @return type Redirect
+ */
+ public function PostRatingSettings($slug) {
+ $name = Input::get('rating_name');
+ $publish = Input::get('publish');
+ $modify = Input::get('modify');
+ DB::table('settings_ratings')->whereSlug($slug)->update(array('rating_name' => $name, 'publish' => $publish, 'modify' => $modify));
+ return redirect()->back()->with('success', 'Successfully updated');
+ }
+
+ /**
+ * To delete a type of rating
+ * @return type Redirect
+ */
+ public function RatingDelete($slug) {
+ DB::table('settings_ratings')->whereSlug($slug)->delete();
+ return redirect()->back()->with('success', 'Successfully Deleted');
+ }
}
diff --git a/app/Http/Controllers/Admin/helpdesk/SlaController.php b/app/Http/Controllers/Admin/helpdesk/SlaController.php
index 003a2d66b..2dd8c69c5 100644
--- a/app/Http/Controllers/Admin/helpdesk/SlaController.php
+++ b/app/Http/Controllers/Admin/helpdesk/SlaController.php
@@ -1,16 +1,15 @@
-middleware('auth');
- $this->middleware('roles');
- }
+ /**
+ * Create a new controller instance.
+ * @return type void
+ */
+ public function __construct() {
+ $this->middleware('auth');
+ $this->middleware('roles');
+ }
- /**
- * Display a listing of the resource.
- * @param type Sla_plan $sla
- * @return type Response
- */
- public function index(Sla_plan $sla) {
- try {
- /* Declare a Variable $slas to store all Values From Sla_plan Table */
- $slas = $sla->get();
- /* Listing the values From Sla_plan Table */
- return view('themes.default1.admin.helpdesk.manage.sla.index', compact('slas'));
- } catch (Exception $e) {
- return redirect()->back()->with('fails',$e->errorInfo[2]);
- }
- }
+ /**
+ * Display a listing of the resource.
+ * @param type Sla_plan $sla
+ * @return type Response
+ */
+ public function index(Sla_plan $sla) {
+ try {
+ /* Declare a Variable $slas to store all Values From Sla_plan Table */
+ $slas = $sla->get();
+ /* Listing the values From Sla_plan Table */
+ return view('themes.default1.admin.helpdesk.manage.sla.index', compact('slas'));
+ } catch (Exception $e) {
+ return redirect()->back()->with('fails', $e->errorInfo[2]);
+ }
+ }
- /**
- * Show the form for creating a new resource.
- * @return type Response
- */
- public function create() {
- try {
- /* Direct to Create Page */
- return view('themes.default1.admin.helpdesk.manage.sla.create');
- } catch (Exception $e) {
- return redirect()->back()->with('fails',$e->errorInfo[2]);
- }
- }
+ /**
+ * Show the form for creating a new resource.
+ * @return type Response
+ */
+ public function create() {
+ try {
+ /* Direct to Create Page */
+ return view('themes.default1.admin.helpdesk.manage.sla.create');
+ } catch (Exception $e) {
+ return redirect()->back()->with('fails', $e->errorInfo[2]);
+ }
+ }
- /**
- * Store a newly created resource in storage.
- * @param type Sla_plan $sla
- * @param type SlaRequest $request
- * @return type Response
- */
- public function store(Sla_plan $sla, SlaRequest $request) {
- try {
- /* Fill the request values to Sla_plan Table */
- /* Check whether function success or not */
- $sla->fill($request->input())->save();
- /* redirect to Index page with Success Message */
- return redirect('sla')->with('success', 'SLA Plan Created Successfully');
- } catch (Exception $e) {
- /* redirect to Index page with Fails Message */
- return redirect('sla')->with('fails', 'SLA Plan can not Create'.'
'.$e->errorInfo[2].'
');
- }
- }
+ /**
+ * Store a newly created resource in storage.
+ * @param type Sla_plan $sla
+ * @param type SlaRequest $request
+ * @return type Response
+ */
+ public function store(Sla_plan $sla, SlaRequest $request) {
+ try {
+ /* Fill the request values to Sla_plan Table */
+ /* Check whether function success or not */
+ $sla->fill($request->input())->save();
+ /* redirect to Index page with Success Message */
+ return redirect('sla')->with('success', 'SLA Plan Created Successfully');
+ } catch (Exception $e) {
+ /* redirect to Index page with Fails Message */
+ return redirect('sla')->with('fails', 'SLA Plan can not Create' . '
' . $e->errorInfo[2] . '
');
+ }
+ }
- /**
- * Show the form for editing the specified resource.
- * @param type int $id
- * @param type Sla_plan $sla
- * @return type Response
- */
- public function edit($id, Sla_plan $sla) {
- try {
- /* Direct to edit page along values of perticular field using Id */
- $slas = $sla->whereId($id)->first();
- $slas->get();
- return view('themes.default1.admin.helpdesk.manage.sla.edit', compact('slas'));
- } catch (Exception $e) {
- return redirect()->back()->with('fails',$e->errorInfo[2]);
- }
- }
+ /**
+ * Show the form for editing the specified resource.
+ * @param type int $id
+ * @param type Sla_plan $sla
+ * @return type Response
+ */
+ public function edit($id, Sla_plan $sla) {
+ try {
+ /* Direct to edit page along values of perticular field using Id */
+ $slas = $sla->whereId($id)->first();
+ $slas->get();
+ return view('themes.default1.admin.helpdesk.manage.sla.edit', compact('slas'));
+ } catch (Exception $e) {
+ return redirect()->back()->with('fails', $e->errorInfo[2]);
+ }
+ }
- /**
- * Update the specified resource in storage.
- * @param type int $id
- * @param type Sla_plan $sla
- * @param type SlaUpdate $request
- * @return type Response
- */
- public function update($id, Sla_plan $sla, SlaUpdate $request) {
- try {
- /* Fill values to selected field using Id except Check box */
- $slas = $sla->whereId($id)->first();
- $slas->fill($request->except('transient', 'ticket_overdue'))->save();
- /* Update transient checkox field */
- $slas->transient = $request->input('transient');
- /* Update ticket_overdue checkox field */
- $slas->ticket_overdue = $request->input('ticket_overdue');
- /* Check whether function success or not */
- $slas->save();
- /* redirect to Index page with Success Message */
- return redirect('sla')->with('success', 'SLA Plan Updated Successfully');
- } catch (Exception $e) {
- /* redirect to Index page with Fails Message */
- return redirect('sla')->with('fails', 'SLA Plan can not Update'.'
'.$e->errorInfo[2].'
');
- }
- }
+ /**
+ * Update the specified resource in storage.
+ * @param type int $id
+ * @param type Sla_plan $sla
+ * @param type SlaUpdate $request
+ * @return type Response
+ */
+ public function update($id, Sla_plan $sla, SlaUpdate $request) {
+ try {
+ /* Fill values to selected field using Id except Check box */
+ $slas = $sla->whereId($id)->first();
+ $slas->fill($request->except('transient', 'ticket_overdue'))->save();
+ /* Update transient checkox field */
+ $slas->transient = $request->input('transient');
+ /* Update ticket_overdue checkox field */
+ $slas->ticket_overdue = $request->input('ticket_overdue');
+ /* Check whether function success or not */
+ $slas->save();
+ /* redirect to Index page with Success Message */
+ return redirect('sla')->with('success', 'SLA Plan Updated Successfully');
+ } catch (Exception $e) {
+ /* redirect to Index page with Fails Message */
+ return redirect('sla')->with('fails', 'SLA Plan can not Update' . '
Associated Help Topic have been moved to default SLA
';
- } else {
- $topic = "";
- }
- $message = $ticket.$dept.$topic;
- /* Delete a perticular field from the database by delete() using Id */
- $slas = $sla->whereId($id)->first();
- /* Check whether function success or not */
- try{
- $slas->delete();
- /* redirect to Index page with Success Message */
- return redirect('sla')->with('success', 'SLA Plan Deleted Successfully'.$message);
- } catch (Exception $e) {
- /* redirect to Index page with Fails Message */
- return redirect('sla')->with('fails', 'SLA Plan can not Delete'.'
'.$e->errorInfo[2].'
');
- }
- }
- }
+ /**
+ * Remove the specified resource from storage.
+ * @param type int $id
+ * @param type Sla_plan $sla
+ * @return type Response
+ */
+ public function destroy($id, Sla_plan $sla) {
+ $default_sla = Ticket::where('id', '=', '1')->first();
+ if ($default_sla->sla == $id) {
+ return redirect('departments')->with('fails', 'You cannot delete default department');
+ } else {
+ $tickets = DB::table('tickets')->where('sla', '=', $id)->update(['sla' => $default_sla->sla]);
+ if ($tickets > 0) {
+ if ($tickets > 1) {
+ $text_tickets = "Tickets";
+ } else {
+ $text_tickets = "Ticket";
+ }
+ $ticket = '
' . $tickets . ' ' . $text_tickets . ' have been moved to default SLA
Associated Help Topic have been moved to default SLA
';
+ } else {
+ $topic = "";
+ }
+ $message = $ticket . $dept . $topic;
+ /* Delete a perticular field from the database by delete() using Id */
+ $slas = $sla->whereId($id)->first();
+ /* Check whether function success or not */
+ try {
+ $slas->delete();
+ /* redirect to Index page with Success Message */
+ return redirect('sla')->with('success', 'SLA Plan Deleted Successfully' . $message);
+ } catch (Exception $e) {
+ /* redirect to Index page with Fails Message */
+ return redirect('sla')->with('fails', 'SLA Plan can not Delete' . '
' . $e->errorInfo[2] . '
');
+ }
+ }
+ }
}
diff --git a/app/Http/Controllers/Admin/helpdesk/TeamController.php b/app/Http/Controllers/Admin/helpdesk/TeamController.php
index 91057d142..396c996d7 100644
--- a/app/Http/Controllers/Admin/helpdesk/TeamController.php
+++ b/app/Http/Controllers/Admin/helpdesk/TeamController.php
@@ -1,17 +1,16 @@
-middleware('auth');
- $this->middleware('roles');
- }
+ /**
+ * Create a new controller instance.
+ * @return type void
+ */
+ public function __construct() {
+ $this->middleware('auth');
+ $this->middleware('roles');
+ }
- /**
- * get Index page
- * @param type Teams $team
- * @param type Assign_team_agent $assign_team_agent
- * @return type Response
- */
- public function index(Teams $team, Assign_team_agent $assign_team_agent) {
- try {
- $teams = $team->get();
- /* find out the Number of Members in the Team */
- $id = $teams->lists('id');
- $assign_team_agent = $assign_team_agent->get();
- return view('themes.default1.admin.helpdesk.agent.teams.index', compact('assign_team_agent', 'teams'));
- } catch (Exception $e) {
- return redirect()->back()->with('fails',$e->errorInfo[2]);
- }
- }
+ /**
+ * get Index page
+ * @param type Teams $team
+ * @param type Assign_team_agent $assign_team_agent
+ * @return type Response
+ */
+ public function index(Teams $team, Assign_team_agent $assign_team_agent) {
+ try {
+ $teams = $team->get();
+ /* find out the Number of Members in the Team */
+ $id = $teams->lists('id');
+ $assign_team_agent = $assign_team_agent->get();
+ return view('themes.default1.admin.helpdesk.agent.teams.index', compact('assign_team_agent', 'teams'));
+ } catch (Exception $e) {
+ return redirect()->back()->with('fails', $e->errorInfo[2]);
+ }
+ }
- /**
- * Show the form for creating a new resource.
- * @param type User $user
- * @return type Response
- */
- public function create(User $user) {
- try {
- $user = $user->get();
- return view('themes.default1.admin.helpdesk.agent.teams.create', compact('user'));
- } catch (Exception $e) {
- return redirect()->back()->with('fails',$e->errorInfo[2]);
- }
- }
+ /**
+ * Show the form for creating a new resource.
+ * @param type User $user
+ * @return type Response
+ */
+ public function create(User $user) {
+ try {
+ $user = $user->get();
+ return view('themes.default1.admin.helpdesk.agent.teams.create', compact('user'));
+ } catch (Exception $e) {
+ return redirect()->back()->with('fails', $e->errorInfo[2]);
+ }
+ }
- /**
- * Store a newly created resource in storage.
- * @param type Teams $team
- * @param type TeamRequest $request
- * @return type Response
- */
- public function store(Teams $team, TeamRequest $request) {
-
- if($request->team_lead){
- $team_lead = $request->team_lead;
- } else {
- $team_lead = null;
- }
- $team->team_lead = $team_lead;
- try {
- /* Check whether function success or not */
- $team->fill($request->except('team_lead'))->save();
- /* redirect to Index page with Success Message */
- return redirect('teams')->with('success', 'Teams Created Successfully');
- } catch (Exception $e) {
- /* redirect to Index page with Fails Message */
- return redirect('teams')->with('fails', 'Teams can not Create'.'
'.$e->errorInfo[2].'
');
- }
- }
+ /**
+ * Store a newly created resource in storage.
+ * @param type Teams $team
+ * @param type TeamRequest $request
+ * @return type Response
+ */
+ public function store(Teams $team, TeamRequest $request) {
- /**
- * Show the form for editing the specified resource.
- * @param type $id
- * @param type User $user
- * @param type Assign_team_agent $assign_team_agent
- * @param type Teams $team
- * @return type Response
- */
- public function edit($id, User $user, Assign_team_agent $assign_team_agent, Teams $team) {
- try {
- $user = $user->whereId($id)->first();
- $teams = $team->whereId($id)->first();
- $agent_team = $assign_team_agent->where('team_id', $id)->get();
- $agent_id = $agent_team->lists('agent_id', 'agent_id');
- return view('themes.default1.admin.helpdesk.agent.teams.edit', compact('agent_id', 'user', 'teams', 'allagents'));
- } catch (Exception $e) {
- return redirect()->back()->with('fails',$e->errorInfo[2]);
- }
- }
+ if ($request->team_lead) {
+ $team_lead = $request->team_lead;
+ } else {
+ $team_lead = null;
+ }
+ $team->team_lead = $team_lead;
+ try {
+ /* Check whether function success or not */
+ $team->fill($request->except('team_lead'))->save();
+ /* redirect to Index page with Success Message */
+ return redirect('teams')->with('success', 'Teams Created Successfully');
+ } catch (Exception $e) {
+ /* redirect to Index page with Fails Message */
+ return redirect('teams')->with('fails', 'Teams can not Create' . '
' . $e->errorInfo[2] . '
');
+ }
+ }
- /**
- * Update the specified resource in storage.
- * @param type int $id
- * @param type Teams $team
- * @param type TeamUpdate $request
- * @return type Response
- */
- public function update($id, Teams $team, TeamUpdate $request) {
-
- $teams = $team->whereId($id)->first();
- //updating check box
- if($request->team_lead){
- $team_lead = $request->team_lead;
- } else {
- $team_lead = null;
- }
- $teams->team_lead = $team_lead;
- $teams->save();
+ /**
+ * Show the form for editing the specified resource.
+ * @param type $id
+ * @param type User $user
+ * @param type Assign_team_agent $assign_team_agent
+ * @param type Teams $team
+ * @return type Response
+ */
+ public function edit($id, User $user, Assign_team_agent $assign_team_agent, Teams $team) {
+ try {
+ $user = $user->whereId($id)->first();
+ $teams = $team->whereId($id)->first();
+ $agent_team = $assign_team_agent->where('team_id', $id)->get();
+ $agent_id = $agent_team->lists('agent_id', 'agent_id');
+ return view('themes.default1.admin.helpdesk.agent.teams.edit', compact('agent_id', 'user', 'teams', 'allagents'));
+ } catch (Exception $e) {
+ return redirect()->back()->with('fails', $e->errorInfo[2]);
+ }
+ }
- $alert = $request->input('assign_alert');
- $teams->assign_alert = $alert;
- $teams->save(); //saving check box
- //updating whole field
- /* Check whether function success or not */
- try {
- $teams->fill($request->except('team_lead'))->save();
- /* redirect to Index page with Success Message */
- return redirect('teams')->with('success', 'Teams Updated Successfully');
- } catch (Exception $e) {
- /* redirect to Index page with Fails Message */
- return redirect('teams')->with('fails', 'Teams can not Update'.'
'.$e->errorInfo[2].'
');
- }
- }
+ /**
+ * Update the specified resource in storage.
+ * @param type int $id
+ * @param type Teams $team
+ * @param type TeamUpdate $request
+ * @return type Response
+ */
+ public function update($id, Teams $team, TeamUpdate $request) {
+
+ $teams = $team->whereId($id)->first();
+ //updating check box
+ if ($request->team_lead) {
+ $team_lead = $request->team_lead;
+ } else {
+ $team_lead = null;
+ }
+ $teams->team_lead = $team_lead;
+ $teams->save();
+
+ $alert = $request->input('assign_alert');
+ $teams->assign_alert = $alert;
+ $teams->save(); //saving check box
+ //updating whole field
+ /* Check whether function success or not */
+ try {
+ $teams->fill($request->except('team_lead'))->save();
+ /* redirect to Index page with Success Message */
+ return redirect('teams')->with('success', 'Teams Updated Successfully');
+ } catch (Exception $e) {
+ /* redirect to Index page with Fails Message */
+ return redirect('teams')->with('fails', 'Teams can not Update' . '
' . $e->errorInfo[2] . '
');
+ }
+ }
+
+ /**
+ * Remove the specified resource from storage.
+ * @param type int $id
+ * @param type Teams $team
+ * @param type Assign_team_agent $assign_team_agent
+ * @return type Response
+ */
+ public function destroy($id, Teams $team, Assign_team_agent $assign_team_agent) {
+ try {
+ $assign_team_agent->where('team_id', $id)->delete();
+ $teams = $team->whereId($id)->first();
+ $tickets = DB::table('tickets')->where('team_id', '=', $id)->update(['team_id' => null]);
+ /* Check whether function success or not */
+ $teams->delete();
+ /* redirect to Index page with Success Message */
+ return redirect('teams')->with('success', 'Teams Deleted Successfully');
+ } catch (Exception $e) {
+ /* redirect to Index page with Fails Message */
+ return redirect('teams')->with('fails', 'Teams can not Delete' . '
' . $e->errorInfo[2] . '
');
+ }
+ }
- /**
- * Remove the specified resource from storage.
- * @param type int $id
- * @param type Teams $team
- * @param type Assign_team_agent $assign_team_agent
- * @return type Response
- */
- public function destroy($id, Teams $team, Assign_team_agent $assign_team_agent) {
- try {
- $assign_team_agent->where('team_id', $id)->delete();
- $teams = $team->whereId($id)->first();
- $tickets = DB::table('tickets')->where('team_id','=',$id)->update(['team_id' => null]);
- /* Check whether function success or not */
- $teams->delete();
- /* redirect to Index page with Success Message */
- return redirect('teams')->with('success', 'Teams Deleted Successfully');
- } catch (Exception $e) {
- /* redirect to Index page with Fails Message */
- return redirect('teams')->with('fails', 'Teams can not Delete'.'
'.$e->errorInfo[2].'
');
- }
- }
}
diff --git a/app/Http/Controllers/Admin/helpdesk/TemplateController.php b/app/Http/Controllers/Admin/helpdesk/TemplateController.php
index 2f29cd0df..9e55e240d 100644
--- a/app/Http/Controllers/Admin/helpdesk/TemplateController.php
+++ b/app/Http/Controllers/Admin/helpdesk/TemplateController.php
@@ -1,7 +1,11 @@
-middleware('auth');
- $this->middleware('roles');
- }
+ /**
+ * Create a new controller instance.
+ * @return type void
+ */
+ public function __construct(PhpMailController $PhpMailController) {
+ $this->PhpMailController = $PhpMailController;
+ SettingsController::smtp();
+ $this->middleware('auth');
+ $this->middleware('roles');
+ }
- /**
- * Display a listing of the resource.
- * @param type Template $template
- * @return type Response
- */
- public function index(Template $template) {
- try {
- $templates = $template->get();
- return view('themes.default1.admin.helpdesk.emails.template.index', compact('templates'));
- } catch (Exception $e) {
- return view('404');
- }
- }
+ /**
+ * Display a listing of the resource.
+ * @param type Template $template
+ * @return type Response
+ */
+ public function index(Template $template) {
+ try {
+ $templates = $template->get();
+ return view('themes.default1.admin.helpdesk.emails.template.index', compact('templates'));
+ } catch (Exception $e) {
+ return view('404');
+ }
+ }
- /**
- * Show the form for creating a new resource.
- * @param type Languages $language
- * @param type Template $template
- * @return type Response
- */
- public function create(Languages $language, Template $template) {
- try {
- $templates = $template->get();
- $languages = $language->get();
- return view('themes.default1.admin.helpdesk.emails.template.create', compact('languages', 'templates'));
- } catch (Exception $e) {
- return view('404');
- }
- }
+ /**
+ * Show the form for creating a new resource.
+ * @param type Languages $language
+ * @param type Template $template
+ * @return type Response
+ */
+ public function create(Languages $language, Template $template) {
+ try {
+ $templates = $template->get();
+ $languages = $language->get();
+ return view('themes.default1.admin.helpdesk.emails.template.create', compact('languages', 'templates'));
+ } catch (Exception $e) {
+ return view('404');
+ }
+ }
- /**
- * Store a newly created resource in storage.
- * @param type Template $template
- * @param type TemplateRequest $request
- * @return type Response
- */
- public function store(Template $template, TemplateRequest $request) {
- try {
- /* Check whether function success or not */
- if ($template->fill($request->input())->save() == true) {
- /* redirect to Index page with Success Message */
- return redirect('template')->with('success', 'Teams Created Successfully');
- } else {
- /* redirect to Index page with Fails Message */
- return redirect('template')->with('fails', 'Teams can not Create');
- }
- } catch (Exception $e) {
- /* redirect to Index page with Fails Message */
- return redirect('template')->with('fails', 'Teams can not Create');
- }
- }
-
- /**
- * Display the specified resource.
- * @param int $id
- * @return Response
- */
- public function show($id) {
- //
- }
-
- /**
- * Show the form for editing the specified resource.
- * @param type $id
- * @param type Template $template
- * @param type Languages $language
- * @return type Response
- */
- public function listtemplates() {
- $path = '../resources/views/emails/';
-
- $templates = scandir($path);
- $directory = str_replace('/', '-', $path);
- return view('themes.default1.admin.helpdesk.emails.template.listtemplates', compact('templates','directory'));
- }
-
- public function readtemplate($template,$path) {
- $directory = str_replace('-', '/', $path);
- $directory2 = $directory.$template;
- if (is_dir($directory2)) {
- $templates = scandir($directory2);
- $directory = str_replace('/', '-', $directory2.'/');
- return view('themes.default1.admin.helpdesk.emails.template.listtemplates', compact('templates','directory'));
+ /**
+ * Store a newly created resource in storage.
+ * @param type Template $template
+ * @param type TemplateRequest $request
+ * @return type Response
+ */
+ public function store(Template $template, TemplateRequest $request) {
+ try {
+ /* Check whether function success or not */
+ if ($template->fill($request->input())->save() == true) {
+ /* redirect to Index page with Success Message */
+ return redirect('template')->with('success', 'Teams Created Successfully');
+ } else {
+ /* redirect to Index page with Fails Message */
+ return redirect('template')->with('fails', 'Teams can not Create');
}
- else {
- $handle = fopen($directory.$template, "r");
- $contents = fread($handle, filesize($directory.$template));
- fclose($handle);
- }
- return view('themes.default1.admin.helpdesk.emails.template.readtemplates', compact('contents','template','path'));
- }
- public function createtemplate() {
- $directory = '../resources/views/emails/';
- $fname = Input::get('folder_name');
- $filename = $directory.$fname;
-
+ } catch (Exception $e) {
+ /* redirect to Index page with Fails Message */
+ return redirect('template')->with('fails', 'Teams can not Create');
+ }
+ }
+
+ /**
+ * Display the specified resource.
+ * @param int $id
+ * @return Response
+ */
+ public function show($id) {
+ //
+ }
+
+ /**
+ * Show the form for editing the specified resource.
+ * @param type $id
+ * @param type Template $template
+ * @param type Languages $language
+ * @return type Response
+ */
+ public function listdirectories() {
+ $path = '../resources/views/emails/';
+ $directories = scandir($path);
+ $directory = str_replace('/', '-', $path);
+ return view('themes.default1.admin.helpdesk.emails.template.listdirectories', compact('directories', 'directory'));
+ }
+
+ public function listtemplates($template, $path) {
+ $paths = str_replace('-', '/', $path);
+ $directory2 = $paths . $template;
+
+ $templates = scandir($directory2);
+ $directory = str_replace('/', '-', $directory2 . '/');
+ return view('themes.default1.admin.helpdesk.emails.template.listtemplates', compact('templates', 'directory'));
+ }
+
+ public function readtemplate($template, $path) {
+ $directory = str_replace('-', '/', $path);
+ $handle = fopen($directory . $template, "r");
+ $contents = fread($handle, filesize($directory . $template));
+ fclose($handle);
+
+ return view('themes.default1.admin.helpdesk.emails.template.readtemplates', compact('contents', 'template', 'path'));
+ }
+
+ public function createtemplate() {
+ $directory = '../resources/views/emails/';
+ $fname = Input::get('folder_name');
+ $filename = $directory . $fname;
+
// images folder creation using php
// $mydir = dirname( __FILE__ )."/html/images";
// if(!is_dir($mydir)){
// mkdir("html/images");
// }
- // Move all images files
+ // Move all images files
+
+ if (!file_exists($filename)) {
+ mkdir($filename, 0777);
+ }
+ $files = array_filter(scandir($directory . 'default'));
+
+ foreach ($files as $file) {
+ if ($file === '.' or $file === '..')
+ continue;
+ if (!is_dir($file)) {
+ // $file_to_go = str_replace("code/resources/views/emails/",'code/resources/views/emails/'.$fname,$file);
+ $destination = $directory . $fname . '/';
+
+ copy($directory . 'default/' . $file, $destination . $file);
+ }
+ }
+ return \Redirect::back()->with('success', 'Successfully copied');
+ }
+
+ public function writetemplate($template, $path) {
+ $directory = str_replace('-', '/', $path);
+ $b = Input::get('templatedata');
+
+ file_put_contents($directory . $template, print_r($b, true));
+ return \Redirect::back()->with('success', 'Successfully updated');
+ }
+
+ public function deletetemplate($template, $path) {
+ $directory = str_replace('-', '/', $path);
+ $dir = $directory . $template;
+ $status = \DB::table('settings_email')->first();
+ if ($template == 'default' or $template == $status->template) {
+ return \Redirect::back()->with('fails', 'You cannot delete a default or active directory!');
+ }
+ if (is_dir($dir)) {
+ $objects = scandir($dir);
+ foreach ($objects as $object) {
+ if ($object != "." && $object != "..") {
+ unlink($dir . "/" . $object);
+ }
+ }
+ rmdir($dir);
+ } else {
+ rmdir($dir);
+ }
+ return \Redirect::back()->with('success', 'Successfully Deleted');
+ }
+
+ public function activateset($setname) {
+ \DB::table('settings_email')->update(array('template' => $setname));
+ return \Redirect::back()->with('success', 'You have Successfully Activated this Set');
+ }
+
+ public function edit($id, Template $template, Languages $language) {
+ try {
+ $templates = $template->whereId($id)->first();
+ $languages = $language->get();
+ return view('themes.default1.admin.helpdesk.emails.template.edit', compact('templates', 'languages'));
+ } catch (Exception $e) {
+ return view('404');
+ }
+ }
+
+ /**
+ * Update the specified resource in storage.
+ * @param type int $id
+ * @param type Template $template
+ * @param type TemplateUdate $request
+ * @return type Response
+ */
+ public function update($id, Template $template, TemplateUdate $request) {
+ try {
+ //TODO validation
+ $templates = $template->whereId($id)->first();
+ /* Check whether function success or not */
+ if ($templates->fill($request->input())->save() == true) {
+ /* redirect to Index page with Success Message */
+ return redirect('template')->with('success', 'Teams Updated Successfully');
+ } else {
+ /* redirect to Index page with Fails Message */
+ return redirect('template')->with('fails', 'Teams can not Update');
+ }
+ } catch (Exception $e) {
+ /* redirect to Index page with Fails Message */
+ return redirect('template')->with('fails', 'Teams can not Update');
+ }
+ }
+
+ /**
+ * Remove the specified resource from storage.
+ * @param type int $id
+ * @param type Template $template
+ * @return type Response
+ */
+ public function destroy($id, Template $template) {
+ try {
+ $templates = $template->whereId($id)->first();
+ /* Check whether function success or not */
+ if ($templates->delete() == true) {
+ /* redirect to Index page with Success Message */
+ return redirect('template')->with('success', 'Teams Deleted Successfully');
+ } else {
+ /* redirect to Index page with Fails Message */
+ return redirect('template')->with('fails', 'Teams can not Delete');
+ }
+ } catch (Exception $e) {
+ /* redirect to Index page with Fails Message */
+ return redirect('template')->with('fails', 'Teams can not Delete');
+ }
+ }
+
+ /**
+ * Form for Email connection checking.
+ * @param type Emails $email
+ * @return type Response
+ */
+ public function formDiagno(Emails $email) {
+ try {
+ $emails = $email->get();
+ return view('themes.default1.admin.helpdesk.emails.template.formDiagno', compact('emails'));
+ } catch (Exception $e) {
+ return view('404');
+ }
+ }
+
+ /**
+ * function to send emails
+ * @param type Request $request
+ * @return type
+ */
+ public function postDiagno(Request $request) {
+ $email = $request->input('to');
+ if ($email == null) {
+ return redirect('getdiagno')->with('fails', 'Please provide E-mail address !');
+ }
+ // sending mail via php mailer
+ $mail = $this->PhpMailController->sendmail($from = 1, $to = ['email' => $email], $message = ['subject' => 'Checking the connection', 'scenario' => 'error-report', 'content' => 'Email Received Successfully'], $template_variables = ['system_error' => 'hello']);
+
+ return redirect('getdiagno')->with('success', 'Please check your mail. An E-mail has been sent to your E-mail address');
+ }
-if(!file_exists($filename)) {
-mkdir($filename,0777);
-}
-$files = array_filter(scandir($directory.'default'));
-
- foreach($files as $file){
- if ($file === '.' or $file === '..') continue;
- if(!is_dir($file)) {
- // $file_to_go = str_replace("code/resources/views/emails/",'code/resources/views/emails/'.$fname,$file);
- $destination = $directory.$fname.'/';
-
- copy($directory.'default/'.$file, $destination.$file);
- }
- }
- return \Redirect::back()->with('success', 'Successfully copied');
- }
- public function writetemplate($template,$path) {
- $directory = str_replace('-', '/', $path);
- $b = Input::get('templatedata');
-
- file_put_contents($directory.$template, print_r($b, true));
- return \Redirect::back()->with('success', 'Successfully updated');
- }
-
- public function edit($id, Template $template, Languages $language) {
- try {
- $templates = $template->whereId($id)->first();
- $languages = $language->get();
- return view('themes.default1.admin.helpdesk.emails.template.edit', compact('templates', 'languages'));
- } catch (Exception $e) {
- return view('404');
- }
- }
-
- /**
- * Update the specified resource in storage.
- * @param type int $id
- * @param type Template $template
- * @param type TemplateUdate $request
- * @return type Response
- */
- public function update($id, Template $template, TemplateUdate $request) {
- try {
- //TODO validation
- $templates = $template->whereId($id)->first();
- /* Check whether function success or not */
- if ($templates->fill($request->input())->save() == true) {
- /* redirect to Index page with Success Message */
- return redirect('template')->with('success', 'Teams Updated Successfully');
- } else {
- /* redirect to Index page with Fails Message */
- return redirect('template')->with('fails', 'Teams can not Update');
- }
- } catch (Exception $e) {
- /* redirect to Index page with Fails Message */
- return redirect('template')->with('fails', 'Teams can not Update');
- }
- }
-
- /**
- * Remove the specified resource from storage.
- * @param type int $id
- * @param type Template $template
- * @return type Response
- */
- public function destroy($id, Template $template) {
- try {
- $templates = $template->whereId($id)->first();
- /* Check whether function success or not */
- if ($templates->delete() == true) {
- /* redirect to Index page with Success Message */
- return redirect('template')->with('success', 'Teams Deleted Successfully');
- } else {
- /* redirect to Index page with Fails Message */
- return redirect('template')->with('fails', 'Teams can not Delete');
- }
- } catch (Exception $e) {
- /* redirect to Index page with Fails Message */
- return redirect('template')->with('fails', 'Teams can not Delete');
- }
- }
-
- /**
- * Form for Email connection checking.
- * @param type Emails $email
- * @return type Response
- */
- public function formDiagno(Emails $email) {
- try {
- $emails = $email->get();
- return view('themes.default1.admin.helpdesk.emails.template.formDiagno', compact('emails'));
- } catch (Exception $e) {
- return view('404');
- }
- }
-
- /**
- * function to send emails
- * @param type Request $request
- * @return type
- */
- public function postDiagno(Request $request) {
- $email = $request->input('to');
- if($email == null)
- {
- return redirect('getdiagno')->with('fails', 'Please provide E-mail address !');
- }
- $mail = Mail::send('themes.default1.admin.helpdesk.emails.template.connection', array('link' => url('getmail'), 'username' => $email), function ($message) use ($email) {
- $message->to($email)->subject('Checking the connection');
- });
- return redirect('getdiagno')->with('success', 'Please check your mail. An E-mail has been sent to your E-mail address');
- }
-
}
diff --git a/app/Http/Controllers/Admin/helpdesk/ThreadController.php b/app/Http/Controllers/Admin/helpdesk/ThreadController.php
index 184658215..f9653d36e 100644
--- a/app/Http/Controllers/Admin/helpdesk/ThreadController.php
+++ b/app/Http/Controllers/Admin/helpdesk/ThreadController.php
@@ -1,14 +1,15 @@
-get();
- /* get the values of priority from Priority Table */
- $priorities = $priority->get();
- /* Direct to view page */
- return view('themes.default1.admin.helpdesk.tickets.ticket', compact('threads', 'priorities'));
- } catch (Exception $e) {
- return view('404');
- }
- }
+ /**
+ * get the values from ticket_thread Table and direct to view page
+ * @param type Ticket_thread $thread
+ * @param type Priority $priority
+ * @return type Response
+ */
+ public function getTickets(Ticket_thread $thread, Priority $priority) {
+ try {
+ /* get the values of Ticket_thread from Ticket_thread Table */
+ $threads = $thread->get();
+ /* get the values of priority from Priority Table */
+ $priorities = $priority->get();
+ /* Direct to view page */
+ return view('themes.default1.admin.helpdesk.tickets.ticket', compact('threads', 'priorities'));
+ } catch (Exception $e) {
+ return view('404');
+ }
+ }
+
}
diff --git a/app/Http/Controllers/Agent/DashboardController.php b/app/Http/Controllers/Agent/DashboardController.php
deleted file mode 100644
index 5fe9793a6..000000000
--- a/app/Http/Controllers/Agent/DashboardController.php
+++ /dev/null
@@ -1,92 +0,0 @@
-
- */
-class DashboardController extends Controller {
-
- /**
- * Create a new controller instance.
- * constructor to check
- * 1. authentication
- * 2. user roles
- * 3. roles must be agent
- * @return void
- */
- public function __construct() {
- $this->middleware('auth');
- $this->middleware('role.agent');
- }
-
- /**
- * Show the form for creating a new resource.
- * @return type Response
- */
- public function index() {
- try {
- if(Auth::user()->role == "user"){
- return \Redirect::route('home');
- }
- return View::make('themes.default1.agent.helpdesk.dashboard.dashboard');
- } catch (Exception $e) {
- return view('404');
- }
- }
-
- /**
- * ChartData
- * @return type
- */
- public function ChartData()
- {
- $date2 = strtotime(Date('Y-m-d'));
- $date3 = Date('Y-m-d');
- $format = 'Y-m-d';
- $date1 = strtotime(Date($format,strtotime('-1 month'. $date3)));
-
- $return = "";
- $last = "";
- for ( $i = $date1; $i <= $date2; $i = $i + 86400 ) {
- $thisDate = date( 'Y-m-d', $i );
-
- $created = \DB::table('tickets')->select('created_at')->where('created_at','LIKE','%'.$thisDate.'%')->count();
- $closed = \DB::table('tickets')->select('closed_at')->where('closed_at','LIKE','%'.$thisDate.'%')->count();
- $reopened = \DB::table('tickets')->select('reopened_at')->where('reopened_at','LIKE','%'.$thisDate.'%')->count();
-
- $value = ['date' => $thisDate, 'open' => $created, 'closed' => $closed, 'reopened' => $reopened];
- $array = array_map('htmlentities',$value);
- $json = html_entity_decode(json_encode($array));
- $return .= $json.',';
- }
- $last = rtrim($return,',');
-
- return '['.$last.']';
-
-
-
- // $ticketlist = DB::table('tickets')
- // ->select(DB::raw('MONTH(updated_at) as month'),DB::raw('SUM(CASE WHEN status = 3 THEN 1 ELSE 0 END) as closed'),DB::raw('SUM(CASE WHEN status = 2 THEN 1 ELSE 0 END) as reopened'),DB::raw('SUM(CASE WHEN status = 1 THEN 1 ELSE 0 END) as open'),
- // DB::raw('count(*) as totaltickets'))
- // ->groupBy('month')
- // ->orderBy('month', 'asc')
- // ->get();
-
- // return $ticketlist;
- }
-
-}
diff --git a/app/Http/Controllers/Agent/dashboard.blade.php b/app/Http/Controllers/Agent/dashboard.blade.php
deleted file mode 100644
index e235138da..000000000
--- a/app/Http/Controllers/Agent/dashboard.blade.php
+++ /dev/null
@@ -1,234 +0,0 @@
-@extends('themes.default1.agent.layout.agent')
-
-@section('Dashboard')
-class="active"
-@stop
-
-@section('dashboard-bar')
-active
-@stop
-
-@section('dashboard')
-class="active"
-@stop
-
-@section('content')
-
-
';
+ }
+
+ /**
+ * user remove
+ * @return type
+ */
+ public function userremove() {
+ $id = Input::get('data1');
+ $ticket_collaborator = Ticket_Collaborator::where('id', '=', $id)->delete();
+ return 1;
+ }
+
+ /**
+ * select_all
+ * @return type
+ */
+ public function select_all() {
+
+ if (Input::has('select_all')) {
+ $selectall = Input::get('select_all');
+ // dd($selectall);
+ $value = Input::get('submit');
+ // dd($value);
+ foreach ($selectall as $delete) {
+ var_dump($delete);
+ $ticket = Tickets::whereId($delete)->first();
+ if ($value == "Delete") {
+ $ticket->status = 5;
+ $ticket->save();
+ } elseif ($value == "Close") {
+ $ticket->status = 2;
+ $ticket->closed = 1;
+ $ticket->closed_at = date('Y-m-d H:i:s');
+ $ticket->save();
+ } elseif ($value == "Open") {
+ $ticket->status = 1;
+ $ticket->reopened = 1;
+ $ticket->reopened_at = date('Y-m-d H:i:s');
+ $ticket->closed = 0;
+ $ticket->closed_at = null;
+
+ $ticket->save();
+ }
+ }
+ if ($value == "Delete") {
+ return redirect()->back()->with('success', 'Moved to trash');
+ } elseif ($value == "Close") {
+ return redirect()->back()->with('success', 'Tickets has been Closed');
+ } elseif ($value == "Open") {
+ return redirect()->back()->with('success', 'Ticket has been Opened');
+ }
+ }
+ return redirect()->back()->with('fails', 'None Selected!');
+ }
+
+ /**
+ * user time zone
+ * @param type $utc
+ * @return type date
+ */
+ public static function usertimezone($utc) {
+ $set = System::whereId('1')->first();
+ $timezone = Timezones::whereId($set->time_zone)->first();
+ $tz = $timezone->name;
+ $format = $set->date_time_format;
+ date_default_timezone_set($tz);
+ $offset = date('Z', strtotime($utc));
+ $format = Date_time_format::whereId($format)->first()->format;
+ $date = date($format, strtotime($utc) + $offset);
+ return $date;
+ }
+
+ /**
+ * lock
+ * @param type $id
+ * @return type null
+ */
+ public function lock($id) {
+ $ticket = Tickets::where('id', '=', $id)->first();
+ $ticket->lock_by = Auth::user()->id;
+ $ticket->lock_at = date('Y-m-d H:i:s');
+ $ticket->save();
+ }
+
+ /**
+ * Show the deptopen ticket list page
+ * @return type response
+ */
+ public function deptopen($id) {
+ $dept = Department::where('name', '=', $id)->first();
+ if (Auth::user()->role == 'agent') {
+ if (Auth::user()->primary_dpt == $dept->id) {
+ return view('themes.default1.agent.helpdesk.dept-ticket.open', compact('id'));
+ } else {
+ return redirect()->back()->with('fails', 'Unauthorised!');
+ }
+ } else {
+ return view('themes.default1.agent.helpdesk.dept-ticket.open', compact('id'));
+ }
+ }
+
+ /**
+ * Show the deptclose ticket list page
+ * @return type response
+ */
+ public function deptclose($id) {
+ $dept = Department::where('name', '=', $id)->first();
+ if (Auth::user()->role == 'agent') {
+ if (Auth::user()->primary_dpt == $dept->id) {
+ return view('themes.default1.agent.helpdesk.dept-ticket.closed', compact('id'));
+ } else {
+ return redirect()->back()->with('fails', 'Unauthorised!');
+ }
+ } else {
+ return view('themes.default1.agent.helpdesk.dept-ticket.closed', compact('id'));
+ }
+ }
+
+ /**
+ * Show the deptinprogress ticket list page
+ * @return type response
+ */
+ public function deptinprogress($id) {
+ $dept = Department::where('name', '=', $id)->first();
+ if (Auth::user()->role == 'agent') {
+ if (Auth::user()->primary_dpt == $dept->id) {
+ return view('themes.default1.agent.helpdesk.dept-ticket.inprogress', compact('id'));
+ } else {
+ return redirect()->back()->with('fails', 'Unauthorised!');
+ }
+ } else {
+ return view('themes.default1.agent.helpdesk.dept-ticket.inprogress', compact('id'));
+ }
+ }
+
+ /**
+ * Store ratings of the user
+ * @return type Redirect
+ */
+ public function rating($id, $rating) {
+ Tickets::where('id', $id)->update(array('rating' => $rating));
+ return redirect()->back()->with('Success', 'Thank you for your rating!');
+ }
+
+ /**
+ * Store Client rating about reply of agent quality
+ * @return type Redirect
+ */
+ public function ratingReply($id, $rating) {
+ Tickets::where('id', $id)->update(array('ratingreply' => $rating));
+ return redirect()->back()->with('Success', 'Thank you for your rating!');
+ }
+
+ /**
+ * System default email
+ */
+ public function system_mail() {
+ $email = Email::where('id', '=', '1')->first();
+ return $email->sys_email;
+ }
+
+ /**
+ * checkLock($id)
+ * function to check and lock ticket
+ * @param int $id
+ * @return int
+ */
+ public function checkLock($id) {
+ $ticket = DB::table('tickets')->select('id', 'lock_at', 'lock_by')->where('id', "=", $id)->first();
+ $cad = DB::table('settings_ticket')->select('collision_avoid')->where('id', "=", 1)->first();
+ $cad = $cad->collision_avoid; //collision avoid duration defined in system
+
+ $to_time = strtotime($ticket->lock_at); //last locking time
+
+ $from_time = time(); //user system's cureent time
+ // difference in last locking time and user system's current time
+ $diff = round(abs($to_time - $from_time) / 60, 2);
+
+ if ($diff < $cad && Auth::user()->id != $ticket->lock_by) {
+ return 0; //ticket is locked
+ } elseif ($diff < $cad && Auth::user()->id == $ticket->lock_by) {
+ $ticket = Tickets::where('id', '=', $id)->first();
+ $ticket->lock_at = date('Y-m-d H:i:s');
+ $ticket->save();
+ return 4; //ticket is locked by same user who is requesting access
+ } else {
+ if (Auth::user()->id == $ticket->lock_by) {
+ $ticket = Tickets::where('id', '=', $id)->first();
+ $ticket->lock_at = date('Y-m-d H:i:s');
+ $ticket->save();
+ return 1; //ticket is available and lock ticket for the same user who locked ticket previously
+ } else {
+ $ticket = Tickets::where('id', '=', $id)->first();
+ $ticket->lock_by = Auth::user()->id;
+ $ticket->lock_at = date('Y-m-d H:i:s');
+ $ticket->save(); //ticket is available and lock ticket for new user
+ return 2;
+ }
+ }
+ }
}
diff --git a/app/Http/Controllers/Agent/helpdesk/UserController.php b/app/Http/Controllers/Agent/helpdesk/UserController.php
index 9b4ba6491..f9c9116d1 100644
--- a/app/Http/Controllers/Agent/helpdesk/UserController.php
+++ b/app/Http/Controllers/Agent/helpdesk/UserController.php
@@ -1,7 +1,9 @@
-middleware('auth');
- // checking if role is agent
- $this->middleware('role.agent');
- }
+ /**
+ * Create a new controller instance.
+ * constructor to check
+ * 1. authentication
+ * 2. user roles
+ * 3. roles must be agent
+ * @return void
+ */
+ public function __construct() {
+ // checking authentication
+ $this->middleware('auth');
+ // checking if role is agent
+ $this->middleware('role.agent');
+ }
- /**
- * Display all list of the users.
- * @param type User $user
- * @return type view
- */
- public function index() {
- try {
- /* get all values in Sys_user */
- return view('themes.default1.agent.helpdesk.user.index');
- } catch (Exception $e) {
- return redirect()->back()->with('fails',$e->errorInfo[2]);
- }
- }
+ /**
+ * Display all list of the users.
+ * @param type User $user
+ * @return type view
+ */
+ public function index() {
+ try {
+ /* get all values in Sys_user */
+ return view('themes.default1.agent.helpdesk.user.index');
+ } catch (Exception $e) {
+ return redirect()->back()->with('fails', $e->errorInfo[2]);
+ }
+ }
- /**
- * This function is used to display the list of users using chumper datatables
- * @return datatable
- */
- public function user_list() {
- // displaying list of users with chumper datatables
- return \Datatable::collection(User::where('role','!=','admin')->where('role','!=','agent')->get())
- /* searchable column username */
- ->searchColumns('user_name')
- /* order column username and email */
- ->orderColumns('user_name', 'email')
- /* column username */
- ->addColumn('user_name', function ($model) {
- if(strlen($model->user_name) > 20) {
- $username = substr($model->user_name, 0, 30);
- $username = substr($username, 0, strrpos($username, ' ')).' ...';
- } else {
- $username = $model->user_name;
- }
- return $username;
- })
- /* column email */
- ->addColumn('email', function ($model) {
- $email = $model->email;
- return $email;
- })
- /* column phone */
- ->addColumn('phone', function ($model) {
- $phone = "";
- if($model->phone_number) {
- $phone = $model->ext . ' ' . $model->phone_number;
- }
- $mobile = "";
- if($model->mobile) {
- $mobile = $model->mobile;
- }
- $phone = $phone ." ". $mobile;
- return $phone;
- })
- /* column account status */
- ->addColumn('status', function ($model) {
- $status = $model->active;
- if($status == 1) {
- $stat = '';
- } else {
- $stat = '';
- }
- return $stat;
- })
- /* column ban status */
- ->addColumn('ban', function ($model) {
- $status = $model->ban;
- if($status == 1) {
- $stat = '';
- } else {
- $stat = '';
- }
- return $stat;
- })
- /* column last login date */
- ->addColumn('lastlogin', function ($model) {
- $t = $model->updated_at;
- return TicketController::usertimezone($t);
- })
- /* column actions */
- ->addColumn('Actions', function ($model) {
- return '' . \Lang::get('lang.edit') . '' . \Lang::get('lang.view') . '';
- })
- ->make();
- }
+ /**
+ * This function is used to display the list of users using chumper datatables
+ * @return datatable
+ */
+ public function user_list() {
+ // displaying list of users with chumper datatables
+ return \Datatable::collection(User::where('role', '!=', 'admin')->where('role', '!=', 'agent')->get())
+ /* searchable column username */
+ ->searchColumns('user_name')
+ /* order column username and email */
+ ->orderColumns('user_name', 'email')
+ /* column username */
+ ->addColumn('user_name', function ($model) {
+ if (strlen($model->user_name) > 20) {
+ $username = substr($model->user_name, 0, 30);
+ $username = substr($username, 0, strrpos($username, ' ')) . ' ...';
+ } else {
+ $username = $model->user_name;
+ }
+ return $username;
+ })
+ /* column email */
+ ->addColumn('email', function ($model) {
+ $email = $model->email;
+ return $email;
+ })
+ /* column phone */
+ ->addColumn('phone', function ($model) {
+ $phone = "";
+ if ($model->phone_number) {
+ $phone = $model->ext . ' ' . $model->phone_number;
+ }
+ $mobile = "";
+ if ($model->mobile) {
+ $mobile = $model->mobile;
+ }
+ $phone = $phone . " " . $mobile;
+ return $phone;
+ })
+ /* column account status */
+ ->addColumn('status', function ($model) {
+ $status = $model->active;
+ if ($status == 1) {
+ $stat = '';
+ } else {
+ $stat = '';
+ }
+ return $stat;
+ })
+ /* column ban status */
+ ->addColumn('ban', function ($model) {
+ $status = $model->ban;
+ if ($status == 1) {
+ $stat = '';
+ } else {
+ $stat = '';
+ }
+ return $stat;
+ })
+ /* column last login date */
+ ->addColumn('lastlogin', function ($model) {
+ $t = $model->updated_at;
+ return TicketController::usertimezone($t);
+ })
+ /* column actions */
+ ->addColumn('Actions', function ($model) {
+ return '' . \Lang::get('lang.edit') . '' . \Lang::get('lang.view') . '';
+ })
+ ->make();
+ }
- /**
- * Show the form for creating a new users.
- * @return type view
- */
- public function create() {
- try {
- return view('themes.default1.agent.helpdesk.user.create');
- } catch (Exception $e) {
- return redirect()->back()->with('fails',$e->errorInfo[2]);
- }
- }
+ /**
+ * Show the form for creating a new users.
+ * @return type view
+ */
+ public function create() {
+ try {
+ return view('themes.default1.agent.helpdesk.user.create');
+ } catch (Exception $e) {
+ return redirect()->back()->with('fails', $e->errorInfo[2]);
+ }
+ }
- /**
- * Store a newly created users in storage.
- * @param type User $user
- * @param type Sys_userRequest $request
- * @return type redirect
- */
- public function store(User $user, Sys_userRequest $request) {
- /* insert the input request to sys_user table */
- /* Check whether function success or not */
- $user->email = $request->input('email');
- $user->user_name = $request->input('full_name');
- $user->mobile = $request->input('mobile');
- $user->ext = $request->input('ext');
- $user->phone_number = $request->input('phone_number');
- $user->active = $request->input('active');
- $user->internal_note = $request->input('internal_note');
- $user->role = 'user';
- try {
- $user->save();
- /* redirect to Index page with Success Message */
- return redirect('user')->with('success', 'User Created Successfully');
- } catch (Exception $e) {
- /* redirect to Index page with Fails Message */
- return redirect('user')->with('fails', $e->errorInfo[2]);
- }
- }
+ /**
+ * Store a newly created users in storage.
+ * @param type User $user
+ * @param type Sys_userRequest $request
+ * @return type redirect
+ */
+ public function store(User $user, Sys_userRequest $request) {
+ /* insert the input request to sys_user table */
+ /* Check whether function success or not */
+ $user->email = $request->input('email');
+ $user->user_name = $request->input('full_name');
+ $user->mobile = $request->input('mobile');
+ $user->ext = $request->input('ext');
+ $user->phone_number = $request->input('phone_number');
+ $user->active = $request->input('active');
+ $user->internal_note = $request->input('internal_note');
+ $user->role = 'user';
+ try {
+ $user->save();
+ /* redirect to Index page with Success Message */
+ return redirect('user')->with('success', 'User Created Successfully');
+ } catch (Exception $e) {
+ /* redirect to Index page with Fails Message */
+ return redirect('user')->with('fails', $e->errorInfo[2]);
+ }
+ }
- /**
- * Display the specified users.
- * @param type int $id
- * @param type User $user
- * @return type view
- */
- public function show($id, User $user) {
- try {
- /* select the field where id = $id(request Id) */
- $users = $user->whereId($id)->first();
- return view('themes.default1.agent.helpdesk.user.show', compact('users'));
- } catch (Exception $e) {
- return view('404');
- }
- }
+ /**
+ * Display the specified users.
+ * @param type int $id
+ * @param type User $user
+ * @return type view
+ */
+ public function show($id, User $user) {
+ try {
+ /* select the field where id = $id(request Id) */
+ $users = $user->whereId($id)->first();
+ return view('themes.default1.agent.helpdesk.user.show', compact('users'));
+ } catch (Exception $e) {
+ return view('404');
+ }
+ }
- /**
- * Show the form for editing the specified resource.
- * @param type int $id
- * @param type User $user
- * @return type Response
- */
- public function edit($id, User $user) {
- try {
- /* select the field where id = $id(request Id) */
- $users = $user->whereId($id)->first();
- return view('themes.default1.agent.helpdesk.user.edit', compact('users'));
- } catch (Exception $e) {
- return redirect()->back()->with('fails', $e->errorInfo[2]);
- }
- }
+ /**
+ * Show the form for editing the specified resource.
+ * @param type int $id
+ * @param type User $user
+ * @return type Response
+ */
+ public function edit($id, User $user) {
+ try {
+ /* select the field where id = $id(request Id) */
+ $users = $user->whereId($id)->first();
+ return view('themes.default1.agent.helpdesk.user.edit', compact('users'));
+ } catch (Exception $e) {
+ return redirect()->back()->with('fails', $e->errorInfo[2]);
+ }
+ }
- /**
- * Update the specified user in storage.
- * @param type int $id
- * @param type User $user
- * @param type Sys_userUpdate $request
- * @return type Response
- */
- public function update($id, User $user, Sys_userUpdate $request) {
+ /**
+ * Update the specified user in storage.
+ * @param type int $id
+ * @param type User $user
+ * @param type Sys_userUpdate $request
+ * @return type Response
+ */
+ public function update($id, User $user, Sys_userUpdate $request) {
- /* select the field where id = $id(request Id) */
- $users = $user->whereId($id)->first();
- /* Update the value by selected field */
- /* Check whether function success or not */
- try{
- $users->fill($request->input())->save();
- /* redirect to Index page with Success Message */
- return redirect('user')->with('success', 'User Updated Successfully');
- } catch (Exception $e) {
- /* redirect to Index page with Fails Message */
- return redirect()->back()->with('fails', $e->errorInfo[2]);
- }
- }
+ /* select the field where id = $id(request Id) */
+ $users = $user->whereId($id)->first();
+ /* Update the value by selected field */
+ /* Check whether function success or not */
+ try {
+ $users->fill($request->input())->save();
+ /* redirect to Index page with Success Message */
+ return redirect('user')->with('success', 'User Updated Successfully');
+ } catch (Exception $e) {
+ /* redirect to Index page with Fails Message */
+ return redirect()->back()->with('fails', $e->errorInfo[2]);
+ }
+ }
- /**
- * get agent profile page
- * @return type view
- */
- public function getProfile() {
- $user = Auth::user();
- try {
- return view('themes.default1.agent.helpdesk.user.profile', compact('user'));
- } catch(Exception $e) {
- return redirect()->back()->with('fails',$e->errorInfo[2]);
- }
- }
+ /**
+ * get agent profile page
+ * @return type view
+ */
+ public function getProfile() {
+ $user = Auth::user();
+ try {
+ return view('themes.default1.agent.helpdesk.user.profile', compact('user'));
+ } catch (Exception $e) {
+ return redirect()->back()->with('fails', $e->errorInfo[2]);
+ }
+ }
- /**
- * get profile edit page
- * @return type view
- */
- public function getProfileedit() {
- $user = Auth::user();
- try {
- return view('themes.default1.agent.helpdesk.user.profile-edit', compact('user'));
- } catch (Exception $e) {
- return redirect()->back()->with('fails',$e->errorInfo[2]);
- }
- }
+ /**
+ * get profile edit page
+ * @return type view
+ */
+ public function getProfileedit() {
+ $user = Auth::user();
+ try {
+ return view('themes.default1.agent.helpdesk.user.profile-edit', compact('user'));
+ } catch (Exception $e) {
+ return redirect()->back()->with('fails', $e->errorInfo[2]);
+ }
+ }
- /**
- * post profile edit
- * @param type int $id
- * @param type ProfileRequest $request
- * @return type Redirect
- */
- public function postProfileedit(ProfileRequest $request) {
- // geet authenticated user details
- $user = Auth::user();
- $user->gender = $request->input('gender');
- $user->save();
- // checking availability of agent profile ppicture
- if ($user->profile_pic == 'avatar5.png' || $user->profile_pic == 'avatar2.png') {
- if ($request->input('gender') == 1) {
- $name = 'avatar5.png';
- $destinationPath = 'lb-faveo/media/profilepic';
- $user->profile_pic = $name;
- } elseif ($request->input('gender') == 0) {
- $name = 'avatar2.png';
- $destinationPath = 'lb-faveo/media/profilepic';
- $user->profile_pic = $name;
- }
- }
- // checking if the post system includes agent profile picture upload
- if (Input::file('profile_pic')) {
- // fetching picture name
- $name = Input::file('profile_pic')->getClientOriginalName();
- // fetching upload destination path
- $destinationPath = 'lb-faveo/media/profilepic';
- // adding a random value to profile picture filename
- $fileName = rand(0000, 9999) . '.' . $name;
- // moving the picture to a destination folder
- Input::file('profile_pic')->move($destinationPath, $fileName);
- // saving filename to database
- $user->profile_pic = $fileName;
- } else {
- try{
- $user->fill($request->except('profile_pic', 'gender'))->save();
- return Redirect::route('profile')->with('success', 'Profile Updated sucessfully');
- } catch (Exception $e){
- return Redirect::route('profile')->with('success', $e->errorInfo[2]);
- }
-
- }
- if ($user->fill($request->except('profile_pic'))->save()) {
- return Redirect::route('profile')->with('success', 'Profile Updated sucessfully');
- }
- }
+ /**
+ * post profile edit
+ * @param type int $id
+ * @param type ProfileRequest $request
+ * @return type Redirect
+ */
+ public function postProfileedit(ProfileRequest $request) {
+ // geet authenticated user details
+ $user = Auth::user();
+ $user->gender = $request->input('gender');
+ $user->save();
+ // checking availability of agent profile ppicture
+ if ($user->profile_pic == 'avatar5.png' || $user->profile_pic == 'avatar2.png') {
+ if ($request->input('gender') == 1) {
+ $name = 'avatar5.png';
+ $destinationPath = 'lb-faveo/media/profilepic';
+ $user->profile_pic = $name;
+ } elseif ($request->input('gender') == 0) {
+ $name = 'avatar2.png';
+ $destinationPath = 'lb-faveo/media/profilepic';
+ $user->profile_pic = $name;
+ }
+ }
+ // checking if the post system includes agent profile picture upload
+ if (Input::file('profile_pic')) {
+ // fetching picture name
+ $name = Input::file('profile_pic')->getClientOriginalName();
+ // fetching upload destination path
+ $destinationPath = 'lb-faveo/media/profilepic';
+ // adding a random value to profile picture filename
+ $fileName = rand(0000, 9999) . '.' . $name;
+ // moving the picture to a destination folder
+ Input::file('profile_pic')->move($destinationPath, $fileName);
+ // saving filename to database
+ $user->profile_pic = $fileName;
+ } else {
+ try {
+ $user->fill($request->except('profile_pic', 'gender'))->save();
+ return Redirect::route('profile')->with('success', 'Profile Updated sucessfully');
+ } catch (Exception $e) {
+ return Redirect::route('profile')->with('success', $e->errorInfo[2]);
+ }
+ }
+ if ($user->fill($request->except('profile_pic'))->save()) {
+ return Redirect::route('profile')->with('success', 'Profile Updated sucessfully');
+ }
+ }
- /**
- * Post profile password
- * @param type int $id
- * @param type ProfilePassword $request
- * @return type Redirect
- */
- public function postProfilePassword($id, ProfilePassword $request) {
- // get authenticated user
- $user = Auth::user();
- // checking if the old password matches the new password
- if (Hash::check($request->input('old_password'), $user->getAuthPassword())) {
- $user->password = Hash::make($request->input('new_password'));
- try{
- $user->save();
- return redirect('profile-edit')->with('success1', 'Password Updated sucessfully');
- } catch (Exception $e) {
- return redirect('profile-edit')->with('fails', $e->errorInfo[2]);
- }
- } else {
- return redirect('profile-edit')->with('fails1', 'Password was not Updated. Incorrect old password');
- }
- }
+ /**
+ * Post profile password
+ * @param type int $id
+ * @param type ProfilePassword $request
+ * @return type Redirect
+ */
+ public function postProfilePassword($id, ProfilePassword $request) {
+ // get authenticated user
+ $user = Auth::user();
+ // checking if the old password matches the new password
+ if (Hash::check($request->input('old_password'), $user->getAuthPassword())) {
+ $user->password = Hash::make($request->input('new_password'));
+ try {
+ $user->save();
+ return redirect('profile-edit')->with('success1', 'Password Updated sucessfully');
+ } catch (Exception $e) {
+ return redirect('profile-edit')->with('fails', $e->errorInfo[2]);
+ }
+ } else {
+ return redirect('profile-edit')->with('fails1', 'Password was not Updated. Incorrect old password');
+ }
+ }
- /**
- * Assigning an user to an organization
- * @param type $id
- * @return type boolean
- */
- public function UserAssignOrg($id) {
- $org = Input::get('org');
- $user_org = new User_org;
- $user_org->org_id = $org;
- $user_org->user_id = $id;
- $user_org->save();
- return 1;
- }
+ /**
+ * Assigning an user to an organization
+ * @param type $id
+ * @return type boolean
+ */
+ public function UserAssignOrg($id) {
+ $org = Input::get('org');
+ $user_org = new User_org;
+ $user_org->org_id = $org;
+ $user_org->user_id = $id;
+ $user_org->save();
+ return 1;
+ }
- /**
- * creating an organization in user profile page via modal popup
- * @param type $id
- * @return type
- */
- public function User_Create_Org($id) {
- // checking if the entered value for website is available in database
- if(Input::get('website')!=null) {
- // checking website
- $check = Organization::where('website','=',Input::get('website'))->first();
- } else {
- $check = null;
- }
- // checking if the name is unique
- $check2 = Organization::where('name','=',Input::get('name'))->first();
- // if any of the fields is not available then return false
- if (\Input::get('name') == null) {
- return "Name is required";
- } elseif($check2 != null) {
- return "Name should be Unique";
- } elseif($check != null) {
- return "Website should be Unique";
- } else {
- // storing organization details and assigning the current user to that organization
- $org = new Organization;
- $org->name = Input::get('name');
- $org->phone = Input::get('phone');
- $org->website = Input::get('website');
- $org->address = Input::get('address');
- $org->internal_notes = Input::get('internal');
- $org->save();
+ /**
+ * creating an organization in user profile page via modal popup
+ * @param type $id
+ * @return type
+ */
+ public function User_Create_Org($id) {
+ // checking if the entered value for website is available in database
+ if (Input::get('website') != null) {
+ // checking website
+ $check = Organization::where('website', '=', Input::get('website'))->first();
+ } else {
+ $check = null;
+ }
+ // checking if the name is unique
+ $check2 = Organization::where('name', '=', Input::get('name'))->first();
+ // if any of the fields is not available then return false
+ if (\Input::get('name') == null) {
+ return "Name is required";
+ } elseif ($check2 != null) {
+ return "Name should be Unique";
+ } elseif ($check != null) {
+ return "Website should be Unique";
+ } else {
+ // storing organization details and assigning the current user to that organization
+ $org = new Organization;
+ $org->name = Input::get('name');
+ $org->phone = Input::get('phone');
+ $org->website = Input::get('website');
+ $org->address = Input::get('address');
+ $org->internal_notes = Input::get('internal');
+ $org->save();
- $user_org = new User_org;
- $user_org->org_id = $org->id;
- $user_org->user_id = $id;
- $user_org->save();
- // for success return 0
- return 0;
- }
- }
-}
\ No newline at end of file
+ $user_org = new User_org;
+ $user_org->org_id = $org->id;
+ $user_org->user_id = $id;
+ $user_org->save();
+ // for success return 0
+ return 0;
+ }
+ }
+
+}
diff --git a/app/Http/Controllers/Agent/kb/ArticleController.php b/app/Http/Controllers/Agent/kb/ArticleController.php
index fc4985ebd..2d090a481 100644
--- a/app/Http/Controllers/Agent/kb/ArticleController.php
+++ b/app/Http/Controllers/Agent/kb/ArticleController.php
@@ -1,22 +1,21 @@
-middleware('auth');
- // checking roles
- $this->middleware('roles');
- SettingsController::language();
- }
-
- public function test() {
- //$table = $this->setDatatable();
- return view('themes.default1.agent.kb.article.test');
- }
+ /**
+ * Create a new controller instance.
+ * constructor to check
+ * 1. authentication
+ * 2. user roles
+ * 3. roles must be agent
+ * @return void
+ */
+ public function __construct() {
+ // checking authentication
+ $this->middleware('auth');
+ // checking roles
+ $this->middleware('roles');
+ SettingsController::language();
+ }
- /**
- * Fetching all the list of articles in a chumper datatable format
- * @return type void
- */
- public function getData() {
- // returns chumper datatable
- return Datatable::collection(Article::All())
- /* searcable column name */
- ->searchColumns('name')
- /* order column name and description */
- ->orderColumns('name', 'description')
- /* add column name */
- ->addColumn('name', function ($model) {
- return $model->name;
- })
- /* add column Created */
- ->addColumn('Created', function ($model) {
- $t = $model->created_at;
- return TicketController::usertimezone($t);
- })
- /* add column action */
- ->addColumn('Actions', function ($model) {
- /* here are all the action buttons and modal popup to delete articles with confirmations */
- return ' ' . \Lang::get('lang.delete') . ' id . '/edit class="btn btn-warning btn-xs">' . \Lang::get('lang.edit') . 'slug .' class="btn btn-primary btn-xs">' . \Lang::get('lang.view') . '
-
+ public function test() {
+ //$table = $this->setDatatable();
+ return view('themes.default1.agent.kb.article.test');
+ }
+
+ /**
+ * Fetching all the list of articles in a chumper datatable format
+ * @return type void
+ */
+ public function getData() {
+ // returns chumper datatable
+ return Datatable::collection(Article::All())
+ /* searcable column name */
+ ->searchColumns('name')
+ /* order column name and description */
+ ->orderColumns('name', 'description')
+ /* add column name */
+ ->addColumn('name', function ($model) {
+ return $model->name;
+ })
+ /* add column Created */
+ ->addColumn('Created', function ($model) {
+ $t = $model->created_at;
+ return TicketController::usertimezone($t);
+ })
+ /* add column action */
+ ->addColumn('Actions', function ($model) {
+ /* here are all the action buttons and modal popup to delete articles with confirmations */
+ return ' ' . \Lang::get('lang.delete') . ' id . '/edit class="btn btn-warning btn-xs">' . \Lang::get('lang.edit') . 'slug . ' class="btn btn-primary btn-xs">' . \Lang::get('lang.view') . '
+
@@ -89,188 +88,192 @@ class ArticleController extends Controller {
Are You Sure ?
- '.$model->name.'
+ ' . $model->name . '
';
- })
- ->make();
- }
+ })
+ ->make();
+ }
- /**
- * List of Articles
- * @return type view
- */
- public function index() {
- /* show article list */
- try{
- return view('themes.default1.agent.kb.article.index');
- } catch(Exception $e) {
- return redirect()->back()->with('fails',$e->errorInfo[2]);
- }
- }
+ /**
+ * List of Articles
+ * @return type view
+ */
+ public function index() {
+ /* show article list */
+ try {
+ return view('themes.default1.agent.kb.article.index');
+ } catch (Exception $e) {
+ return redirect()->back()->with('fails', $e->errorInfo[2]);
+ }
+ }
- /**
- * Creating a Article
- * @param type Category $category
- * @return type view
- */
- public function create(Category $category) {
- /* get the attributes of the category */
- $category = $category->lists('id', 'name');
- /* get the create page */
- try{
- return view('themes.default1.agent.kb.article.create', compact('category'));
- } catch(Exception $e) {
- return redirect()->back()->with('fails',$e->errorInfo[2]);
- }
-
- }
+ /**
+ * Creating a Article
+ * @param type Category $category
+ * @return type view
+ */
+ public function create(Category $category) {
+ /* get the attributes of the category */
+ $category = $category->lists('id', 'name');
+ /* get the create page */
+ try {
+ return view('themes.default1.agent.kb.article.create', compact('category'));
+ } catch (Exception $e) {
+ return redirect()->back()->with('fails', $e->errorInfo[2]);
+ }
+ }
- /**
- * Insert the values to the article
- * @param type Article $article
- * @param type ArticleRequest $request
- * @return type redirect
- */
- public function store(Article $article, ArticleRequest $request) {
- // requesting the values to store article data
- $sl = $request->input('slug');
- $slug = str_slug($sl, "-");
- $article->slug = $slug;
- $article->fill($request->except('created_at','slug'))->save();
- // creating article category relationship
- $requests = $request->input('category_id');
- $id = $article->id;
- foreach ($requests as $req) {
- DB::insert('insert into kb_article_relationship (category_id, article_id) values (?,?)', [$req, $id]);
- }
- /* insert the values to the article table */
- try{
- $article->fill($request->except('slug'))->save();
- return redirect('article')->with('success', 'Article Inserted Successfully');
- } catch (Exception $e) {
- return redirect('article')->with('fails', 'Article Not Inserted'. '
'.$e->errorInfo[2].'
');
- }
- }
+ /**
+ * Insert the values to the article
+ * @param type Article $article
+ * @param type ArticleRequest $request
+ * @return type redirect
+ */
+ public function store(Article $article, ArticleRequest $request) {
+ // requesting the values to store article data
+ $publishTime = $request->input('year') . '-' . $request->input('month') . '-' . $request->input('day') . ' ' . $request->input('hour') . ':' . $request->input('minute') . ':00';
- /**
- * Edit an Article by id
- * @param type Integer $id
- * @param type Article $article
- * @param type Relationship $relation
- * @param type Category $category
- * @return view
- */
- public function edit($slug, Article $article, Relationship $relation, Category $category) {
+ $sl = $request->input('slug');
+ $slug = str_slug($sl, "-");
+ $article->slug = $slug;
+ $article->publish_time = $publishTime;
+ $article->fill($request->except('created_at', 'slug'))->save();
+ // creating article category relationship
+ $requests = $request->input('category_id');
+ $id = $article->id;
- $aid = $article->where('id', $slug)->first();
- $id = $aid->id;
+ foreach ($requests as $req) {
+ DB::insert('insert into kb_article_relationship (category_id, article_id) values (?,?)', [$req, $id]);
+ }
+ /* insert the values to the article table */
+ try {
+ $article->fill($request->except('slug'))->save();
+ return redirect('article')->with('success', 'Article Inserted Successfully');
+ } catch (Exception $e) {
+ return redirect('article')->with('fails', 'Article Not Inserted' . '
' . $e->errorInfo[2] . '
');
+ }
+ }
- /* define the selected fields */
- $assign = $relation->where('article_id', $id)->lists('category_id');
- /* get the attributes of the category */
- $category = $category->lists('id', 'name');
- /* get the selected article and display it at edit page */
- /* Get the selected article with id */
- $article = $article->whereId($id)->first();
- /* send to the edit page */
- try {
- return view('themes.default1.agent.kb.article.edit', compact('assign', 'article', 'category'));
- } catch(Exception $e){
- return redirect()->back()->with('fails',$e->errorInfo[2]);
- }
-
- }
+ /**
+ * Edit an Article by id
+ * @param type Integer $id
+ * @param type Article $article
+ * @param type Relationship $relation
+ * @param type Category $category
+ * @return view
+ */
+ public function edit($slug, Article $article, Relationship $relation, Category $category) {
+ $aid = $article->where('id', $slug)->first();
+ $id = $aid->id;
+ /* define the selected fields */
+ $assign = $relation->where('article_id', $id)->lists('category_id');
+ /* get the attributes of the category */
+ $category = $category->lists('id', 'name');
+ /* get the selected article and display it at edit page */
+ /* Get the selected article with id */
+ $article = $article->whereId($id)->first();
+ /* send to the edit page */
+ try {
+ return view('themes.default1.agent.kb.article.edit', compact('assign', 'article', 'category'));
+ } catch (Exception $e) {
+ return redirect()->back()->with('fails', $e->errorInfo[2]);
+ }
+ }
- /**
- * Update an Artile by id
- * @param type Integer $id
- * @param type Article $article
- * @param type Relationship $relation
- * @param type ArticleRequest $request
- * @return Response
- */
- public function update($slug, Article $article, Relationship $relation, ArticleUpdate $request) {
- $aid = $article->where('id', $slug)->first();
- $id = $aid->id;
- $sl = $request->input('slug');
- $slug = str_slug($sl, "-");
- // dd($slug);
- $article->slug = $slug;
- /* get the attribute of relation table where id==$id */
- $relation = $relation->where('article_id', $id);
- $relation->delete();
- /* get the request of the current articles */
- $article = $article->whereId($id)->first();
- $requests = $request->input('category_id');
- $id = $article->id;
- foreach ($requests as $req) {
- DB::insert('insert into article_relationship (category_id, article_id) values (?,?)', [$req, $id]);
- }
- /* update the value to the table */
- try{
- $article->fill($request->all())->save();
- $article->slug = $slug;
- $article->save();
- return redirect('article')->with('success', 'Article Updated Successfully');
- } catch(Exception $e){
- return redirect('article')->with('fails', 'Article Not Updated'.'
'.$e->errorInfo[2].'
');
- }
- }
+ /**
+ * Update an Artile by id
+ * @param type Integer $id
+ * @param type Article $article
+ * @param type Relationship $relation
+ * @param type ArticleRequest $request
+ * @return Response
+ */
+ public function update($slug, Article $article, Relationship $relation, ArticleUpdate $request) {
+ $aid = $article->where('id', $slug)->first();
+ $publishTime = $request->input('year') . '-' . $request->input('month') . '-' . $request->input('day') . ' ' . $request->input('hour') . ':' . $request->input('minute') . ':00';
- /**
- * Delete an Agent by id
- * @param type $id
- * @param type Article $article
- * @return Response
- */
- public function destroy($slug, Article $article, Relationship $relation, Comment $comment) {
- /* delete the selected article from the table */
- $article = $article->where('slug',$slug)->first(); //get the selected article via id
- $id = $article->id;
- $comments = $comment->where('article_id',$id)->get();
- if($comments) {
- foreach($comments as $comment)
- $comment->delete();
+ $id = $aid->id;
+ $sl = $request->input('slug');
+ $slug = str_slug($sl, "-");
+ // dd($slug);
+
+ $article->slug = $slug;
+ /* get the attribute of relation table where id==$id */
+ $relation = $relation->where('article_id', $id);
+ $relation->delete();
+ /* get the request of the current articles */
+ $article = $article->whereId($id)->first();
+ $requests = $request->input('category_id');
+ $id = $article->id;
+ foreach ($requests as $req) {
+ DB::insert('insert into kb_article_relationship (category_id, article_id) values (?,?)', [$req, $id]);
+ }
+ /* update the value to the table */
+ try {
+ $article->fill($request->all())->save();
+ $article->slug = $slug;
+ $article->publish_time = $publishTime;
+ $article->save();
+ return redirect('article')->with('success', 'Article Updated Successfully');
+ } catch (Exception $e) {
+ return redirect('article')->with('fails', 'Article Not Updated' . '
' . $e->errorInfo[2] . '
');
+ }
+ }
+
+ /**
+ * Delete an Agent by id
+ * @param type $id
+ * @param type Article $article
+ * @return Response
+ */
+ public function destroy($slug, Article $article, Relationship $relation, Comment $comment) {
+ /* delete the selected article from the table */
+ $article = $article->where('slug', $slug)->first(); //get the selected article via id
+ $id = $article->id;
+ $comments = $comment->where('article_id', $id)->get();
+ if ($comments) {
+ foreach ($comments as $comment)
+ $comment->delete();
}
// deleting relationship
- $relation = $relation->where('article_id', $id)->first();
- if($relation) {
- $relation->delete();
- }
- if($article) {
- if ($article->delete()) {//true:redirect to index page with success message
- return Redirect::back()->with('success', 'Article Deleted Successfully');
- } else { //redirect to index page with fails message
- return Redirect::back()->with('fails', 'Article Not Deleted');
- }
- } else {
- return Redirect::back()->with('fails', 'Article can Not Deleted');
- }
- }
+ $relation = $relation->where('article_id', $id)->first();
+ if ($relation) {
+ $relation->delete();
+ }
+ if ($article) {
+ if ($article->delete()) {//true:redirect to index page with success message
+ return Redirect::back()->with('success', 'Article Deleted Successfully');
+ } else { //redirect to index page with fails message
+ return Redirect::back()->with('fails', 'Article Not Deleted');
+ }
+ } else {
+ return Redirect::back()->with('fails', 'Article can Not Deleted');
+ }
+ }
- /**
- * user time zone
- * fetching timezone
- * @param type $utc
- * @return type
- */
- static function usertimezone($utc) {
- $user = Auth::user();
- $tz = $user->timezone;
- $set = Settings::whereId('1')->first();
- $format = $set->dateformat;
- //$utc = date('M d Y h:i:s A');
- date_default_timezone_set($tz);
- $offset = date('Z', strtotime($utc));
- $date = date($format, strtotime($utc) + $offset);
- echo $date;
- }
+ /**
+ * user time zone
+ * fetching timezone
+ * @param type $utc
+ * @return type
+ */
+ static function usertimezone($utc) {
+ $user = Auth::user();
+ $tz = $user->timezone;
+ $set = Settings::whereId('1')->first();
+ $format = $set->dateformat;
+ //$utc = date('M d Y h:i:s A');
+ date_default_timezone_set($tz);
+ $offset = date('Z', strtotime($utc));
+ $date = date($format, strtotime($utc) + $offset);
+ echo $date;
+ }
}
diff --git a/app/Http/Controllers/Agent/kb/CategoryController.php b/app/Http/Controllers/Agent/kb/CategoryController.php
index 16558f640..6ed6ee6b8 100644
--- a/app/Http/Controllers/Agent/kb/CategoryController.php
+++ b/app/Http/Controllers/Agent/kb/CategoryController.php
@@ -1,4 +1,6 @@
-middleware('auth');
- // checking roles
- $this->middleware('roles');
- SettingsController::language();
- }
+ /**
+ * Create a new controller instance.
+ * constructor to check
+ * 1. authentication
+ * 2. user roles
+ * 3. roles must be agent
+ * @return void
+ */
+ public function __construct() {
+ // checking authentication
+ $this->middleware('auth');
+ // checking roles
+ $this->middleware('roles');
+ SettingsController::language();
+ }
- /**
- * Indexing all Category
- * @param type Category $category
- * @return Response
- */
- public function index() {
- /* get the view of index of the catogorys with all attributes
- of category model */
- try{
- return view('themes.default1.agent.kb.category.index');
- } catch (Exception $e) {
- return redirect()->back()->with('fails', $e->errorInfo[2]);
- }
- }
+ /**
+ * Indexing all Category
+ * @param type Category $category
+ * @return Response
+ */
+ public function index() {
+ /* get the view of index of the catogorys with all attributes
+ of category model */
+ try {
+ return view('themes.default1.agent.kb.category.index');
+ } catch (Exception $e) {
+ return redirect()->back()->with('fails', $e->errorInfo[2]);
+ }
+ }
- /**
- * fetching category list in chumper datatables
- * @return type chumper datatable
- */
- public function getData() {
- /* fetching chumper datatables */
- return Datatable::collection(Category::All())
- /* search column name */
- ->searchColumns('name')
- /* order column name and description */
- ->orderColumns('name', 'description')
- /* add column name */
- ->addColumn('name', function ($model) {
- return $model->name;
- })
- /* add column Created */
- ->addColumn('Created', function ($model) {
- $t = $model->created_at;
- return TicketController::usertimezone($t);
- })
- /* add column Actions */
- /* there are action buttons and modal popup to delete a data column */
- ->addColumn('Actions', function ($model) {
- return ''. \Lang::get("lang.delete") .'id . '/edit class="btn btn-warning btn-xs">'. \Lang::get("lang.edit") .''. \Lang::get("lang.view") .'
+ /**
+ * fetching category list in chumper datatables
+ * @return type chumper datatable
+ */
+ public function getData() {
+ /* fetching chumper datatables */
+ return Datatable::collection(Category::All())
+ /* search column name */
+ ->searchColumns('name')
+ /* order column name and description */
+ ->orderColumns('name', 'description')
+ /* add column name */
+ ->addColumn('name', function ($model) {
+ return $model->name;
+ })
+ /* add column Created */
+ ->addColumn('Created', function ($model) {
+ $t = $model->created_at;
+ return TicketController::usertimezone($t);
+ })
+ /* add column Actions */
+ /* there are action buttons and modal popup to delete a data column */
+ ->addColumn('Actions', function ($model) {
+ return '' . \Lang::get("lang.delete") . 'id . '/edit class="btn btn-warning btn-xs">' . \Lang::get("lang.edit") . '' . \Lang::get("lang.view") . '
@@ -93,7 +92,7 @@ class CategoryController extends Controller {
Are You Sure ?
- '.$model->name.'
+ ' . $model->name . '
';
- })
- ->make();
+ })
+ ->make();
+ }
- }
+ /**
+ * Create a Category
+ * @param type Category $category
+ * @return type view
+ */
+ public function create(Category $category) {
+ /* Get the all attributes in the category model */
+ $category = $category->get();
+ /* get the view page to create new category with all attributes
+ of category model */
+ try {
+ return view('themes.default1.agent.kb.category.create', compact('category'));
+ } catch (Exception $e) {
+ return redirect()->back()->with('fails', $e->errorInfo[2]);
+ }
+ }
- /**
- * Create a Category
- * @param type Category $category
- * @return type view
- */
- public function create(Category $category) {
- /* Get the all attributes in the category model */
- $category = $category->get();
- /* get the view page to create new category with all attributes
- of category model*/
- try {
- return view('themes.default1.agent.kb.category.create', compact('category'));
- } catch(Exception $e) {
- return redirect()->back()->with('fails',$e->errorInfo[2]);
- }
- }
+ /**
+ * To store the selected category
+ * @param type Category $category
+ * @param type CategoryRequest $request
+ * @return type Redirect
+ */
+ public function store(Category $category, CategoryRequest $request) {
+ /* Get the whole request from the form and insert into table via model */
+ $sl = $request->input('slug');
+ $slug = str_slug($sl, "-");
+ $category->slug = $slug;
+ // send success message to index page
+ try {
+ $category->fill($request->except('slug'))->save();
+ return Redirect::back()->with('success', 'Category Inserted Successfully');
+ } catch (Exception $e) {
+ return Redirect::back()->with('fails', 'Category Not Inserted' . '
' . $e->errorInfo[2] . '
');
+ }
+ }
- /**
- * To store the selected category
- * @param type Category $category
- * @param type CategoryRequest $request
- * @return type Redirect
- */
- public function store(Category $category, CategoryRequest $request) {
- /* Get the whole request from the form and insert into table via model */
- $sl = $request->input('slug');
- $slug = str_slug($sl, "-");
- $category->slug = $slug;
- // send success message to index page
- try{
- $category->fill($request->except('slug'))->save();
- return Redirect::back()->with('success', 'Category Inserted Successfully');
- } catch(Exception $e) {
- return Redirect::back()->with('fails', 'Category Not Inserted'.'
'.$e->errorInfo[2].'
');
- }
- }
+ /**
+ * Show the form for editing the specified category.
+ * @param type $slug
+ * @param type Category $category
+ * @return type view
+ */
+ public function edit($slug, Category $category) {
+ // fetch the category
+ $cid = $category->where('id', $slug)->first();
+ $id = $cid->id;
+ /* get the atributes of the category model whose id == $id */
+ $category = $category->whereId($id)->first();
+ /* get the Edit page the selected category via id */
+ return view('themes.default1.agent.kb.category.edit', compact('category'));
+ }
- /**
- * Show the form for editing the specified category.
- * @param type $slug
- * @param type Category $category
- * @return type view
- */
- public function edit($slug, Category $category) {
- // fetch the category
- $cid = $category->where('id', $slug)->first();
- $id = $cid->id;
- /* get the atributes of the category model whose id == $id */
- $category = $category->whereId($id)->first();
- /* get the Edit page the selected category via id */
- return view('themes.default1.agent.kb.category.edit', compact('category'));
- }
+ /**
+ * Update the specified Category in storage.
+ * @param type $slug
+ * @param type Category $category
+ * @param type CategoryUpdate $request
+ * @return type redirect
+ */
+ public function update($slug, Category $category, CategoryUpdate $request) {
- /**
- * Update the specified Category in storage.
- * @param type $slug
- * @param type Category $category
- * @param type CategoryUpdate $request
- * @return type redirect
- */
- public function update($slug, Category $category, CategoryUpdate $request) {
-
- /* Edit the selected category via id */
- $category = $category->where('id', $slug)->first();
- $sl = $request->input('slug');
- $slug = str_slug($sl, "-");
- // dd($slug);
- $category->slug = $slug;
- /* update the values at the table via model according with the request */
- //redirct to index page with success message
- try{
- $category->fill($request->all())->save();
- $category->slug = $slug;
- $category->save();
- return redirect('category')->with('success', 'Category Updated Successfully');
- } catch(Exception $e) {
- //redirect to index with fails message
- return redirect('category')->with('fails', 'Category Not Updated'.'
'.$e->errorInfo[2].'
');
- }
- }
+ /* Edit the selected category via id */
+ $category = $category->where('id', $slug)->first();
+ $sl = $request->input('slug');
+ $slug = str_slug($sl, "-");
+ // dd($slug);
+ $category->slug = $slug;
+ /* update the values at the table via model according with the request */
+ //redirct to index page with success message
+ try {
+ $category->fill($request->all())->save();
+ $category->slug = $slug;
+ $category->save();
+ return redirect('category')->with('success', 'Category Updated Successfully');
+ } catch (Exception $e) {
+ //redirect to index with fails message
+ return redirect('category')->with('fails', 'Category Not Updated' . '
' . $e->errorInfo[2] . '
');
+ }
+ }
- /**
- * Remove the specified category from storage.
- * @param type $id
- * @param type Category $category
- * @param type Relationship $relation
- * @return type Redirect
- */
- public function destroy($id, Category $category, Relationship $relation) {
+ /**
+ * Remove the specified category from storage.
+ * @param type $id
+ * @param type Category $category
+ * @param type Relationship $relation
+ * @return type Redirect
+ */
+ public function destroy($id, Category $category, Relationship $relation) {
- $relation = $relation->where('category_id', $id)->first();
- if($relation != null){
- return Redirect::back()->with('fails', 'Category Not Deleted');
- }
- else {
- /* delete the category selected, id == $id */
- $category = $category->whereId($id)->first();
- // redirect to index with success message
- try{
- $category->delete();
- return Redirect::back()->with('success', 'Category Deleted Successfully');
- } catch(Exception $e){
- return Redirect::back()->with('fails', 'Category Not Deleted'.'
'.$e->errorInfo[2].'
');
- }
- }
- }
+ $relation = $relation->where('category_id', $id)->first();
+ if ($relation != null) {
+ return Redirect::back()->with('fails', 'Category Not Deleted');
+ } else {
+ /* delete the category selected, id == $id */
+ $category = $category->whereId($id)->first();
+ // redirect to index with success message
+ try {
+ $category->delete();
+ return Redirect::back()->with('success', 'Category Deleted Successfully');
+ } catch (Exception $e) {
+ return Redirect::back()->with('fails', 'Category Not Deleted' . '
' . $e->errorInfo[2] . '
');
+ }
+ }
+ }
}
diff --git a/app/Http/Controllers/Agent/kb/PageController.php b/app/Http/Controllers/Agent/kb/PageController.php
index a6a6b7a0b..1860938c4 100644
--- a/app/Http/Controllers/Agent/kb/PageController.php
+++ b/app/Http/Controllers/Agent/kb/PageController.php
@@ -1,4 +1,6 @@
-middleware('auth');
- // checking roles
- $this->middleware('roles');
- $this->page = $page;
- SettingsController::language();
- }
+ /**
+ * Create a new controller instance.
+ * constructor to check
+ * 1. authentication
+ * 2. user roles
+ * 3. roles must be agent
+ * @return void
+ */
+ public function __construct(Page $page) {
+ // checking authentication
+ $this->middleware('auth');
+ // checking roles
+ $this->middleware('roles');
+ $this->page = $page;
+ SettingsController::language();
+ }
- /**
- * Display the list of pages
- * @return type
- */
- public function index() {
- $pages = $this->page->paginate(3);
- $pages->setPath('page');
- try{
- return view('themes.default1.agent.kb.pages.index', compact('pages'));
- } catch(Exception $e) {
- return redirect()->back()->with('fails',$e->errorInfo[2]);
- }
- }
+ /**
+ * Display the list of pages
+ * @return type
+ */
+ public function index() {
+ $pages = $this->page->paginate(3);
+ $pages->setPath('page');
+ try {
+ return view('themes.default1.agent.kb.pages.index', compact('pages'));
+ } catch (Exception $e) {
+ return redirect()->back()->with('fails', $e->errorInfo[2]);
+ }
+ }
- /**
- * fetching pages list in chumper datatables
- * @return type
- */
- public function getData() {
- /* fetching chumper datatables */
- return Datatable::collection(Page::All())
- /* search column name */
- ->searchColumns('name')
- /* order column name, description and created */
- ->orderColumns('name', 'description', 'created')
- /* add column name */
- ->addColumn('name', function ($model) {
- return $model->name;
- })
- /* add column Created */
- ->addColumn('Created', function ($model) {
- $t = $model->created_at;
- return TicketController::usertimezone($t);
- })
- /* add column Actions */
- /* there are action buttons and modal popup to delete a data column */
- ->addColumn('Actions', function ($model) {
- return ' '. \Lang::get('lang.delete') .'slug . '/edit class="btn btn-warning btn-xs">'. \Lang::get('lang.edit') .'slug . ' class="btn btn-primary btn-xs">'. \Lang::get('lang.view') .'
+ /**
+ * fetching pages list in chumper datatables
+ * @return type
+ */
+ public function getData() {
+ /* fetching chumper datatables */
+ return Datatable::collection(Page::All())
+ /* search column name */
+ ->searchColumns('name')
+ /* order column name, description and created */
+ ->orderColumns('name', 'description', 'created')
+ /* add column name */
+ ->addColumn('name', function ($model) {
+ return $model->name;
+ })
+ /* add column Created */
+ ->addColumn('Created', function ($model) {
+ $t = $model->created_at;
+ return TicketController::usertimezone($t);
+ })
+ /* add column Actions */
+ /* there are action buttons and modal popup to delete a data column */
+ ->addColumn('Actions', function ($model) {
+ return ' ' . \Lang::get('lang.delete') . 'slug . '/edit class="btn btn-warning btn-xs">' . \Lang::get('lang.edit') . 'slug . ' class="btn btn-primary btn-xs">' . \Lang::get('lang.view') . '
@@ -92,7 +91,7 @@ class PageController extends Controller {
Are You Sure ?
- '.$model->name.'
+ ' . $model->name . '
';
- })
- ->make();
- }
+ })
+ ->make();
+ }
- /**
- * Show the form for creating a new resource.
- * @return type view
- */
- public function create() {
- return view('themes.default1.agent.kb.pages.create');
- }
+ /**
+ * Show the form for creating a new resource.
+ * @return type view
+ */
+ public function create() {
+ return view('themes.default1.agent.kb.pages.create');
+ }
- /**
- * To insert a value to the table Page
- * @param type Request $request
- * @return type
- */
- public function store(PageRequest $request) {
- $sl = $request->input('slug');
- $slug = str_slug($sl, "-");
- $this->page->slug = $slug;
- try{
- $this->page->fill($request->except('slug'))->save();
- return redirect('page')->with('success','Page created successfully');
- } catch(Exception $e) {
- return redirect('page')->with('fails',$e->errorInfo[2]);
- }
- }
+ /**
+ * To insert a value to the table Page
+ * @param type Request $request
+ * @return type
+ */
+ public function store(PageRequest $request) {
+ $sl = $request->input('slug');
+ $slug = str_slug($sl, "-");
+ $this->page->slug = $slug;
+ try {
+ $this->page->fill($request->except('slug'))->save();
+ return redirect('page')->with('success', 'Page created successfully');
+ } catch (Exception $e) {
+ return redirect('page')->with('fails', $e->errorInfo[2]);
+ }
+ }
- /**
- * To edit a page
- * @param type $slug
- * @return type view
- */
- public function edit($slug) {
- try{
- $page = $this->page->where('slug', $slug)->first();
- return view('themes.default1.agent.kb.pages.edit', compact('page'));
- } catch (Exception $e) {
- return redirect('page')->with('fails',$e->errorInfo[2]);
- }
- }
+ /**
+ * To edit a page
+ * @param type $slug
+ * @return type view
+ */
+ public function edit($slug) {
+ try {
+ $page = $this->page->where('slug', $slug)->first();
+ return view('themes.default1.agent.kb.pages.edit', compact('page'));
+ } catch (Exception $e) {
+ return redirect('page')->with('fails', $e->errorInfo[2]);
+ }
+ }
- /**
- * To update a page
- * @param type $slug
- * @param type PageUpdate $request
- * @return type redirect
- */
- public function update($slug, PageUpdate $request) {
- // get pages with respect to slug
- $pages = $this->page->where('slug', $slug)->first();
- $sl = $request->input('slug');
- $slug = str_slug($sl, "-");
- $this->page->slug = $slug;
- try{
- $pages->fill($request->all())->save();
- $pages->slug = $slug;
- $pages->save();
- return redirect('page')->with('success', 'Your Page Updated Successfully');
- } catch(Exception $e) {
- return redirect('page')->with('fails', $e->errorInfo[2]);
- }
- }
+ /**
+ * To update a page
+ * @param type $slug
+ * @param type PageUpdate $request
+ * @return type redirect
+ */
+ public function update($slug, PageUpdate $request) {
+ // get pages with respect to slug
+ $pages = $this->page->where('slug', $slug)->first();
+ $sl = $request->input('slug');
+ $slug = str_slug($sl, "-");
+ $this->page->slug = $slug;
+ try {
+ $pages->fill($request->all())->save();
+ $pages->slug = $slug;
+ $pages->save();
+ return redirect('page')->with('success', 'Your Page Updated Successfully');
+ } catch (Exception $e) {
+ return redirect('page')->with('fails', $e->errorInfo[2]);
+ }
+ }
- /**
- * To Delete a Page
- * @param type $id
- * @return type redirect
- */
- public function destroy($id) {
- try{
- // get the page to be deleted
- $page = $this->page->whereId($id)->first();
- $page->delete();
- return redirect('page')->with('success', 'Page Deleted Successfully');
- } catch (Exception $e) {
- return redirect('page')->with('fails', $e->errorInfo[2]);
- }
- }
+ /**
+ * To Delete a Page
+ * @param type $id
+ * @return type redirect
+ */
+ public function destroy($id) {
+ try {
+ // get the page to be deleted
+ $page = $this->page->whereId($id)->first();
+ $page->delete();
+ return redirect('page')->with('success', 'Page Deleted Successfully');
+ } catch (Exception $e) {
+ return redirect('page')->with('fails', $e->errorInfo[2]);
+ }
+ }
-}
\ No newline at end of file
+}
diff --git a/app/Http/Controllers/Agent/kb/SettingsController.php b/app/Http/Controllers/Agent/kb/SettingsController.php
index edd4339d0..ebe813ce3 100644
--- a/app/Http/Controllers/Agent/kb/SettingsController.php
+++ b/app/Http/Controllers/Agent/kb/SettingsController.php
@@ -1,10 +1,11 @@
-middleware('auth');
- // checking roles
- $this->middleware('roles');
- $this->language();
- }
+ /**
+ * Create a new controller instance.
+ * constructor to check
+ * 1. authentication
+ * 2. user roles
+ * 3. roles must be agent
+ * @return void
+ */
+ public function __construct() {
+ // checking authentication
+ $this->middleware('auth');
+ // checking roles
+ $this->middleware('roles');
+ $this->language();
+ }
- /**
- * to get the settings page
- * @return response
- * @package default
- */
- public function settings(Settings $settings, Timezones $time, Date_format $date) {
- /* get the setting where the id == 1 */
- $settings = $settings->whereId('1')->first();
- $time = $time->get();
- //$date = $date->get();
- return view('themes.default1.agent.kb.settings.settings', compact('date', 'settings', 'time'));
- }
+ /**
+ * to get the settings page
+ * @return response
+ * @package default
+ */
+ public function settings(Settings $settings, Timezones $time, Date_format $date) {
+ /* get the setting where the id == 1 */
+ $settings = $settings->whereId('1')->first();
+ $time = $time->get();
+ //$date = $date->get();
+ return view('themes.default1.agent.kb.settings.settings', compact('date', 'settings', 'time'));
+ }
- /**
- * Update the specified resource in storage.
- *
- * @param int $id
- * @return Response
- */
- public function postSettings($id, Settings $settings, SettingsRequests $request) {
- try
- {
- /* fetch the values of company request */
- $settings = $settings->whereId('1')->first();
- if (Input::file('logo')) {
- $name = Input::file('logo')->getClientOriginalName();
- $destinationPath = 'lb-faveo/dist/image';
- $fileName = rand(0000, 9999) . '.' . $name;
- //echo $fileName;
- Input::file('logo')->move($destinationPath, $fileName);
- $settings->logo = $fileName;
- //$thDestinationPath = 'dist/th';
- Image::make($destinationPath . '/' . $fileName, array(
- 'width' => 300,
- 'height' => 300,
- 'grayscale' => false,
- ))->save('lb-faveo/dist/image/' . $fileName);
- }
- if (Input::file('background')) {
- $name = Input::file('background')->getClientOriginalName();
- $destinationPath = 'lb-faveo/dist/image';
- $fileName = rand(0000, 9999) . '.' . $name;
- echo $fileName;
- Input::file('background')->move($destinationPath, $fileName);
- $settings->background = $fileName;
- //$thDestinationPath = 'dist/th';
- Image::make($destinationPath . '/' . $fileName, array(
- 'width' => 300,
- 'height' => 300,
- 'grayscale' => false,
- ))->save('lb-faveo/dist/image/' . $fileName);
- }
- /* Check whether function success or not */
- if ($settings->fill($request->except('logo', 'background'))->save() == true) {
- /* redirect to Index page with Success Message */
- return redirect('settings')->with('success', 'Settings Updated Successfully');
- } else {
- /* redirect to Index page with Fails Message */
- return redirect('settings')->with('fails', 'Settings can not Updated');
- }
- } catch (Exception $e) {
- /* redirect to Index page with Fails Message */
- return redirect('settings')->with('fails', 'Settings can not Updated');
- }
+ /**
+ * Update the specified resource in storage.
+ *
+ * @param int $id
+ * @return Response
+ */
+ public function postSettings($id, Settings $settings, SettingsRequests $request) {
+ try {
+ /* fetch the values of company request */
+ $settings = $settings->whereId('1')->first();
+ if (Input::file('logo')) {
+ $name = Input::file('logo')->getClientOriginalName();
+ $destinationPath = 'lb-faveo/dist/image';
+ $fileName = rand(0000, 9999) . '.' . $name;
+ //echo $fileName;
+ Input::file('logo')->move($destinationPath, $fileName);
+ $settings->logo = $fileName;
+ //$thDestinationPath = 'dist/th';
+ Image::make($destinationPath . '/' . $fileName, array(
+ 'width' => 300,
+ 'height' => 300,
+ 'grayscale' => false,
+ ))->save('lb-faveo/dist/image/' . $fileName);
+ }
+ if (Input::file('background')) {
+ $name = Input::file('background')->getClientOriginalName();
+ $destinationPath = 'lb-faveo/dist/image';
+ $fileName = rand(0000, 9999) . '.' . $name;
+ echo $fileName;
+ Input::file('background')->move($destinationPath, $fileName);
+ $settings->background = $fileName;
+ //$thDestinationPath = 'dist/th';
+ Image::make($destinationPath . '/' . $fileName, array(
+ 'width' => 300,
+ 'height' => 300,
+ 'grayscale' => false,
+ ))->save('lb-faveo/dist/image/' . $fileName);
+ }
+ /* Check whether function success or not */
+ if ($settings->fill($request->except('logo', 'background'))->save() == true) {
+ /* redirect to Index page with Success Message */
+ return redirect('settings')->with('success', 'Settings Updated Successfully');
+ } else {
+ /* redirect to Index page with Fails Message */
+ return redirect('settings')->with('fails', 'Settings can not Updated');
+ }
+ } catch (Exception $e) {
+ /* redirect to Index page with Fails Message */
+ return redirect('settings')->with('fails', 'Settings can not Updated');
+ }
+ }
- }
+ /**
+ * To Moderate the commenting
+ * @param type Comment $comment
+ * @return Response
+ */
+ public function comment(Comment $comment) {
+ return view('themes.default1.agent.kb.settings.comment');
+ }
- /**
- * To Moderate the commenting
- * @param type Comment $comment
- * @return Response
- */
- public function comment(Comment $comment) {
- return view('themes.default1.agent.kb.settings.comment');
- }
+ /**
+ * getdata
+ * @return type
+ */
+ public function getData() {
+ return \Datatable::collection(Comment::All())
+ ->searchColumns('name', 'email', 'comment', 'created')
+ ->orderColumns('name')
+ ->addColumn('name', function ($model) {
+ return $model->name;
+ })
+ ->addColumn('email', function ($model) {
+ return $model->email;
+ })
+ ->addColumn('website', function ($model) {
+ return $model->website;
+ })
+ ->addColumn('comment', function ($model) {
+ return $model->comment;
+ })
+ ->addColumn('status', function ($model) {
+ $status = $model->status;
+ if ($status == 1) {
+ return '
@stop
\ No newline at end of file
diff --git a/resources/views/themes/default1/admin/helpdesk/agent/departments/create.blade.php b/resources/views/themes/default1/admin/helpdesk/agent/departments/create.blade.php
index 6149cffbd..c2b1b3449 100644
--- a/resources/views/themes/default1/admin/helpdesk/agent/departments/create.blade.php
+++ b/resources/views/themes/default1/admin/helpdesk/agent/departments/create.blade.php
@@ -60,10 +60,10 @@ class="active"
Publish the rating system?
-
- Enable Rating System Ratings are available to the users. Select this option if you want to collect feedback from your end users and have the ratings visible to staff too.
-
-
-
-
-
-
-
-
-
-
- Allow modification after first submission
- The value set for this rating can be modified, if enabled.
-
-
-
-
-
-
-
-
-
-
-
-
- {!! Form::close() !!}
-
-
-
-
-
-
-
-
-
-
-
-
Delete
-
-
-
Are you sure you want to Delete ?
-
-
-
-
-
-
-
- @endforeach
-
-
-
-
- @stop
-
\ No newline at end of file
diff --git a/resources/views/themes/default1/admin/helpdesk/settings/system.blade.php b/resources/views/themes/default1/admin/helpdesk/settings/system.blade.php
index 1a5d32dfc..78605a9e3 100644
--- a/resources/views/themes/default1/admin/helpdesk/settings/system.blade.php
+++ b/resources/views/themes/default1/admin/helpdesk/settings/system.blade.php
@@ -71,10 +71,10 @@ class="active"
{!! Form::label('status',Lang::get('lang.status')) !!}