update v1.0.6
This commit is contained in:
2
.env
2
.env
@@ -2,7 +2,7 @@ APP_ENV=local
|
||||
APP_DEBUG=true
|
||||
APP_KEY=SomeRandomString
|
||||
DB_HOST=localhost
|
||||
DB_DATABASE=fav222222
|
||||
DB_DATABASE=faveo1.0.6
|
||||
DB_USERNAME=root
|
||||
DB_PASSWORD=
|
||||
CACHE_DRIVER=file
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<h3>About Faveo</h3>
|
||||
<br><img src="https://travis-ci.org/ladybirdweb/faveo-helpdesk.svg?branch=master"> <img src="https://img.shields.io/badge/License-OSL-blue.svg"> <a href="https://gitter.im/ladybirdweb/faveo-helpdesk" target="_blank"><img src="https://badges.gitter.im/ladybirdweb/faveo-helpdesk.svg"></a></br>
|
||||
<br><img src="https://travis-ci.org/ladybirdweb/faveo-helpdesk.svg?branch=master"> <img src="https://img.shields.io/badge/License-OSL-blue.svg"></br>
|
||||
<p>Headquartered in Bangalore, Faveo HELPDESK provides Businesses with an automated Helpdesk system to manage customer support.
|
||||
<br/><br/>
|
||||
The word Faveo comes from Latin which means to be favourable. Which truly highlights vision and the scope as well as the functionality of the product that Faveo is. It is specifically designed to cater the needs of startups and SME’s empowering them with state of art, ticket based support system. In today’s competitive startup scenario customer retention is one of the major challenges. Handling client query diligently is all the difference between retaining or losing a long lasting relationship. The company is driven with passion of providing tools for managing consumer queries for strategic insights and helping companies take those decisive decisions.
|
||||
|
@@ -1,7 +1,10 @@
|
||||
<?php namespace App\Exceptions;
|
||||
<?php
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Exception;
|
||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||
|
||||
// use App\Http\Controllers\Common\SettingsController;
|
||||
//use App\Model\helpdesk\Email\Smtp;
|
||||
|
||||
@@ -32,8 +35,7 @@ class Handler extends ExceptionHandler {
|
||||
* @param \Exception $e
|
||||
* @return void
|
||||
*/
|
||||
public function report(Exception $e)
|
||||
{
|
||||
public function report(Exception $e) {
|
||||
return parent::report($e);
|
||||
}
|
||||
|
||||
@@ -44,52 +46,48 @@ class Handler extends ExceptionHandler {
|
||||
* @param \Exception $e
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function render($request, Exception $e)
|
||||
{
|
||||
if(config('app.debug') == false) {
|
||||
if ($this->isHttpException($e) && $e->getStatusCode() == 404) {
|
||||
return response()->view('errors.404', []);
|
||||
} else {
|
||||
if(\Config::get('database.install') == 1) {
|
||||
// if(\Config::get('app.ErrorLog') == '%1%') {
|
||||
// \App\Http\Controllers\Common\SettingsController::smtp();
|
||||
// \Mail::send('errors.report', array('e' => $e), function ($message) {
|
||||
// $message->to('', '')->subject('Faveo HELPDESK Pro ERROR');
|
||||
// });
|
||||
// }
|
||||
}
|
||||
return response()->view('errors.500', []);
|
||||
}
|
||||
}
|
||||
return parent::render($request, $e);
|
||||
public function render($request, Exception $e) {
|
||||
|
||||
if ($this->isHttpException($e))
|
||||
{
|
||||
if ($e instanceof \Tymon\JWTAuth\Exceptions\TokenExpiredException) {
|
||||
return response()->json(['message' => $e->getMessage(), 'code' => $e->getStatusCode()]);
|
||||
//dd($e);
|
||||
} else if ($e instanceof \Tymon\JWTAuth\Exceptions\TokenInvalidException) {
|
||||
return response()->json(['message' => $e->getMessage(), 'code' => $e->getStatusCode()]);
|
||||
}
|
||||
|
||||
// if (config('app.debug') == false) {
|
||||
// if ($this->isHttpException($e) && $e->getStatusCode() == 404) {
|
||||
// return response()->view('errors.404', []);
|
||||
// } else {
|
||||
// if (\Config::get('database.install') == 1) {
|
||||
// // if(\Config::get('app.ErrorLog') == '%1%') {
|
||||
// // \App\Http\Controllers\Common\SettingsController::smtp();
|
||||
// // $this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => '', 'email' => ''], $message = ['subject' => '', 'scenario'=>'error-report'], $template_variables = ['e' =>$e ]);
|
||||
// // }
|
||||
// }
|
||||
// return response()->view('errors.500', []);
|
||||
// }
|
||||
// }
|
||||
// return parent::render($request, $e);
|
||||
|
||||
if ($this->isHttpException($e)) {
|
||||
return $this->renderHttpException($e);
|
||||
}
|
||||
|
||||
if (config('app.debug'))
|
||||
{
|
||||
if (config('app.debug')) {
|
||||
return $this->renderExceptionWithWhoops($e);
|
||||
}
|
||||
|
||||
return parent::render($request, $e);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected function renderExceptionWithWhoops(Exception $e)
|
||||
{
|
||||
protected function renderExceptionWithWhoops(Exception $e) {
|
||||
$whoops = new \Whoops\Run;
|
||||
$whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler());
|
||||
|
||||
return new \Illuminate\Http\Response(
|
||||
$whoops->handleException($e),
|
||||
$e->getStatusCode(),
|
||||
$e->getHeaders()
|
||||
$whoops->handleException($e), $e->getStatusCode(), $e->getHeaders()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -1,13 +1,14 @@
|
||||
<?php namespace App\Http\Controllers\Admin\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\helpdesk;
|
||||
|
||||
// controller
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Controllers\Common\SettingsController;
|
||||
|
||||
use App\Http\Controllers\Common\PhpMailController;
|
||||
// request
|
||||
use App\Http\Requests\helpdesk\AgentRequest;
|
||||
use App\Http\Requests\helpdesk\AgentUpdate;
|
||||
|
||||
// model
|
||||
use App\User;
|
||||
use App\Model\helpdesk\Agent\Assign_team_agent;
|
||||
@@ -16,7 +17,8 @@ use App\Model\helpdesk\Agent\Groups;
|
||||
use App\Model\helpdesk\Agent\Teams;
|
||||
use App\Model\helpdesk\Utility\Timezones;
|
||||
use App\Model\helpdesk\Settings\Company;
|
||||
|
||||
use App\Model\helpdesk\Settings\Email;
|
||||
use App\Model\helpdesk\Email\Emails;
|
||||
// classes
|
||||
use DB;
|
||||
use Mail;
|
||||
@@ -33,7 +35,6 @@ use Exception;
|
||||
*/
|
||||
class AgentController extends Controller {
|
||||
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* constructor to check
|
||||
@@ -42,7 +43,8 @@ class AgentController extends Controller {
|
||||
* 3. roles must be agent
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct(PhpMailController $PhpMailController) {
|
||||
$this->PhpMailController = $PhpMailController;
|
||||
SettingsController::smtp();
|
||||
// checking authentication
|
||||
$this->middleware('auth');
|
||||
@@ -81,7 +83,7 @@ class AgentController extends Controller {
|
||||
$teams = $team->lists('id', 'name');
|
||||
return view('themes.default1.admin.helpdesk.agent.agents.create', compact('assign', 'teams', 'agents', 'timezones', 'groups', 'departments', 'team'));
|
||||
} catch (Exception $e) {
|
||||
return redirect()->back()->with('fails',$e->errorInfo[2]);
|
||||
return redirect()->back()->with('fails', $e->errorInfo[2]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,6 +96,8 @@ class AgentController extends Controller {
|
||||
*/
|
||||
public function store(User $user, AgentRequest $request, Assign_team_agent $team_assign_agent) {
|
||||
|
||||
// dd($this->system_mail());
|
||||
|
||||
/* Insert to user table */
|
||||
$user->role = 'agent';
|
||||
$user->fill($request->input())->save();
|
||||
@@ -103,20 +107,18 @@ class AgentController extends Controller {
|
||||
$id = $user->id;
|
||||
// insert team
|
||||
foreach ($requests as $req) {
|
||||
DB::insert('insert into team_assign_agent (team_id, agent_id) values (?,?)', [$req, $id]);
|
||||
// DB::insert('insert into team_assign_agent (team_id, agent_id) values (?,?)', [$req, $id]);
|
||||
}
|
||||
/* Succes And Failure condition */
|
||||
if ($user->save() == true) {
|
||||
$name = $user->user_name;
|
||||
$email = $user->email;
|
||||
$from = $this->company();
|
||||
$system_from = $this->company();
|
||||
try {
|
||||
// send mail on registration
|
||||
try{
|
||||
Mail::send('emails.pass', ['name' => $name, 'password' => $password, 'from' => $from, 'emailadd' => $email], function ($message) use ($email, $name) {
|
||||
$message->to($email, $name)->subject('[password]');
|
||||
});
|
||||
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $name, 'email' => $email], $message = ['subject' => 'Password', 'scenario' => 'registration-notification'], $template_variables = ['user' => $name, 'email_address' => $email, 'user_password' => $password]);
|
||||
} catch (Exception $e) {
|
||||
return redirect('agents')->with('fails', 'Some error occuren while sending mail to the agent. Please check email settings'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
return redirect('agents')->with('fails', 'Some error occured while sending mail to the agent. Please check email settings and try again');
|
||||
}
|
||||
return redirect('agents')->with('success', 'Agent Created sucessfully');
|
||||
} else {
|
||||
@@ -181,7 +183,7 @@ class AgentController extends Controller {
|
||||
$user->fill($request->except('daylight_save', 'limit_access', 'directory_listing', 'vocation_mode', 'assign_team'))->save();
|
||||
return redirect('agents')->with('success', 'Agent Updated sucessfully');
|
||||
} catch (Exception $e) {
|
||||
return redirect('agents')->with('fails', 'Agent did not update'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
return redirect('agents')->with('fails', 'Agent did not update' . '<li>' . $e->errorInfo[2] . '</li>');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -210,7 +212,6 @@ class AgentController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generate a random string for password
|
||||
* @param type $length
|
||||
@@ -231,18 +232,25 @@ class AgentController extends Controller {
|
||||
* @return type
|
||||
*/
|
||||
public function company() {
|
||||
$company = Company::Where('id','=','1')->first();
|
||||
if($company->company_name == null){
|
||||
$company = Company::Where('id', '=', '1')->first();
|
||||
if ($company->company_name == null) {
|
||||
$company = "Support Center";
|
||||
}else{
|
||||
} else {
|
||||
$company = $company->company_name;
|
||||
}
|
||||
return $company;
|
||||
}
|
||||
|
||||
// public function agent_profile($id) {
|
||||
// $agent = User::where('id','=',$id)->first();
|
||||
// return \View::make('themes.default1.admin.helpdesk.agent.agents.agent-profile',compact('agent'));
|
||||
/**
|
||||
* System default email
|
||||
*/
|
||||
// public function system_mail() {
|
||||
// $emails = Emails::all();
|
||||
// $count_emails = $emails->count();
|
||||
// if($count_emails > 1) {
|
||||
// dd($emails);
|
||||
// }
|
||||
// $email = Email::where('id', '=', '1')->first();
|
||||
// return $email->sys_email;
|
||||
// }
|
||||
|
||||
}
|
||||
|
@@ -1,15 +1,15 @@
|
||||
<?php namespace App\Http\Controllers\Admin\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\helpdesk;
|
||||
|
||||
// controller
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
// request
|
||||
use App\Http\Requests\helpdesk\BanlistRequest;
|
||||
use App\Http\Requests\helpdesk\BanRequest;
|
||||
|
||||
// model
|
||||
use App\User;
|
||||
use App\Model\helpdesk\Email\Banlist;
|
||||
|
||||
//classes
|
||||
use Exception;
|
||||
|
||||
@@ -22,7 +22,7 @@ use Exception;
|
||||
*/
|
||||
class BanlistController extends Controller {
|
||||
|
||||
/**
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* constructor to check
|
||||
* 1. authentication
|
||||
@@ -44,7 +44,7 @@ class BanlistController extends Controller {
|
||||
*/
|
||||
public function index() {
|
||||
try {
|
||||
$bans = User::where('ban','=',1)->get();
|
||||
$bans = User::where('ban', '=', 1)->get();
|
||||
return view('themes.default1.admin.helpdesk.emails.banlist.index', compact('bans'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php namespace App\Http\Controllers\Admin\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\helpdesk;
|
||||
|
||||
// controller
|
||||
use App\Http\Controllers\Controller;
|
||||
// request
|
||||
@@ -85,10 +88,10 @@ class DepartmentController extends Controller {
|
||||
*/
|
||||
public function store(Department $department, DepartmentRequest $request) {
|
||||
try {
|
||||
$department->fill($request->except('group_id','manager'))->save();
|
||||
$department->fill($request->except('group_id', 'manager'))->save();
|
||||
$requests = $request->input('group_id');
|
||||
$id = $department->id;
|
||||
if($request->manager) {
|
||||
if ($request->manager) {
|
||||
$department->manager = $request->input('manager');
|
||||
} else {
|
||||
$department->manager = null;
|
||||
@@ -155,14 +158,14 @@ class DepartmentController extends Controller {
|
||||
// }
|
||||
$departments = $department->whereId($id)->first();
|
||||
|
||||
if($request->manager) {
|
||||
if ($request->manager) {
|
||||
$departments->manager = $request->input('manager');
|
||||
} else {
|
||||
$departments->manager = null;
|
||||
}
|
||||
$departments->save();
|
||||
|
||||
if ($departments->fill($request->except('group_access','manager'))->save()) {
|
||||
if ($departments->fill($request->except('group_access', 'manager'))->save()) {
|
||||
return redirect('departments')->with('success', 'Department Updated sucessfully');
|
||||
} else {
|
||||
return redirect('departments')->with('fails', 'Department not Updated');
|
||||
@@ -181,61 +184,60 @@ class DepartmentController extends Controller {
|
||||
*/
|
||||
public function destroy($id, Department $department, Group_assign_department $group_assign_department, System $system, Tickets $tickets) {
|
||||
// try {
|
||||
$system = $system->where('id','=','1')->first();
|
||||
if($system->department == $id) {
|
||||
$system = $system->where('id', '=', '1')->first();
|
||||
if ($system->department == $id) {
|
||||
return redirect('departments')->with('fails', 'You cannot delete default department');
|
||||
} else {
|
||||
$tickets = DB::table('tickets')->where('dept_id','=',$id)->update(['dept_id' => $system->department]);
|
||||
if($tickets > 0){
|
||||
if($tickets > 1){
|
||||
$tickets = DB::table('tickets')->where('dept_id', '=', $id)->update(['dept_id' => $system->department]);
|
||||
if ($tickets > 0) {
|
||||
if ($tickets > 1) {
|
||||
$text_tickets = "Tickets";
|
||||
} else {
|
||||
$text_tickets = "Ticket";
|
||||
}
|
||||
$ticket = '<li>'.$tickets.' '.$text_tickets.' have been moved to default department</li>';
|
||||
$ticket = '<li>' . $tickets . ' ' . $text_tickets . ' have been moved to default department</li>';
|
||||
} else {
|
||||
$ticket = "";
|
||||
}
|
||||
$users = DB::table('users')->where('primary_dpt','=',$id)->update(['primary_dpt' => $system->department]);
|
||||
if($users > 0){
|
||||
if($users > 1){
|
||||
$users = DB::table('users')->where('primary_dpt', '=', $id)->update(['primary_dpt' => $system->department]);
|
||||
if ($users > 0) {
|
||||
if ($users > 1) {
|
||||
$text_user = "Users";
|
||||
} else {
|
||||
$text_user = "User";
|
||||
}
|
||||
$user = '<li>'.$users.' '.$text_user.' have been moved to default department</li>';
|
||||
$user = '<li>' . $users . ' ' . $text_user . ' have been moved to default department</li>';
|
||||
} else {
|
||||
$user = "";
|
||||
}
|
||||
$emails = DB::table('emails')->where('department','=',$id)->update(['department' => $system->department]);
|
||||
if($emails > 0){
|
||||
if($emails > 1){
|
||||
$emails = DB::table('emails')->where('department', '=', $id)->update(['department' => $system->department]);
|
||||
if ($emails > 0) {
|
||||
if ($emails > 1) {
|
||||
$text_emails = "Emails";
|
||||
} else {
|
||||
$text_emails = "Email";
|
||||
}
|
||||
$email = '<li>'.$emails.' System '.$text_emails.' have been moved to default department</li>';
|
||||
$email = '<li>' . $emails . ' System ' . $text_emails . ' have been moved to default department</li>';
|
||||
} else {
|
||||
$email = "";
|
||||
}
|
||||
$helptopic = DB::table('help_topic')->where('department','=',$id)->update(['department' => null],['status' => '1']);
|
||||
if($helptopic > 0){
|
||||
$helptopic = DB::table('help_topic')->where('department', '=', $id)->update(['department' => null], ['status' => '1']);
|
||||
if ($helptopic > 0) {
|
||||
$helptopic = '<li>The associated helptopic has been deactivated</li>';
|
||||
} else {
|
||||
$helptopic = "";
|
||||
}
|
||||
$message = $ticket.$user.$email.$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);
|
||||
return redirect('departments')->with('success', 'Department Deleted sucessfully' . $message);
|
||||
} else {
|
||||
return redirect('departments')->with('fails', 'Department can not Delete');
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php namespace App\Http\Controllers\Admin\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\helpdesk;
|
||||
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
// request
|
||||
@@ -10,6 +13,7 @@ use App\Model\helpdesk\Email\Emails;
|
||||
use App\Model\helpdesk\Manage\Help_topic;
|
||||
use App\Model\helpdesk\Utility\MailboxProtocol;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Priority;
|
||||
use App\Model\helpdesk\Settings\Email;
|
||||
// classes
|
||||
use Crypt;
|
||||
use Exception;
|
||||
@@ -76,8 +80,29 @@ class EmailsController extends Controller {
|
||||
try {
|
||||
$password = $request->input('password');
|
||||
$encrypted = Crypt::encrypt($password);
|
||||
$department = $request->input('department');
|
||||
$priority = $request->input('priority');
|
||||
$help_topic = $request->input('help_topic');
|
||||
|
||||
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;
|
||||
if ($email->fill($request->except('password'))->save() == true) {
|
||||
$email->save();
|
||||
|
||||
return redirect('emails')->with('success', 'Email Created sucessfully');
|
||||
} else {
|
||||
return redirect('emails')->with('fails', 'Email can not Create');
|
||||
@@ -135,8 +160,25 @@ class EmailsController extends Controller {
|
||||
//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->fill($request->except('password'))->save();
|
||||
$emails->save();
|
||||
return redirect('emails')->with('success', 'Email Updated sucessfully');
|
||||
} catch (Exception $e) {
|
||||
return redirect('emails')->with('fails', 'Email not updated');
|
||||
@@ -150,6 +192,12 @@ class EmailsController extends Controller {
|
||||
* @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) {
|
||||
|
@@ -1,16 +1,15 @@
|
||||
<?php namespace App\Http\Controllers\Admin\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\helpdesk;
|
||||
|
||||
// Controller
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
// Model
|
||||
use App\Model\helpdesk\Form\Fields;
|
||||
use App\Model\helpdesk\Form\Forms;
|
||||
use App\Model\helpdesk\Manage\Help_topic;
|
||||
|
||||
// Request
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
// Class
|
||||
use Input;
|
||||
use Redirect;
|
||||
@@ -25,11 +24,11 @@ use Exception;
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class FormController extends Controller {
|
||||
|
||||
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');
|
||||
@@ -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'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -66,7 +65,7 @@ class FormController extends Controller {
|
||||
* @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'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -75,56 +74,50 @@ class FormController extends Controller {
|
||||
* @return Response
|
||||
*/
|
||||
public function store(Forms $forms) {
|
||||
if(!Input::get('formname')) {
|
||||
return Redirect::back()->with('fails','Please fill Form name');
|
||||
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]);
|
||||
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'));
|
||||
$fields = array();
|
||||
for($i=0; $i<=$count; $i++) {
|
||||
if(!empty(Input::get('name')[$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],
|
||||
'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');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php namespace App\Http\Controllers\Admin\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\helpdesk;
|
||||
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
// requests
|
||||
@@ -12,6 +15,7 @@ use App\User;
|
||||
// classes
|
||||
use Illuminate\Support\Facades\Input;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* GroupController
|
||||
*
|
||||
@@ -72,7 +76,7 @@ class GroupController extends Controller {
|
||||
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'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
return redirect('groups')->with('fails', 'Groups can not Create' . '<li>' . $e->errorInfo[2] . '</li>');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +91,7 @@ class GroupController extends Controller {
|
||||
$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'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
return redirect('groups')->with('fails', 'Groups can not Create' . '<li>' . $e->errorInfo[2] . '</li>');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,7 +153,7 @@ class GroupController extends Controller {
|
||||
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'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
return redirect('groups')->with('fails', 'Groups can not Create' . '<li>' . $e->errorInfo[2] . '</li>');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,7 +166,7 @@ class GroupController extends Controller {
|
||||
*/
|
||||
public function destroy($id, Groups $group, Group_assign_department $group_assign_department) {
|
||||
$users = User::where('assign_group', '=', $id)->first();
|
||||
if($users){
|
||||
if ($users) {
|
||||
$user = '<li>There are agents assigned to this group. Please unassign them from this group to delete</li>';
|
||||
return redirect('groups')->with('fails', 'Group cannot Delete ' . $user);
|
||||
}
|
||||
@@ -175,7 +179,8 @@ class GroupController extends Controller {
|
||||
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'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
return redirect('groups')->with('fails', 'Groups cannot Create' . '<li>' . $e->errorInfo[2] . '</li>');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php namespace App\Http\Controllers\Admin\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\helpdesk;
|
||||
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
// requests
|
||||
@@ -74,7 +77,7 @@ class HelptopicController extends Controller {
|
||||
$departments = $department->get();
|
||||
$topics = $topic->get();
|
||||
$forms = $form->get();
|
||||
$agents = $agent->where('role','=','agent')->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'));
|
||||
@@ -91,24 +94,24 @@ class HelptopicController extends Controller {
|
||||
*/
|
||||
public function store(Help_topic $topic, HelptopicRequest $request) {
|
||||
try {
|
||||
if($request->custom_form){
|
||||
if ($request->custom_form) {
|
||||
$custom_form = $request->custom_form;
|
||||
} else {
|
||||
$custom_form = null;
|
||||
}
|
||||
if($request->auto_assign){
|
||||
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();
|
||||
$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'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
return redirect('helptopic')->with('fails', 'Helptopic can not Create' . '<li>' . $e->errorInfo[2] . '</li>');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,7 +128,7 @@ class HelptopicController extends Controller {
|
||||
*/
|
||||
public function edit($id, Ticket_Priority $priority, Department $department, Help_topic $topic, Forms $form, Sla_plan $sla) {
|
||||
try {
|
||||
$agents = User::where('role','=','agent')->get();
|
||||
$agents = User::where('role', '=', 'agent')->get();
|
||||
$departments = $department->get();
|
||||
$topics = $topic->whereId($id)->first();
|
||||
$forms = $form->get();
|
||||
@@ -133,7 +136,7 @@ class HelptopicController extends Controller {
|
||||
$priority = $priority->get();
|
||||
return view('themes.default1.admin.helpdesk.manage.helptopic.edit', compact('priority', 'departments', 'topics', 'forms', 'agents', 'slas'));
|
||||
} catch (Exception $e) {
|
||||
return redirect('helptopic')->with('fails', '<li>'.$e->errorInfo[2].'</li>');
|
||||
return redirect('helptopic')->with('fails', '<li>' . $e->errorInfo[2] . '</li>');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,18 +151,18 @@ class HelptopicController extends Controller {
|
||||
// dd($request);
|
||||
try {
|
||||
$topics = $topic->whereId($id)->first();
|
||||
if($request->custom_form){
|
||||
if ($request->custom_form) {
|
||||
$custom_form = $request->custom_form;
|
||||
} else {
|
||||
$custom_form = null;
|
||||
}
|
||||
if($request->auto_assign){
|
||||
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->fill($request->except('custom_form', 'auto_assign'))->save();
|
||||
$topics->custom_form = $custom_form;
|
||||
$topics->auto_assign = $auto_assign;
|
||||
$topics->save();
|
||||
@@ -167,7 +170,7 @@ class HelptopicController extends Controller {
|
||||
return redirect('helptopic')->with('success', 'Helptopic Updated Successfully');
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('helptopic')->with('fails', 'Helptopic can not Update'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
return redirect('helptopic')->with('fails', 'Helptopic can not Update' . '<li>' . $e->errorInfo[2] . '</li>');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,49 +181,50 @@ class HelptopicController extends Controller {
|
||||
* @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) {
|
||||
$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){
|
||||
if ($tickets > 0) {
|
||||
if ($tickets > 1) {
|
||||
$text_tickets = "Tickets";
|
||||
} else {
|
||||
$text_tickets = "Ticket";
|
||||
}
|
||||
$ticket = '<li>'.$tickets.' '.$text_tickets.' have been moved to default Help Topic</li>';
|
||||
$ticket = '<li>' . $tickets . ' ' . $text_tickets . ' have been moved to default Help Topic</li>';
|
||||
} else {
|
||||
$ticket = "";
|
||||
}
|
||||
|
||||
$emails = DB::table('emails')->where('help_topic','=',$id)->update(['help_topic' => $ticket_settings->help_topic]);
|
||||
$emails = DB::table('emails')->where('help_topic', '=', $id)->update(['help_topic' => $ticket_settings->help_topic]);
|
||||
|
||||
if($emails > 0){
|
||||
if($emails > 1){
|
||||
if ($emails > 0) {
|
||||
if ($emails > 1) {
|
||||
$text_emails = "Emails";
|
||||
} else {
|
||||
$text_emails = "Email";
|
||||
}
|
||||
$email = '<li>'.$emails.' System '.$text_emails.' have been moved to default Help Topic</li>';
|
||||
$email = '<li>' . $emails . ' System ' . $text_emails . ' have been moved to default Help Topic</li>';
|
||||
} else {
|
||||
$email = "";
|
||||
}
|
||||
|
||||
$message = $ticket.$email;
|
||||
$message = $ticket . $email;
|
||||
|
||||
$topics = $topic->whereId($id)->first();
|
||||
/* Check whether function success or not */
|
||||
try{
|
||||
try {
|
||||
$topics->delete();
|
||||
/* redirect to Index page with Success Message */
|
||||
return redirect('helptopic')->with('success', 'Helptopic Deleted Successfully'.$message);
|
||||
return redirect('helptopic')->with('success', 'Helptopic Deleted Successfully' . $message);
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('helptopic')->with('fails', 'Helptopic can not Delete'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
return redirect('helptopic')->with('fails', 'Helptopic can not Delete' . '<li>' . $e->errorInfo[2] . '</li>');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,4 +1,6 @@
|
||||
<?php namespace App\Http\Controllers\Admin\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\helpdesk;
|
||||
|
||||
/**
|
||||
* -----------------------------------------------
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php namespace App\Http\Controllers\Admin\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\helpdesk;
|
||||
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
// requests
|
||||
@@ -48,8 +51,8 @@ class LanguageController extends Controller {
|
||||
// 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))) {
|
||||
$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);
|
||||
|
||||
@@ -62,67 +65,59 @@ class LanguageController extends Controller {
|
||||
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('language', function($model) {
|
||||
return Config::get('languages.' . $model);
|
||||
})
|
||||
|
||||
->addColumn('id', function($model){
|
||||
->addColumn('id', function($model) {
|
||||
return $model;
|
||||
})
|
||||
|
||||
->addColumn('status',function($model){
|
||||
if(Lang::getLocale()===$model){return "<span style='color:green'>".Lang::trans("lang.active")."</span>"; } else return "<span style='color:red'>".Lang::trans("lang.inactive")."</span>";
|
||||
->addColumn('status', function($model) {
|
||||
if (Lang::getLocale() === $model) {
|
||||
return "<span style='color:green'>" . Lang::trans("lang.active") . "</span>";
|
||||
} else
|
||||
return "<span style='color:red'>" . Lang::trans("lang.inactive") . "</span>";
|
||||
})
|
||||
|
||||
->addColumn('Action', function($model){
|
||||
if(Lang::getLocale()===$model){
|
||||
return "<a href='change-language/".$model."'><input type='button' class='btn btn-info btn-xs btn-flat' disabled value='". Lang::trans("lang.disable")."'/></a>
|
||||
<a href='change-language/".$model."' class='btn btn-danger btn-xs btn-flat' disabled><i class='fa fa-trash' style='color:black;'> </i> ". Lang::trans("lang.delete")."</a>";
|
||||
->addColumn('Action', function($model) {
|
||||
if (Lang::getLocale() === $model) {
|
||||
return "<a href='change-language/" . $model . "'><input type='button' class='btn btn-info btn-xs btn-flat' disabled value='" . Lang::trans("lang.disable") . "'/></a>
|
||||
<a href='change-language/" . $model . "' class='btn btn-danger btn-xs btn-flat' disabled><i class='fa fa-trash' style='color:black;'> </i> " . Lang::trans("lang.delete") . "</a>";
|
||||
} else {
|
||||
return "<a href='change-language/".$model."'><input type='button' class='btn btn-info btn-xs btn-flat' value='". Lang::trans("lang.enable")."'/></a>
|
||||
<a href='delete-language/".$model."' class='btn btn-danger btn-xs btn-flat'><i class='fa fa-trash' style='color:black;'> </i> ". Lang::trans("lang.delete")."</a>";
|
||||
return "<a href='change-language/" . $model . "'><input type='button' class='btn btn-info btn-xs btn-flat' value='" . Lang::trans("lang.enable") . "'/></a>
|
||||
<a href='delete-language/" . $model . "' class='btn btn-danger btn-xs btn-flat'><i class='fa fa-trash' style='color:black;'> </i> " . Lang::trans("lang.delete") . "</a>";
|
||||
}
|
||||
})
|
||||
->searchColumns('language','id')
|
||||
|
||||
->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
|
||||
@@ -138,14 +133,12 @@ class LanguageController extends Controller {
|
||||
'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 {
|
||||
|
||||
|
||||
@@ -155,43 +148,39 @@ class LanguageController extends Controller {
|
||||
|
||||
//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");
|
||||
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')));
|
||||
Session::flash('link', "change-language/" . strtolower(Input::get('iso-code')));
|
||||
return Redirect::route('LanguageController');
|
||||
}
|
||||
} else {
|
||||
@@ -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,11 +205,11 @@ 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();
|
||||
@@ -235,4 +224,5 @@ class LanguageController extends Controller {
|
||||
return redirect('languages');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php namespace App\Http\Controllers\Admin\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\helpdesk;
|
||||
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
// requests
|
||||
@@ -120,4 +123,5 @@ class ProfileController extends Controller {
|
||||
return redirect('guest')->with('fails', 'Password was not Updated');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php namespace App\Http\Controllers\Admin\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\helpdesk;
|
||||
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
// requests
|
||||
@@ -27,7 +30,6 @@ use App\Model\helpdesk\Utility\Time_format;
|
||||
use Illuminate\Http\Request;
|
||||
use Input;
|
||||
use Exception;
|
||||
use DB;
|
||||
|
||||
/**
|
||||
* SettingsController
|
||||
@@ -55,25 +57,7 @@ class SettingsController extends Controller {
|
||||
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
|
||||
@@ -88,7 +72,7 @@ public function RatingSettings() {
|
||||
/* 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 redirect()->back()->with('fails', $e->errorInfo[2]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,7 +93,7 @@ public function RatingSettings() {
|
||||
Input::file('logo')->move($destinationPath, $fileName);
|
||||
$companys->logo = $fileName;
|
||||
}
|
||||
if($request->input('use_logo')==null) {
|
||||
if ($request->input('use_logo') == null) {
|
||||
$companys->use_logo = '0';
|
||||
}
|
||||
/* Check whether function success or not */
|
||||
@@ -119,7 +103,7 @@ public function RatingSettings() {
|
||||
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'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
return redirect('getcompany')->with('fails', 'Company can not Updated' . '<li>' . $e->errorInfo[2] . '</li>');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,7 +128,7 @@ public function RatingSettings() {
|
||||
/* 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]);
|
||||
return redirect()->back()->with('fails', $e->errorInfo[2]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,7 +151,7 @@ public function RatingSettings() {
|
||||
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'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
return redirect('getsystem')->with('fails', 'System can not Updated' . '<li>' . $e->errorInfo[2] . '</li>');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,7 +174,7 @@ public function RatingSettings() {
|
||||
/* 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]);
|
||||
return redirect()->back()->with('fails', $e->errorInfo[2]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -215,13 +199,14 @@ public function RatingSettings() {
|
||||
$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'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
return redirect('getticket')->with('fails', 'Ticket can not Updated' . '<li>' . $e->errorInfo[2] . '</li>');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -243,7 +228,7 @@ public function RatingSettings() {
|
||||
/* 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]);
|
||||
return redirect()->back()->with('fails', $e->errorInfo[2]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -273,7 +258,7 @@ public function RatingSettings() {
|
||||
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'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
return redirect('getemail')->with('fails', 'Email can not Updated' . '<li>' . $e->errorInfo[2] . '</li>');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -336,7 +321,7 @@ public function RatingSettings() {
|
||||
/* 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]);
|
||||
return redirect()->back()->with('fails', $e->errorInfo[2]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -363,7 +348,7 @@ public function RatingSettings() {
|
||||
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'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
return redirect('getresponder')->with('fails', 'Responder can not Updated' . '<li>' . $e->errorInfo[2] . '</li>');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -379,7 +364,7 @@ public function RatingSettings() {
|
||||
/* 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]);
|
||||
return redirect()->back()->with('fails', $e->errorInfo[2]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -425,7 +410,7 @@ public function RatingSettings() {
|
||||
$alerts->ticket_department_member = $request->input('ticket_department_member');
|
||||
$alerts->ticket_admin_email = $request->input('ticket_admin_email');
|
||||
|
||||
if($request->input('system_error') == null){
|
||||
if ($request->input('system_error') == null) {
|
||||
$str = '%0%';
|
||||
$path = app_path('../config/app.php');
|
||||
$content = \File::get($path);
|
||||
@@ -445,8 +430,38 @@ public function RatingSettings() {
|
||||
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'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
return redirect('getalert')->with('fails', 'Alert can not Updated' . '<li>' . $e->errorInfo[2] . '</li>');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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');
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,16 +1,15 @@
|
||||
<?php namespace App\Http\Controllers\Admin\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\helpdesk;
|
||||
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
// requests
|
||||
use App\Http\Requests\helpdesk\SlaRequest;
|
||||
use App\Http\Requests\helpdesk\SlaUpdate;
|
||||
|
||||
// models
|
||||
use App\Model\helpdesk\Manage\Sla_plan;
|
||||
use App\Model\helpdesk\Settings\Ticket;
|
||||
|
||||
//classes
|
||||
use DB;
|
||||
use Exception;
|
||||
@@ -45,7 +44,7 @@ class SlaController extends Controller {
|
||||
/* 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]);
|
||||
return redirect()->back()->with('fails', $e->errorInfo[2]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +57,7 @@ class SlaController extends Controller {
|
||||
/* Direct to Create Page */
|
||||
return view('themes.default1.admin.helpdesk.manage.sla.create');
|
||||
} catch (Exception $e) {
|
||||
return redirect()->back()->with('fails',$e->errorInfo[2]);
|
||||
return redirect()->back()->with('fails', $e->errorInfo[2]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +76,7 @@ class SlaController extends Controller {
|
||||
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'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
return redirect('sla')->with('fails', 'SLA Plan can not Create' . '<li>' . $e->errorInfo[2] . '</li>');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,7 +93,7 @@ class SlaController extends Controller {
|
||||
$slas->get();
|
||||
return view('themes.default1.admin.helpdesk.manage.sla.edit', compact('slas'));
|
||||
} catch (Exception $e) {
|
||||
return redirect()->back()->with('fails',$e->errorInfo[2]);
|
||||
return redirect()->back()->with('fails', $e->errorInfo[2]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,7 +119,7 @@ class SlaController extends Controller {
|
||||
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'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
return redirect('sla')->with('fails', 'SLA Plan can not Update' . '<li>' . $e->errorInfo[2] . '</li>');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,24 +130,24 @@ class SlaController extends Controller {
|
||||
* @return type Response
|
||||
*/
|
||||
public function destroy($id, Sla_plan $sla) {
|
||||
$default_sla = Ticket::where('id','=','1')->first();
|
||||
if($default_sla->sla == $id) {
|
||||
$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) {
|
||||
$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 = '<li>'.$tickets.' '.$text_tickets.' have been moved to default SLA</li>';
|
||||
$ticket = '<li>' . $tickets . ' ' . $text_tickets . ' have been moved to default SLA</li>';
|
||||
} else {
|
||||
$ticket = "";
|
||||
}
|
||||
$dept = DB::table('department')->where('sla','=',$id)->update(['sla' => $default_sla->sla]);
|
||||
if($dept > 0){
|
||||
if($dept > 1){
|
||||
$dept = DB::table('department')->where('sla', '=', $id)->update(['sla' => $default_sla->sla]);
|
||||
if ($dept > 0) {
|
||||
if ($dept > 1) {
|
||||
$text_dept = "Emails";
|
||||
} else {
|
||||
$text_dept = "Email";
|
||||
@@ -157,9 +156,9 @@ class SlaController extends Controller {
|
||||
} else {
|
||||
$dept = "";
|
||||
}
|
||||
$topic = DB::table('help_topic')->where('sla_plan','=',$id)->update(['sla_plan' => $default_sla->sla]);
|
||||
if($topic > 0){
|
||||
if($topic > 1){
|
||||
$topic = DB::table('help_topic')->where('sla_plan', '=', $id)->update(['sla_plan' => $default_sla->sla]);
|
||||
if ($topic > 0) {
|
||||
if ($topic > 1) {
|
||||
$text_topic = "Emails";
|
||||
} else {
|
||||
$text_topic = "Email";
|
||||
@@ -168,17 +167,17 @@ class SlaController extends Controller {
|
||||
} else {
|
||||
$topic = "";
|
||||
}
|
||||
$message = $ticket.$dept.$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{
|
||||
try {
|
||||
$slas->delete();
|
||||
/* redirect to Index page with Success Message */
|
||||
return redirect('sla')->with('success', 'SLA Plan Deleted Successfully'.$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'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
return redirect('sla')->with('fails', 'SLA Plan can not Delete' . '<li>' . $e->errorInfo[2] . '</li>');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,17 +1,16 @@
|
||||
<?php namespace App\Http\Controllers\Admin\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\helpdesk;
|
||||
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
// requests
|
||||
use App\Http\Requests\helpdesk\TeamRequest;
|
||||
use App\Http\Requests\helpdesk\TeamUpdate;
|
||||
|
||||
// models
|
||||
use App\Model\helpdesk\Agent\Assign_team_agent;
|
||||
use App\Model\helpdesk\Agent\Teams;
|
||||
use App\User;
|
||||
|
||||
// classes
|
||||
use DB;
|
||||
use Exception;
|
||||
@@ -48,7 +47,7 @@ class TeamController extends Controller {
|
||||
$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]);
|
||||
return redirect()->back()->with('fails', $e->errorInfo[2]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +61,7 @@ class TeamController extends Controller {
|
||||
$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]);
|
||||
return redirect()->back()->with('fails', $e->errorInfo[2]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +73,7 @@ class TeamController extends Controller {
|
||||
*/
|
||||
public function store(Teams $team, TeamRequest $request) {
|
||||
|
||||
if($request->team_lead){
|
||||
if ($request->team_lead) {
|
||||
$team_lead = $request->team_lead;
|
||||
} else {
|
||||
$team_lead = null;
|
||||
@@ -87,7 +86,7 @@ class TeamController extends Controller {
|
||||
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'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
return redirect('teams')->with('fails', 'Teams can not Create' . '<li>' . $e->errorInfo[2] . '</li>');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,7 +106,7 @@ class TeamController extends Controller {
|
||||
$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]);
|
||||
return redirect()->back()->with('fails', $e->errorInfo[2]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,7 +121,7 @@ class TeamController extends Controller {
|
||||
|
||||
$teams = $team->whereId($id)->first();
|
||||
//updating check box
|
||||
if($request->team_lead){
|
||||
if ($request->team_lead) {
|
||||
$team_lead = $request->team_lead;
|
||||
} else {
|
||||
$team_lead = null;
|
||||
@@ -141,7 +140,7 @@ class TeamController extends Controller {
|
||||
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'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
return redirect('teams')->with('fails', 'Teams can not Update' . '<li>' . $e->errorInfo[2] . '</li>');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,14 +155,15 @@ class TeamController extends Controller {
|
||||
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]);
|
||||
$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'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
return redirect('teams')->with('fails', 'Teams can not Delete' . '<li>' . $e->errorInfo[2] . '</li>');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,7 +1,11 @@
|
||||
<?php namespace App\Http\Controllers\Admin\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\helpdesk;
|
||||
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Controllers\Common\SettingsController;
|
||||
use App\Http\Controllers\Common\PhpMailController;
|
||||
// requests
|
||||
use App\Http\Requests\helpdesk\TemplateRequest;
|
||||
use App\Http\Requests\helpdesk\TemplateUdate;
|
||||
@@ -28,7 +32,8 @@ class TemplateController extends Controller {
|
||||
* Create a new controller instance.
|
||||
* @return type void
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct(PhpMailController $PhpMailController) {
|
||||
$this->PhpMailController = $PhpMailController;
|
||||
SettingsController::smtp();
|
||||
$this->middleware('auth');
|
||||
$this->middleware('roles');
|
||||
@@ -102,33 +107,35 @@ class TemplateController extends Controller {
|
||||
* @param type Languages $language
|
||||
* @return type Response
|
||||
*/
|
||||
public function listtemplates() {
|
||||
public function listdirectories() {
|
||||
$path = '../resources/views/emails/';
|
||||
|
||||
$templates = scandir($path);
|
||||
$directories = scandir($path);
|
||||
$directory = str_replace('/', '-', $path);
|
||||
return view('themes.default1.admin.helpdesk.emails.template.listtemplates', compact('templates','directory'));
|
||||
return view('themes.default1.admin.helpdesk.emails.template.listdirectories', compact('directories', 'directory'));
|
||||
}
|
||||
|
||||
public function readtemplate($template,$path) {
|
||||
$directory = str_replace('-', '/', $path);
|
||||
$directory2 = $directory.$template;
|
||||
if (is_dir($directory2)) {
|
||||
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'));
|
||||
$directory = str_replace('/', '-', $directory2 . '/');
|
||||
return view('themes.default1.admin.helpdesk.emails.template.listtemplates', compact('templates', 'directory'));
|
||||
}
|
||||
else {
|
||||
$handle = fopen($directory.$template, "r");
|
||||
$contents = fread($handle, filesize($directory.$template));
|
||||
|
||||
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'));
|
||||
}
|
||||
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;
|
||||
$filename = $directory . $fname;
|
||||
|
||||
// images folder creation using php
|
||||
// $mydir = dirname( __FILE__ )."/html/images";
|
||||
@@ -137,30 +144,58 @@ class TemplateController extends Controller {
|
||||
// }
|
||||
// Move all images files
|
||||
|
||||
if(!file_exists($filename)) {
|
||||
mkdir($filename,0777);
|
||||
}
|
||||
$files = array_filter(scandir($directory.'default'));
|
||||
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)) {
|
||||
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.'/';
|
||||
$destination = $directory . $fname . '/';
|
||||
|
||||
copy($directory.'default/'.$file, $destination.$file);
|
||||
copy($directory . 'default/' . $file, $destination . $file);
|
||||
}
|
||||
}
|
||||
return \Redirect::back()->with('success', 'Successfully copied');
|
||||
}
|
||||
public function writetemplate($template,$path) {
|
||||
|
||||
public function writetemplate($template, $path) {
|
||||
$directory = str_replace('-', '/', $path);
|
||||
$b = Input::get('templatedata');
|
||||
|
||||
file_put_contents($directory.$template, print_r($b, true));
|
||||
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();
|
||||
@@ -240,13 +275,12 @@ $files = array_filter(scandir($directory.'default'));
|
||||
*/
|
||||
public function postDiagno(Request $request) {
|
||||
$email = $request->input('to');
|
||||
if($email == null)
|
||||
{
|
||||
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');
|
||||
});
|
||||
// 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');
|
||||
}
|
||||
|
||||
|
@@ -1,14 +1,15 @@
|
||||
<?php namespace App\Http\Controllers\Admin\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\helpdesk;
|
||||
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
// models
|
||||
use App\Model\helpdesk\Priority;
|
||||
use App\Model\helpdesk\Ticket_thread;
|
||||
|
||||
// classes
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* ThreadController
|
||||
*
|
||||
@@ -36,4 +37,5 @@ class ThreadController extends Controller {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,92 +0,0 @@
|
||||
<?php namespace App\Http\Controllers\Agent\helpdesk;
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
// models
|
||||
use App\Model\helpdesk\Settings\Company;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Collaborator;
|
||||
use App\Model\helpdesk\Email\Emails;
|
||||
use App\User;
|
||||
// classes
|
||||
use DB;
|
||||
use View;
|
||||
use Auth;
|
||||
|
||||
/**
|
||||
* DashboardController
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
@@ -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')
|
||||
|
||||
<div class="box box-info">
|
||||
|
||||
<?php
|
||||
|
||||
// $tickets = App\Model\Ticket\Tickets::where('created_at','>=',date('Y-m-d'))->get();
|
||||
|
||||
// echo count($tickets);
|
||||
|
||||
?>
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">{!! Lang::get('lang.line_chart') !!}</h3>
|
||||
<div class="box-tools pull-right">
|
||||
<button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
|
||||
<button class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<div class="chart" >
|
||||
<div id="legendDiv"></div>
|
||||
<canvas class="chart-data" id="tickets-graph" width="1000" height="400"></canvas>
|
||||
</div>
|
||||
</div><!-- /.box-body -->
|
||||
</div><!-- /.box -->
|
||||
<hr/>
|
||||
<div class="box">
|
||||
<div class="box-header">
|
||||
<h1>{!! Lang::get('lang.statistics') !!}</h1>
|
||||
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<table class="table table-hover" style="overflow:hidden;">
|
||||
|
||||
<tr>
|
||||
<th>{!! Lang::get('lang.department') !!}</th>
|
||||
<th>{!! Lang::get('lang.opened') !!}</th>
|
||||
<th>{!! Lang::get('lang.resolved') !!}</th>
|
||||
<th>{!! Lang::get('lang.closed') !!}</th>
|
||||
<th>{!! Lang::get('lang.deleted') !!}</th>
|
||||
</tr>
|
||||
|
||||
<?php $departments = App\Model\helpdesk\Agent\Department::all(); ?>
|
||||
@foreach($departments as $department)
|
||||
<?php
|
||||
$open = App\Model\helpdesk\Ticket\Tickets::where('dept_id','=',$department->id)->where('status','=',1)->count();
|
||||
$resolve = App\Model\helpdesk\Ticket\Tickets::where('dept_id','=',$department->id)->where('status','=',2)->count();
|
||||
$close = App\Model\helpdesk\Ticket\Tickets::where('dept_id','=',$department->id)->where('status','=',3)->count();
|
||||
$delete = App\Model\helpdesk\Ticket\Tickets::where('dept_id','=',$department->id)->where('status','=',5)->count();
|
||||
|
||||
?>
|
||||
|
||||
<tr>
|
||||
|
||||
<td>{!! $department->name !!}</td>
|
||||
<td>{!! $open !!}</td>
|
||||
<td>{!! $resolve !!}</td>
|
||||
<td>{!! $close !!}</td>
|
||||
<td>{!! $delete !!}</td>
|
||||
|
||||
</tr>
|
||||
@endforeach
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="{{asset("lb-faveo/plugins/chartjs/Chart.min.js")}}" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$.getJSON("agen", function (result) {
|
||||
|
||||
var labels = [],data=[],data2=[],data3=[],data4=[];
|
||||
for (var i = 0; i < result.length; i++) {
|
||||
|
||||
$var12 = result[i].month;
|
||||
if($var12 == 1){
|
||||
$var13 = "January";
|
||||
}
|
||||
if($var12 == 2){
|
||||
$var13 = "Febuary";
|
||||
}
|
||||
if($var12 == 3){
|
||||
$var13 = "March";
|
||||
}
|
||||
if($var12 == 4){
|
||||
$var13 = "April";
|
||||
}
|
||||
if($var12 == 5){
|
||||
$var13 = "May";
|
||||
}
|
||||
if($var12 == 6){
|
||||
$var13 = "June";
|
||||
}
|
||||
if($var12 == 7){
|
||||
$var13 = "July";
|
||||
}
|
||||
if($var12 == 8){
|
||||
$var13 = "August";
|
||||
}
|
||||
if($var12 == 9){
|
||||
$var13 = "September";
|
||||
}
|
||||
if($var12 == 10){
|
||||
$var13 = "October";
|
||||
}
|
||||
if($var12 == 11){
|
||||
$var13 = "November";
|
||||
}
|
||||
if($var12 == 12){
|
||||
$var13 = "December";
|
||||
}
|
||||
labels.push($var13);
|
||||
data.push(result[i].totaltickets);
|
||||
data2.push(result[i].closed);
|
||||
data3.push(result[i].reopened);
|
||||
data4.push(result[i].open);
|
||||
}
|
||||
|
||||
var buyerData = {
|
||||
labels : labels,
|
||||
datasets : [
|
||||
{
|
||||
label : "Total Tickets" ,
|
||||
fillColor : "rgba(240, 127, 110, 0.3)",
|
||||
strokeColor : "#f56954",
|
||||
pointColor : "#A62121",
|
||||
pointStrokeColor : "#E60073",
|
||||
data : data
|
||||
|
||||
}
|
||||
,
|
||||
{
|
||||
label : "Open Tickets" ,
|
||||
fillColor : "rgba(255, 102, 204, 0.4)",
|
||||
strokeColor : "#f56954",
|
||||
pointColor : "#FF66CC",
|
||||
pointStrokeColor : "#fff",
|
||||
pointHighlightFill : "#FF4DC3",
|
||||
pointHighlightStroke : "rgba(151,187,205,1)",
|
||||
data : data4
|
||||
|
||||
}
|
||||
,
|
||||
{
|
||||
label : "Closed Tickets",
|
||||
fillColor : "rgba(151,187,205,0.2)",
|
||||
strokeColor : "rgba(151,187,205,1)",
|
||||
pointColor : "rgba(151,187,205,1)",
|
||||
pointStrokeColor : "#0000CC",
|
||||
pointHighlightFill : "#0000E6",
|
||||
pointHighlightStroke : "rgba(151,187,205,1)",
|
||||
data : data2
|
||||
}
|
||||
,
|
||||
{
|
||||
label : "Reopened Tickets",
|
||||
fillColor : "rgba(102,255,51,0.2)",
|
||||
strokeColor : "rgba(151,187,205,1)",
|
||||
pointColor : "rgba(46,184,0,1)",
|
||||
pointStrokeColor : "#fff",
|
||||
pointHighlightFill : "#fff",
|
||||
pointHighlightStroke : "rgba(151,187,205,1)",
|
||||
data : data3
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
var myLineChart = new Chart(document.getElementById("tickets-graph").getContext("2d")).Line(buyerData, {
|
||||
showScale: true,
|
||||
//Boolean - Whether grid lines are shown across the chart
|
||||
scaleShowGridLines: false,
|
||||
//String - Colour of the grid lines
|
||||
scaleGridLineColor: "rgba(0,0,0,.05)",
|
||||
//Number - Width of the grid lines
|
||||
scaleGridLineWidth: 1,
|
||||
//Boolean - Whether to show horizontal lines (except X axis)
|
||||
scaleShowHorizontalLines: true,
|
||||
//Boolean - Whether to show vertical lines (except Y axis)
|
||||
scaleShowVerticalLines: true,
|
||||
//Boolean - Whether the line is curved between points
|
||||
bezierCurve: false,
|
||||
//Number - Tension of the bezier curve between points
|
||||
bezierCurveTension: 0.3,
|
||||
//Boolean - Whether to show a dot for each point
|
||||
pointDot: true,
|
||||
//Number - Radius of each point dot in pixels
|
||||
pointDotRadius: 4,
|
||||
//Number - Pixel width of point dot stroke
|
||||
pointDotStrokeWidth: 1,
|
||||
//Number - amount extra to add to the radius to cater for hit detection outside the drawn point
|
||||
pointHitDetectionRadius: 20,
|
||||
//Boolean - Whether to show a stroke for datasets
|
||||
datasetStroke: true,
|
||||
//Number - Pixel width of dataset stroke
|
||||
datasetStrokeWidth: 1,
|
||||
//Boolean - Whether to fill the dataset with a color
|
||||
datasetFill: true,
|
||||
//String - A legend template
|
||||
//Boolean - whether to maintain the starting aspect ratio or not when responsive, if set to false, will take up entire container
|
||||
maintainAspectRatio: false,
|
||||
//Boolean - whether to make the chart responsive to window resizing
|
||||
responsive: true,
|
||||
legendTemplate : '<ul style="list-style-type: square;">'
|
||||
+'<% for (var i=0; i<datasets.length; i++) { %>'
|
||||
+'<li style="color: <%=datasets[i].pointColor%>;">'
|
||||
+'<span style=\"background-color:<%=datasets[i].pointColor%>\"></span>'
|
||||
+'<% if (datasets[i].label) { %><%= datasets[i].label %><% } %>'
|
||||
+'</li>'
|
||||
+'<% } %>'
|
||||
+'</ul>'
|
||||
});
|
||||
|
||||
document.getElementById("legendDiv").innerHTML = myLineChart.generateLegend();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
@stop
|
@@ -1,16 +1,15 @@
|
||||
<?php namespace App\Http\Controllers\Agent\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Agent\helpdesk;
|
||||
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
// requests
|
||||
use App\Http\Requests\helpdesk\CannedRequest;
|
||||
use App\Http\Requests\helpdesk\CannedUpdateRequest;
|
||||
|
||||
// model
|
||||
use App\Model\helpdesk\Agent_panel\Canned;
|
||||
use App\User;
|
||||
|
||||
// classes
|
||||
use Exception;
|
||||
|
||||
@@ -70,9 +69,9 @@ class CannedController extends Controller {
|
||||
try {
|
||||
// saving inputs
|
||||
$canned->save();
|
||||
return redirect()->route('canned.list')->with('success','Added Successfully');
|
||||
return redirect()->route('canned.list')->with('success', 'Added Successfully');
|
||||
} catch (Exception $e) {
|
||||
return redirect()->route('canned.list')->with('fails',$e->errorInfo[2]);
|
||||
return redirect()->route('canned.list')->with('fails', $e->errorInfo[2]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,8 +83,8 @@ class CannedController extends Controller {
|
||||
*/
|
||||
public function edit($id, Canned $canned) {
|
||||
// fetching requested canned response
|
||||
$canned = $canned->where('user_id', '=', \Auth::user()->id)->where('id','=',$id)->first();
|
||||
return view('themes.default1.agent.helpdesk.canned.edit',compact('canned'));
|
||||
$canned = $canned->where('user_id', '=', \Auth::user()->id)->where('id', '=', $id)->first();
|
||||
return view('themes.default1.agent.helpdesk.canned.edit', compact('canned'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -97,7 +96,7 @@ class CannedController extends Controller {
|
||||
*/
|
||||
public function update($id, CannedUpdateRequest $request, Canned $canned) {
|
||||
/* select the field where id = $id(request Id) */
|
||||
$canned = $canned->where('id','=',$id)->where('user_id', '=', \Auth::user()->id)->first();
|
||||
$canned = $canned->where('id', '=', $id)->where('user_id', '=', \Auth::user()->id)->first();
|
||||
// fetching all the requested inputs
|
||||
$canned->user_id = \Auth::user()->id;
|
||||
$canned->title = $request->input('title');
|
||||
@@ -105,9 +104,9 @@ class CannedController extends Controller {
|
||||
try {
|
||||
// saving inputs
|
||||
$canned->save();
|
||||
return redirect()->route('canned.list')->with('success','Updated Successfully');
|
||||
return redirect()->route('canned.list')->with('success', 'Updated Successfully');
|
||||
} catch (Exception $e) {
|
||||
return redirect()->route('canned.list')->with('fails',$e->errorInfo[2]);
|
||||
return redirect()->route('canned.list')->with('fails', $e->errorInfo[2]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,9 +138,9 @@ class CannedController extends Controller {
|
||||
*/
|
||||
public function get_canned($id) {
|
||||
// checking for the canned response with requested value
|
||||
if($id != "zzz") {
|
||||
if ($id != "zzz") {
|
||||
// fetching canned response
|
||||
$canned = Canned::where('id','=',$id)->where('user_id','=',\Auth::user()->id)->first();
|
||||
$canned = Canned::where('id', '=', $id)->where('user_id', '=', \Auth::user()->id)->first();
|
||||
$msg = $canned->message;
|
||||
} else {
|
||||
$msg = "";
|
||||
|
@@ -1,14 +1,14 @@
|
||||
<?php namespace App\Http\Controllers\Agent\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Agent\helpdesk;
|
||||
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
// models
|
||||
use App\Model\helpdesk\Settings\Company;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Collaborator;
|
||||
use App\Model\helpdesk\Email\Emails;
|
||||
use App\User;
|
||||
|
||||
// classes
|
||||
use DB;
|
||||
use View;
|
||||
@@ -59,12 +59,10 @@ class DashboardController extends Controller {
|
||||
* Fetching dashboard graph data to implement graph
|
||||
* @return type Json
|
||||
*/
|
||||
public function ChartData($date111 = "",$date122 = "")
|
||||
{
|
||||
|
||||
public function ChartData($date111 = "", $date122 = "") {
|
||||
$date11 = strtotime($date122);
|
||||
$date12 = strtotime($date111);
|
||||
if($date11 && $date12){
|
||||
if ($date11 && $date12) {
|
||||
$date2 = $date12;
|
||||
$date1 = $date11;
|
||||
} else {
|
||||
@@ -73,25 +71,25 @@ class DashboardController extends Controller {
|
||||
$date3 = Date('Y-m-d');
|
||||
$format = 'Y-m-d';
|
||||
// generating a date range of 1 month
|
||||
$date1 = strtotime(Date($format,strtotime('-1 month'. $date3)));
|
||||
$date1 = strtotime(Date($format, strtotime('-1 month' . $date3)));
|
||||
}
|
||||
$return = "";
|
||||
$last = "";
|
||||
for ( $i = $date1; $i <= $date2; $i = $i + 86400 ) {
|
||||
$thisDate = date( 'Y-m-d', $i );
|
||||
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();
|
||||
$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);
|
||||
$array = array_map('htmlentities', $value);
|
||||
$json = html_entity_decode(json_encode($array));
|
||||
$return .= $json.',';
|
||||
$return .= $json . ',';
|
||||
}
|
||||
$last = rtrim($return,',');
|
||||
$last = rtrim($return, ',');
|
||||
|
||||
return '['.$last.']';
|
||||
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('SUM(CASE WHEN status = 5 THEN 1 ELSE 0 END) as deleted'),
|
||||
@@ -99,7 +97,6 @@ class DashboardController extends Controller {
|
||||
// ->groupBy('month')
|
||||
// ->orderBy('month', 'asc')
|
||||
// ->get();
|
||||
|
||||
// return $ticketlist;
|
||||
}
|
||||
|
||||
|
@@ -1,8 +1,10 @@
|
||||
<?php namespace App\Http\Controllers\Agent\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Agent\helpdesk;
|
||||
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Controllers\Agent\helpdesk\TicketController;
|
||||
|
||||
// models
|
||||
use App\User;
|
||||
use App\Model\helpdesk\Email\Emails;
|
||||
@@ -10,17 +12,17 @@ use App\Model\helpdesk\Settings\Email;
|
||||
use App\Model\helpdesk\Ticket\Ticket_attachments;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Thread;
|
||||
use App\Model\helpdesk\Settings\System;
|
||||
use App\Model\helpdesk\Settings\Ticket;
|
||||
use App\Model\helpdesk\Manage\Help_topic;
|
||||
use App\Model\helpdesk\Utility\MailboxProtocol;
|
||||
use App\Model\helpdesk\Ticket\Ticket_source;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Priority;
|
||||
use App\Model\helpdesk\Ticket\Tickets;
|
||||
|
||||
// classes
|
||||
use PhpImap\Mailbox as ImapMailbox;
|
||||
use PhpImap\IncomingMail;
|
||||
use PhpImap\IncomingMailAttachment;
|
||||
use ForceUTF8\Encoding;
|
||||
use \ForceUTF8\Encoding;
|
||||
use App;
|
||||
use DB;
|
||||
use Crypt;
|
||||
@@ -28,9 +30,7 @@ use Schedule;
|
||||
use File;
|
||||
use Artisan;
|
||||
use Exception;
|
||||
use Phpmailer\PHPMailerautoload;
|
||||
//$root = realpath($_SERVER["DOCUMENT_ROOT"]);
|
||||
//include_once($root.'\vendor\phpmailer\phpmailer\PHPMailerautoload.php');
|
||||
|
||||
/**
|
||||
* MailController
|
||||
*
|
||||
@@ -53,49 +53,59 @@ class MailController extends Controller {
|
||||
* Reademails
|
||||
* @return type
|
||||
*/
|
||||
|
||||
|
||||
public function readmails(Emails $emails, Email $settings_email, System $system)
|
||||
{
|
||||
public function readmails(Emails $emails, Email $settings_email, System $system, Ticket $ticket) {
|
||||
// $path_url = $system->first()->url;
|
||||
if($settings_email->first()->email_fetching == 1)
|
||||
{
|
||||
if($settings_email->first()->all_emails == 1)
|
||||
{
|
||||
if ($settings_email->first()->email_fetching == 1) {
|
||||
if ($settings_email->first()->all_emails == 1) {
|
||||
// $helptopic = $this->TicketController->default_helptopic();
|
||||
// $sla = $this->TicketController->default_sla();
|
||||
$email = $emails->get();
|
||||
foreach($email as $e_mail)
|
||||
{
|
||||
foreach ($email as $e_mail) {
|
||||
$priority = $e_mail->priority;
|
||||
$dept = $e_mail->department;
|
||||
$helptopic = $e_mail->help_topic;
|
||||
|
||||
if ($priority == null) {
|
||||
$priority = $ticket->first()->priority;
|
||||
}
|
||||
|
||||
if ($dept == null) {
|
||||
$dept = $system->first()->department;
|
||||
}
|
||||
|
||||
if ($helptopic == null) {
|
||||
$helptopic = $ticket->first()->help_topic;
|
||||
}
|
||||
// dd($dept);
|
||||
|
||||
$get_helptopic = Help_topic::where('id', '=', $helptopic)->first();
|
||||
$sla = $get_helptopic->sla_plan;
|
||||
$dept = $e_mail->department;
|
||||
// $dept = $e_mail->department;
|
||||
$host = $e_mail->fetching_host;
|
||||
$port = $e_mail->fetching_port;
|
||||
$protocol = $e_mail->mailbox_protocol;
|
||||
$get_mailboxprotocol = MailboxProtocol::where('id','=',$protocol)->first();
|
||||
$get_mailboxprotocol = MailboxProtocol::where('id', '=', $protocol)->first();
|
||||
$protocol = $get_mailboxprotocol->value;
|
||||
$imap_config = '{'.$host.':'.$port.$protocol.'}INBOX';
|
||||
$imap_config = '{' . $host . ':' . $port . $protocol . '}INBOX';
|
||||
$password = Crypt::decrypt($e_mail->password);
|
||||
$mailbox = new ImapMailbox($imap_config, $e_mail->email_address, $password, __DIR__);
|
||||
$mails = array();
|
||||
$mailsIds = $mailbox->searchMailBox('SINCE '. date('d-M-Y', strtotime("-1 day")));
|
||||
if(!$mailsIds) {
|
||||
$mailsIds = $mailbox->searchMailBox('SINCE ' . date('d-M-Y', strtotime("-1 day")));
|
||||
if (!$mailsIds) {
|
||||
die('Mailbox is empty');
|
||||
}
|
||||
foreach($mailsIds as $mailId) {
|
||||
foreach ($mailsIds as $mailId) {
|
||||
$overview = $mailbox->get_overview($mailId);
|
||||
$var = $overview[0]->seen ? 'read' : 'unread';
|
||||
if ($var == 'unread') {
|
||||
$mail = $mailbox->getMail($mailId);
|
||||
if($settings_email->first()->email_collaborator == 1) {
|
||||
if ($settings_email->first()->email_collaborator == 1) {
|
||||
$collaborator = $mail->cc;
|
||||
} else {
|
||||
$collaborator = null;
|
||||
}
|
||||
$body = $mail->textHtml;
|
||||
if($body == null) {
|
||||
if ($body == null) {
|
||||
$body = $mailbox->backup_getmail($mailId);
|
||||
$body = str_replace('\r\n', '<br/>', $body);
|
||||
// var_dump($body);
|
||||
@@ -107,7 +117,7 @@ class MailController extends Controller {
|
||||
$date = date('Y-m-d H:i:s', strtotime($date));
|
||||
// dd($date);
|
||||
|
||||
if(isset($mail->subject)){
|
||||
if (isset($mail->subject)) {
|
||||
$subject = $mail->subject;
|
||||
} else {
|
||||
$subject = "No Subject";
|
||||
@@ -116,33 +126,31 @@ class MailController extends Controller {
|
||||
// dd($subject);
|
||||
$fromname = $mail->fromName;
|
||||
$fromaddress = $mail->fromAddress;
|
||||
$ticket_source = Ticket_source::where('name','=','email')->first();
|
||||
$ticket_source = Ticket_source::where('name', '=', 'email')->first();
|
||||
$source = $ticket_source->id;
|
||||
$phone = "";
|
||||
$priority = $get_helptopic->priority;
|
||||
// Ticket_Priority::where('')
|
||||
|
||||
$assign = $get_helptopic->auto_assign;
|
||||
$form_data = null;
|
||||
$result = $this->TicketController->create_user($fromaddress, $fromname, $subject, $body, $phone, $helptopic, $sla, $priority, $source, $collaborator, $dept, $assign, $form_data);
|
||||
// dd($result);
|
||||
if ($result[1] == true) {
|
||||
$ticket_table = Tickets::where('ticket_number', '=' , $result[0])->first();
|
||||
$thread_id = Ticket_Thread::where('ticket_id','=',$ticket_table->id)->max('id');
|
||||
$ticket_table = Tickets::where('ticket_number', '=', $result[0])->first();
|
||||
$thread_id = Ticket_Thread::where('ticket_id', '=', $ticket_table->id)->max('id');
|
||||
// $thread_id = Ticket_Thread::whereRaw('id = (select max(`id`) from ticket_thread)')->first();
|
||||
$thread_id = $thread_id;
|
||||
|
||||
foreach($mail->getAttachments() as $attachment) {
|
||||
foreach ($mail->getAttachments() as $attachment) {
|
||||
$support = "support";
|
||||
// echo $_SERVER['DOCUMENT_ROOT'];
|
||||
$dir_img_paths = __DIR__;
|
||||
$dir_img_path = explode('/code', $dir_img_paths);
|
||||
// dd($attachment->filePath);
|
||||
$filepath = explode('../../../../../public',$attachment->filePath);
|
||||
$filepath = explode('../../../../../public', $attachment->filePath);
|
||||
// var_dump($attachment->filePath);
|
||||
// dd($filepath);
|
||||
// $path = $dir_img_path[0]."/code/public/".$filepath[1];
|
||||
$path = public_path().$filepath[1];
|
||||
$path = public_path() . $filepath[1];
|
||||
// dd($path);
|
||||
$filesize = filesize($path);
|
||||
$file_data = file_get_contents($path);
|
||||
@@ -151,11 +159,11 @@ class MailController extends Controller {
|
||||
$string = str_replace('-', '', $attachment->name);
|
||||
$filename = explode('src', $attachment->filePath);
|
||||
$filename = str_replace('\\', '', $filename);
|
||||
$body = str_replace("cid:".$imageid, $filepath[1], $body);
|
||||
$body = str_replace("cid:" . $imageid, $filepath[1], $body);
|
||||
$pos = strpos($body, $filepath[1]);
|
||||
|
||||
if($pos == false) {
|
||||
if($settings_email->first()->attachment == 1) {
|
||||
if ($pos == false) {
|
||||
if ($settings_email->first()->attachment == 1) {
|
||||
$upload = new Ticket_attachments;
|
||||
$upload->file = $file_data;
|
||||
$upload->thread_id = $thread_id;
|
||||
@@ -178,8 +186,8 @@ class MailController extends Controller {
|
||||
unlink($path);
|
||||
}
|
||||
$body = Encoding::fixUTF8($body);
|
||||
$thread = Ticket_Thread::where('id','=',$thread_id)->first();
|
||||
$thread->body = $this->separate_reply($body) ;
|
||||
$thread = Ticket_Thread::where('id', '=', $thread_id)->first();
|
||||
$thread->body = $this->separate_reply($body);
|
||||
$thread->save();
|
||||
}
|
||||
}
|
||||
@@ -218,16 +226,16 @@ class MailController extends Controller {
|
||||
* fetch_attachments
|
||||
* @return type
|
||||
*/
|
||||
public function fetch_attachments(){
|
||||
public function fetch_attachments() {
|
||||
$uploads = Upload::all();
|
||||
foreach($uploads as $attachment) {
|
||||
foreach ($uploads as $attachment) {
|
||||
$image = @imagecreatefromstring($attachment->file);
|
||||
ob_start();
|
||||
imagejpeg($image, null, 80);
|
||||
$data = ob_get_contents();
|
||||
ob_end_clean();
|
||||
$var = '<a href="" target="_blank"><img src="data:image/jpg;base64,' . base64_encode($data) . '"/></a>';
|
||||
echo '<br/><span class="mailbox-attachment-icon has-img">'.$var.'</span>';
|
||||
echo '<br/><span class="mailbox-attachment-icon has-img">' . $var . '</span>';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -236,12 +244,11 @@ class MailController extends Controller {
|
||||
* @param type $id
|
||||
* @return type file
|
||||
*/
|
||||
public function get_data($id){
|
||||
$attachments = App\Model\helpdesk\Ticket\Ticket_attachments::where('id','=',$id)->get();
|
||||
foreach($attachments as $attachment)
|
||||
{
|
||||
header('Content-type: application/'.$attachment->type.'');
|
||||
header('Content-Disposition: inline; filename='.$attachment->name.'');
|
||||
public function get_data($id) {
|
||||
$attachments = App\Model\helpdesk\Ticket\Ticket_attachments::where('id', '=', $id)->get();
|
||||
foreach ($attachments as $attachment) {
|
||||
header('Content-type: application/' . $attachment->type . '');
|
||||
header('Content-Disposition: inline; filename=' . $attachment->name . '');
|
||||
header('Content-Transfer-Encoding: binary');
|
||||
echo $attachment->file;
|
||||
}
|
||||
|
@@ -1,8 +1,9 @@
|
||||
<?php namespace App\Http\Controllers\Agent\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Agent\helpdesk;
|
||||
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
// Model
|
||||
use App\User;
|
||||
use App\Model\helpdesk\Settings\Company;
|
||||
@@ -10,7 +11,6 @@ use App\Model\helpdesk\Agent\Teams;
|
||||
use App\Model\helpdesk\Agent\Department;
|
||||
use App\Model\helpdesk\Utility\Log_notification;
|
||||
use App\Model\helpdesk\settings\Email;
|
||||
|
||||
// classes
|
||||
use Exception;
|
||||
|
||||
@@ -26,19 +26,20 @@ class NotificationController extends Controller {
|
||||
|
||||
/**
|
||||
* This function is for sending daily report/notification about the system
|
||||
**/
|
||||
* */
|
||||
public function send_notification() {
|
||||
//fetching email settings
|
||||
$email = Email::where('id','=','1')->first();
|
||||
$email = Email::where('id', '=', '1')->first();
|
||||
// checking if the daily notification is enabled or not
|
||||
if($email->notification_cron == 1){
|
||||
if ($email->notification_cron == 1) {
|
||||
// checking if current date is equal to the last entered daily notification log
|
||||
$notification = Log_notification::where('log','=','NOT-1')->orderBy('id','DESC')->first();
|
||||
$date = explode(" " , $notification->created_at);
|
||||
if(Date('Y-m-d') == $date[0]){
|
||||
$notification = Log_notification::where('log', '=', 'NOT-1')->orderBy('id', 'DESC')->first();
|
||||
$date = explode(" ", $notification->created_at);
|
||||
if (Date('Y-m-d') == $date[0]) {
|
||||
|
||||
} else {
|
||||
// creating a daily notification log
|
||||
Log_notification::create(['log'=>'NOT-1']);
|
||||
Log_notification::create(['log' => 'NOT-1']);
|
||||
$company = $this->company();
|
||||
// Send notification details to admin
|
||||
$this->send_notification_to_admin($company);
|
||||
@@ -56,15 +57,15 @@ class NotificationController extends Controller {
|
||||
* Admin Notification/Report
|
||||
* @param company
|
||||
* @return mail
|
||||
**/
|
||||
* */
|
||||
public function send_notification_to_admin($company) {
|
||||
// get all admin users
|
||||
$users = User::where('role','=','admin')->get();
|
||||
$users = User::where('role', '=', 'admin')->get();
|
||||
foreach ($users as $user) {
|
||||
// Send notification details to admin
|
||||
$email = $user->email;
|
||||
$user_name = $user->first_name . " " . $user->last_name;
|
||||
\Mail::send('emails.notifications.admin', ['company' => $company, 'name'=>$user_name], function ($message)use ($email, $user_name, $company) {
|
||||
\Mail::send('emails.notifications.admin', ['company' => $company, 'name' => $user_name], function ($message)use ($email, $user_name, $company) {
|
||||
$message->to($email, $user_name)->subject($company . ' Daily Report ');
|
||||
});
|
||||
}
|
||||
@@ -73,20 +74,20 @@ class NotificationController extends Controller {
|
||||
/**
|
||||
* Department Manager Notification/Report
|
||||
* @return mail
|
||||
**/
|
||||
* */
|
||||
public function send_notification_to_manager($company) {
|
||||
// get all department managers
|
||||
$depts = Department::all();
|
||||
foreach ($depts as $dept) {
|
||||
if(isset($dept->manager)) {
|
||||
if (isset($dept->manager)) {
|
||||
$dept_name = $dept->name;
|
||||
$users = User::where('id','=',$dept->manager)->get();
|
||||
$users = User::where('id', '=', $dept->manager)->get();
|
||||
foreach ($users as $user) {
|
||||
// Send notification details to manager of a department
|
||||
$email = $user->email;
|
||||
$user_name = $user->first_name . " " . $user->last_name;
|
||||
\Mail::send('emails.notifications.manager', ['company' => $company, 'name'=>$user_name,'dept_id' => $dept->id, 'dept_name' => $dept->name], function ($message)use ($email, $user_name, $company, $dept_name) {
|
||||
$message->to($email, $user_name)->subject($company . ' Daily Report for department manager of '. $dept_name.' department.');
|
||||
\Mail::send('emails.notifications.manager', ['company' => $company, 'name' => $user_name, 'dept_id' => $dept->id, 'dept_name' => $dept->name], function ($message)use ($email, $user_name, $company, $dept_name) {
|
||||
$message->to($email, $user_name)->subject($company . ' Daily Report for department manager of ' . $dept_name . ' department.');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -96,20 +97,20 @@ class NotificationController extends Controller {
|
||||
/**
|
||||
* Team Lead Notification/Report
|
||||
* @return mail
|
||||
**/
|
||||
* */
|
||||
public function send_notification_to_team_lead($company) {
|
||||
// get all Team leads
|
||||
$teams = Teams::all();
|
||||
foreach ($teams as $team) {
|
||||
if(isset($team->team_lead)) {
|
||||
if (isset($team->team_lead)) {
|
||||
$team_name = $team->name;
|
||||
$users = User::where('id','=',$team->team_lead)->get();
|
||||
$users = User::where('id', '=', $team->team_lead)->get();
|
||||
foreach ($users as $user) {
|
||||
// Send notification details to team lead
|
||||
$email = $user->email;
|
||||
$user_name = $user->first_name . " " . $user->last_name;
|
||||
\Mail::send('emails.notifications.lead', ['company' => $company, 'name'=>$user_name,'team_id' => $team->id], function ($message)use ($email, $user_name, $company, $team_name) {
|
||||
$message->to($email, $user_name)->subject($company . ' Daily Report for Team Lead of team '. $team_name);
|
||||
\Mail::send('emails.notifications.lead', ['company' => $company, 'name' => $user_name, 'team_id' => $team->id], function ($message)use ($email, $user_name, $company, $team_name) {
|
||||
$message->to($email, $user_name)->subject($company . ' Daily Report for Team Lead of team ' . $team_name);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -119,15 +120,15 @@ class NotificationController extends Controller {
|
||||
/**
|
||||
* Agent Notification/Report
|
||||
* @return mail
|
||||
**/
|
||||
* */
|
||||
public function send_notification_to_agent($company) {
|
||||
// get all agents users
|
||||
$users = User::where('role','=','agent')->get();
|
||||
$users = User::where('role', '=', 'agent')->get();
|
||||
foreach ($users as $user) {
|
||||
// Send notification details to all the agents
|
||||
$email = $user->email;
|
||||
$user_name = $user->first_name . " " . $user->last_name;
|
||||
\Mail::send('emails.notifications.agent', ['company' => $company, 'name'=>$user_name, 'user_id' => 1], function ($message)use ($email, $user_name, $company) {
|
||||
\Mail::send('emails.notifications.agent', ['company' => $company, 'name' => $user_name, 'user_id' => 1], function ($message)use ($email, $user_name, $company) {
|
||||
$message->to($email, $user_name)->subject($company . ' Daily Report for Agents');
|
||||
});
|
||||
}
|
||||
@@ -139,11 +140,11 @@ class NotificationController extends Controller {
|
||||
*/
|
||||
public function company() {
|
||||
// fetching comapny model
|
||||
$company = Company::Where('id','=','1')->first();
|
||||
$company = Company::Where('id', '=', '1')->first();
|
||||
// fetching company name
|
||||
if($company->company_name == null){
|
||||
if ($company->company_name == null) {
|
||||
$company = "Support Center";
|
||||
}else{
|
||||
} else {
|
||||
$company = $company->company_name;
|
||||
}
|
||||
return $company;
|
||||
@@ -157,5 +158,4 @@ class NotificationController extends Controller {
|
||||
// $message->to($email, $user_name)->subject('testing reporting');
|
||||
// });
|
||||
// }
|
||||
|
||||
}
|
@@ -1,13 +1,14 @@
|
||||
<?php namespace App\Http\Controllers\Agent\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Agent\helpdesk;
|
||||
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
// requests
|
||||
use App\Http\Requests\helpdesk\OrganizationRequest;
|
||||
|
||||
/* include organization model */
|
||||
use App\Http\Requests\helpdesk\OrganizationUpdate;
|
||||
|
||||
// models
|
||||
/* Define OrganizationRequest to validate the create form */
|
||||
use App\Model\helpdesk\Agent_panel\Organization;
|
||||
@@ -70,9 +71,9 @@ class OrganizationController extends Controller {
|
||||
/* column name */
|
||||
->addColumn('name', function ($model) {
|
||||
// return $model->name;
|
||||
if(strlen($model->name) > 20) {
|
||||
if (strlen($model->name) > 20) {
|
||||
$orgname = substr($model->name, 0, 25);
|
||||
$orgname = substr($orgname, 0, strrpos($orgname, ' ')).' ...';
|
||||
$orgname = substr($orgname, 0, strrpos($orgname, ' ')) . ' ...';
|
||||
} else {
|
||||
$orgname = $model->name;
|
||||
}
|
||||
@@ -92,8 +93,8 @@ class OrganizationController extends Controller {
|
||||
->addColumn('Actions', function ($model) {
|
||||
// displaying action buttons
|
||||
// modal popup to delete data
|
||||
return '<span data-toggle="modal" data-target="#deletearticle'.$model->id .'"><a href="#" ><button class="btn btn-danger btn-xs"></a> ' . \Lang::get('lang.delete') . ' </button></span> <a href="'.route('organizations.edit', $model->id).'" class="btn btn-warning btn-xs">' . \Lang::get('lang.edit') . '</a> <a href="'.route('organizations.show', $model->id).'" class="btn btn-primary btn-xs">' . \Lang::get('lang.view') . '</a>
|
||||
<div class="modal fade" id="deletearticle'.$model->id .'">
|
||||
return '<span data-toggle="modal" data-target="#deletearticle' . $model->id . '"><a href="#" ><button class="btn btn-danger btn-xs"></a> ' . \Lang::get('lang.delete') . ' </button></span> <a href="' . route('organizations.edit', $model->id) . '" class="btn btn-warning btn-xs">' . \Lang::get('lang.edit') . '</a> <a href="' . route('organizations.show', $model->id) . '" class="btn btn-primary btn-xs">' . \Lang::get('lang.view') . '</a>
|
||||
<div class="modal fade" id="deletearticle' . $model->id . '">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
@@ -101,11 +102,11 @@ class OrganizationController extends Controller {
|
||||
<h4 class="modal-title">Are You Sure ?</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
'.$model->user_name.'
|
||||
' . $model->user_name . '
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">Close</button>
|
||||
<a href="'.route('org.delete',$model->id).'"><button class="btn btn-danger">delete</button></a>
|
||||
<a href="' . route('org.delete', $model->id) . '"><button class="btn btn-danger">delete</button></a>
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
@@ -219,7 +220,7 @@ class OrganizationController extends Controller {
|
||||
|
||||
/* select the field by id */
|
||||
$orgs = $org->whereId($id)->first();
|
||||
$user_orgs = $user_org->where('org_id','=',$id)->get();
|
||||
$user_orgs = $user_org->where('org_id', '=', $id)->get();
|
||||
foreach ($user_orgs as $user_org) {
|
||||
$user_org->delete();
|
||||
}
|
||||
@@ -240,11 +241,11 @@ class OrganizationController extends Controller {
|
||||
* @param type $id
|
||||
* @return type boolean
|
||||
*/
|
||||
public function Head_Org($id){
|
||||
public function Head_Org($id) {
|
||||
// get the user to make organization head
|
||||
$head_user = \Input::get('user');
|
||||
// get an instance of the selected organization
|
||||
$org_head = Organization::where('id','=',$id)->first();
|
||||
$org_head = Organization::where('id', '=', $id)->first();
|
||||
$org_head->head = $head_user;
|
||||
// save the user to organization head
|
||||
$org_head->save();
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php namespace App\Http\Controllers\Agent\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Agent\helpdesk;
|
||||
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Controllers\Agent\helpdesk\TicketController;
|
||||
@@ -50,15 +53,15 @@ class Ticket2Controller extends Controller {
|
||||
* @return type response
|
||||
*/
|
||||
public function deptopen($id) {
|
||||
$dept = Department::where('name','=',$id)->first();
|
||||
if(Auth::user()->role == 'agent') {
|
||||
if(Auth::user()->dept_id == $dept->id) {
|
||||
return view('themes.default1.agent.helpdesk.dept-ticket.open',compact('id'));
|
||||
$dept = Department::where('name', '=', $id)->first();
|
||||
if (Auth::user()->role == 'agent') {
|
||||
if (Auth::user()->dept_id == $dept->id) {
|
||||
return view('themes.default1.agent.helpdesk.dept-ticket.open', compact('id'));
|
||||
} else {
|
||||
return redirect()->back()->with('fails','Unauthorised!');
|
||||
return redirect()->back()->with('fails', 'Unauthorised!');
|
||||
}
|
||||
} else {
|
||||
return view('themes.default1.agent.helpdesk.dept-ticket.open',compact('id'));
|
||||
return view('themes.default1.agent.helpdesk.dept-ticket.open', compact('id'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,15 +70,15 @@ class Ticket2Controller extends Controller {
|
||||
* @return type response
|
||||
*/
|
||||
public function deptclose($id) {
|
||||
$dept = Department::where('name','=',$id)->first();
|
||||
if(Auth::user()->role == 'agent') {
|
||||
if(Auth::user()->dept_id == $dept->id) {
|
||||
return view('themes.default1.agent.helpdesk.dept-ticket.closed',compact('id'));
|
||||
$dept = Department::where('name', '=', $id)->first();
|
||||
if (Auth::user()->role == 'agent') {
|
||||
if (Auth::user()->dept_id == $dept->id) {
|
||||
return view('themes.default1.agent.helpdesk.dept-ticket.closed', compact('id'));
|
||||
} else {
|
||||
return redirect()->back()->with('fails','Unauthorised!');
|
||||
return redirect()->back()->with('fails', 'Unauthorised!');
|
||||
}
|
||||
} else {
|
||||
return view('themes.default1.agent.helpdesk.dept-ticket.closed',compact('id'));
|
||||
return view('themes.default1.agent.helpdesk.dept-ticket.closed', compact('id'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,15 +87,15 @@ class Ticket2Controller extends Controller {
|
||||
* @return type response
|
||||
*/
|
||||
public function deptinprogress($id) {
|
||||
$dept = Department::where('name','=',$id)->first();
|
||||
if(Auth::user()->role == 'agent') {
|
||||
if(Auth::user()->dept_id == $dept->id) {
|
||||
return view('themes.default1.agent.helpdesk.dept-ticket.inprogress',compact('id'));
|
||||
$dept = Department::where('name', '=', $id)->first();
|
||||
if (Auth::user()->role == 'agent') {
|
||||
if (Auth::user()->dept_id == $dept->id) {
|
||||
return view('themes.default1.agent.helpdesk.dept-ticket.inprogress', compact('id'));
|
||||
} else {
|
||||
return redirect()->back()->with('fails','Unauthorised!');
|
||||
return redirect()->back()->with('fails', 'Unauthorised!');
|
||||
}
|
||||
} else {
|
||||
return view('themes.default1.agent.helpdesk.dept-ticket.inprogress',compact('id'));
|
||||
return view('themes.default1.agent.helpdesk.dept-ticket.inprogress', compact('id'));
|
||||
}
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,9 @@
|
||||
<?php namespace App\Http\Controllers\Agent\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Agent\helpdesk;
|
||||
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
// requests
|
||||
/* Include Sys_user Model */
|
||||
use App\Http\Requests\helpdesk\ProfilePassword;
|
||||
@@ -11,12 +13,10 @@ use App\Http\Requests\helpdesk\ProfileRequest;
|
||||
use App\Http\Requests\helpdesk\Sys_userRequest;
|
||||
/* include guest_note model */
|
||||
use App\Http\Requests\helpdesk\Sys_userUpdate;
|
||||
|
||||
// models
|
||||
use App\Model\helpdesk\Agent_panel\Organization;
|
||||
use App\Model\helpdesk\Agent_panel\User_org;
|
||||
use App\User;
|
||||
|
||||
// classes
|
||||
use Auth;
|
||||
use Hash;
|
||||
@@ -59,7 +59,7 @@ class UserController extends Controller {
|
||||
/* 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]);
|
||||
return redirect()->back()->with('fails', $e->errorInfo[2]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,16 +69,16 @@ class UserController extends Controller {
|
||||
*/
|
||||
public function user_list() {
|
||||
// displaying list of users with chumper datatables
|
||||
return \Datatable::collection(User::where('role','!=','admin')->where('role','!=','agent')->get())
|
||||
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) {
|
||||
if (strlen($model->user_name) > 20) {
|
||||
$username = substr($model->user_name, 0, 30);
|
||||
$username = substr($username, 0, strrpos($username, ' ')).' ...';
|
||||
$username = substr($username, 0, strrpos($username, ' ')) . ' ...';
|
||||
} else {
|
||||
$username = $model->user_name;
|
||||
}
|
||||
@@ -92,20 +92,20 @@ class UserController extends Controller {
|
||||
/* column phone */
|
||||
->addColumn('phone', function ($model) {
|
||||
$phone = "";
|
||||
if($model->phone_number) {
|
||||
if ($model->phone_number) {
|
||||
$phone = $model->ext . ' ' . $model->phone_number;
|
||||
}
|
||||
$mobile = "";
|
||||
if($model->mobile) {
|
||||
if ($model->mobile) {
|
||||
$mobile = $model->mobile;
|
||||
}
|
||||
$phone = $phone ." ". $mobile;
|
||||
$phone = $phone . " " . $mobile;
|
||||
return $phone;
|
||||
})
|
||||
/* column account status */
|
||||
->addColumn('status', function ($model) {
|
||||
$status = $model->active;
|
||||
if($status == 1) {
|
||||
if ($status == 1) {
|
||||
$stat = '<button class="btn btn-success btn-xs">Active</button>';
|
||||
} else {
|
||||
$stat = '<button class="btn btn-danger btn-xs">Inactive</button>';
|
||||
@@ -115,7 +115,7 @@ class UserController extends Controller {
|
||||
/* column ban status */
|
||||
->addColumn('ban', function ($model) {
|
||||
$status = $model->ban;
|
||||
if($status == 1) {
|
||||
if ($status == 1) {
|
||||
$stat = '<button class="btn btn-danger btn-xs">Banned</button>';
|
||||
} else {
|
||||
$stat = '<button class="btn btn-success btn-xs">Active</button>';
|
||||
@@ -129,7 +129,7 @@ class UserController extends Controller {
|
||||
})
|
||||
/* column actions */
|
||||
->addColumn('Actions', function ($model) {
|
||||
return '<a href="'.route('user.edit', $model->id).'" class="btn btn-warning btn-xs">' . \Lang::get('lang.edit') . '</a> <a href="'.route('user.show', $model->id).'" class="btn btn-primary btn-xs">' . \Lang::get('lang.view') . '</a>';
|
||||
return '<a href="' . route('user.edit', $model->id) . '" class="btn btn-warning btn-xs">' . \Lang::get('lang.edit') . '</a> <a href="' . route('user.show', $model->id) . '" class="btn btn-primary btn-xs">' . \Lang::get('lang.view') . '</a>';
|
||||
})
|
||||
->make();
|
||||
}
|
||||
@@ -142,7 +142,7 @@ class UserController extends Controller {
|
||||
try {
|
||||
return view('themes.default1.agent.helpdesk.user.create');
|
||||
} catch (Exception $e) {
|
||||
return redirect()->back()->with('fails',$e->errorInfo[2]);
|
||||
return redirect()->back()->with('fails', $e->errorInfo[2]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ class UserController extends Controller {
|
||||
$users = $user->whereId($id)->first();
|
||||
/* Update the value by selected field */
|
||||
/* Check whether function success or not */
|
||||
try{
|
||||
try {
|
||||
$users->fill($request->input())->save();
|
||||
/* redirect to Index page with Success Message */
|
||||
return redirect('user')->with('success', 'User Updated Successfully');
|
||||
@@ -236,8 +236,8 @@ class UserController extends Controller {
|
||||
$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]);
|
||||
} catch (Exception $e) {
|
||||
return redirect()->back()->with('fails', $e->errorInfo[2]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -250,7 +250,7 @@ class UserController extends Controller {
|
||||
try {
|
||||
return view('themes.default1.agent.helpdesk.user.profile-edit', compact('user'));
|
||||
} catch (Exception $e) {
|
||||
return redirect()->back()->with('fails',$e->errorInfo[2]);
|
||||
return redirect()->back()->with('fails', $e->errorInfo[2]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -290,13 +290,12 @@ class UserController extends Controller {
|
||||
// saving filename to database
|
||||
$user->profile_pic = $fileName;
|
||||
} else {
|
||||
try{
|
||||
try {
|
||||
$user->fill($request->except('profile_pic', 'gender'))->save();
|
||||
return Redirect::route('profile')->with('success', 'Profile Updated sucessfully');
|
||||
} catch (Exception $e){
|
||||
} 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');
|
||||
@@ -315,7 +314,7 @@ class UserController extends Controller {
|
||||
// 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{
|
||||
try {
|
||||
$user->save();
|
||||
return redirect('profile-edit')->with('success1', 'Password Updated sucessfully');
|
||||
} catch (Exception $e) {
|
||||
@@ -347,20 +346,20 @@ class UserController extends Controller {
|
||||
*/
|
||||
public function User_Create_Org($id) {
|
||||
// checking if the entered value for website is available in database
|
||||
if(Input::get('website')!=null) {
|
||||
if (Input::get('website') != null) {
|
||||
// checking website
|
||||
$check = Organization::where('website','=',Input::get('website'))->first();
|
||||
$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();
|
||||
$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) {
|
||||
} elseif ($check2 != null) {
|
||||
return "Name should be Unique";
|
||||
} elseif($check != null) {
|
||||
} elseif ($check != null) {
|
||||
return "Website should be Unique";
|
||||
} else {
|
||||
// storing organization details and assigning the current user to that organization
|
||||
@@ -380,4 +379,5 @@ class UserController extends Controller {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -1,22 +1,21 @@
|
||||
<?php namespace App\Http\Controllers\Agent\kb;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Agent\kb;
|
||||
|
||||
// Controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Controllers\Agent\kb\SettingsController;
|
||||
use App\Http\Controllers\Client\kb\UserController;
|
||||
use App\Http\Controllers\Agent\helpdesk\TicketController;
|
||||
|
||||
// Requests
|
||||
use App\Http\Requests\kb\ArticleRequest;
|
||||
use App\Http\Requests\kb\ArticleUpdate;
|
||||
|
||||
// Models
|
||||
use App\Model\kb\Article;
|
||||
use App\Model\kb\Category;
|
||||
use App\Model\kb\Relationship;
|
||||
use App\Model\kb\Settings;
|
||||
use App\Model\kb\Comment;
|
||||
|
||||
// Classes
|
||||
use Auth;
|
||||
use Chumper\Datatable\Table;
|
||||
@@ -80,8 +79,8 @@ class ArticleController extends Controller {
|
||||
/* add column action */
|
||||
->addColumn('Actions', function ($model) {
|
||||
/* here are all the action buttons and modal popup to delete articles with confirmations */
|
||||
return '<span data-toggle="modal" data-target="#deletearticle'.$model->id .'"><a href="#" ><button class="btn btn-danger btn-xs"></a> ' . \Lang::get('lang.delete') . ' </button></span> <a href=article/' . $model->id . '/edit class="btn btn-warning btn-xs">' . \Lang::get('lang.edit') . '</a> <a href=show/'.$model->slug .' class="btn btn-primary btn-xs">' . \Lang::get('lang.view') . '</a>
|
||||
<div class="modal fade" id="deletearticle'.$model->id .'">
|
||||
return '<span data-toggle="modal" data-target="#deletearticle' . $model->id . '"><a href="#" ><button class="btn btn-danger btn-xs"></a> ' . \Lang::get('lang.delete') . ' </button></span> <a href=article/' . $model->id . '/edit class="btn btn-warning btn-xs">' . \Lang::get('lang.edit') . '</a> <a href=show/' . $model->slug . ' class="btn btn-primary btn-xs">' . \Lang::get('lang.view') . '</a>
|
||||
<div class="modal fade" id="deletearticle' . $model->id . '">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
@@ -89,11 +88,11 @@ class ArticleController extends Controller {
|
||||
<h4 class="modal-title">Are You Sure ?</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
'.$model->name.'
|
||||
' . $model->name . '
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">Close</button>
|
||||
<a href="article/delete/'.$model->slug.'"><button class="btn btn-danger">delete</button></a>
|
||||
<a href="article/delete/' . $model->slug . '"><button class="btn btn-danger">delete</button></a>
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
@@ -108,10 +107,10 @@ class ArticleController extends Controller {
|
||||
*/
|
||||
public function index() {
|
||||
/* show article list */
|
||||
try{
|
||||
try {
|
||||
return view('themes.default1.agent.kb.article.index');
|
||||
} catch(Exception $e) {
|
||||
return redirect()->back()->with('fails',$e->errorInfo[2]);
|
||||
} catch (Exception $e) {
|
||||
return redirect()->back()->with('fails', $e->errorInfo[2]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,12 +123,11 @@ class ArticleController extends Controller {
|
||||
/* get the attributes of the category */
|
||||
$category = $category->lists('id', 'name');
|
||||
/* get the create page */
|
||||
try{
|
||||
try {
|
||||
return view('themes.default1.agent.kb.article.create', compact('category'));
|
||||
} catch(Exception $e) {
|
||||
return redirect()->back()->with('fails',$e->errorInfo[2]);
|
||||
} catch (Exception $e) {
|
||||
return redirect()->back()->with('fails', $e->errorInfo[2]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -140,22 +138,26 @@ class ArticleController extends Controller {
|
||||
*/
|
||||
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';
|
||||
|
||||
$sl = $request->input('slug');
|
||||
$slug = str_slug($sl, "-");
|
||||
$article->slug = $slug;
|
||||
$article->fill($request->except('created_at','slug'))->save();
|
||||
$article->publish_time = $publishTime;
|
||||
$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{
|
||||
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'. '<li>'.$e->errorInfo[2].'</li>');
|
||||
return redirect('article')->with('fails', 'Article Not Inserted' . '<li>' . $e->errorInfo[2] . '</li>');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,10 +170,8 @@ class ArticleController extends Controller {
|
||||
* @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 */
|
||||
@@ -182,10 +182,9 @@ class ArticleController extends Controller {
|
||||
/* 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]);
|
||||
} catch (Exception $e) {
|
||||
return redirect()->back()->with('fails', $e->errorInfo[2]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -198,10 +197,13 @@ class ArticleController extends Controller {
|
||||
*/
|
||||
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';
|
||||
|
||||
$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);
|
||||
@@ -211,16 +213,17 @@ class ArticleController extends Controller {
|
||||
$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]);
|
||||
DB::insert('insert into kb_article_relationship (category_id, article_id) values (?,?)', [$req, $id]);
|
||||
}
|
||||
/* update the value to the table */
|
||||
try{
|
||||
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'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
} catch (Exception $e) {
|
||||
return redirect('article')->with('fails', 'Article Not Updated' . '<li>' . $e->errorInfo[2] . '</li>');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -232,19 +235,19 @@ class ArticleController extends Controller {
|
||||
*/
|
||||
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
|
||||
$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)
|
||||
$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) {
|
||||
if ($relation) {
|
||||
$relation->delete();
|
||||
}
|
||||
if($article) {
|
||||
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
|
||||
|
@@ -1,4 +1,6 @@
|
||||
<?php namespace App\Http\Controllers\Agent\kb;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Agent\kb;
|
||||
|
||||
// Controllers
|
||||
use App\Http\Controllers\client\kb\UserController;
|
||||
@@ -6,15 +8,12 @@ use App\Http\Controllers\admin\kb\ArticleController;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Controllers\Agent\kb\SettingsController;
|
||||
use App\Http\Controllers\Agent\helpdesk\TicketController;
|
||||
|
||||
// Requests
|
||||
use App\Http\Requests\kb\CategoryRequest;
|
||||
use App\Http\Requests\kb\CategoryUpdate;
|
||||
|
||||
// Model
|
||||
use App\Model\kb\Category;
|
||||
use App\Model\kb\Relationship;
|
||||
|
||||
// Classes
|
||||
use Datatable;
|
||||
use Redirect;
|
||||
@@ -54,7 +53,7 @@ class CategoryController extends Controller {
|
||||
public function index() {
|
||||
/* get the view of index of the catogorys with all attributes
|
||||
of category model */
|
||||
try{
|
||||
try {
|
||||
return view('themes.default1.agent.kb.category.index');
|
||||
} catch (Exception $e) {
|
||||
return redirect()->back()->with('fails', $e->errorInfo[2]);
|
||||
@@ -84,7 +83,7 @@ class CategoryController extends Controller {
|
||||
/* add column Actions */
|
||||
/* there are action buttons and modal popup to delete a data column */
|
||||
->addColumn('Actions', function ($model) {
|
||||
return '<span data-toggle="modal" data-target="#deletecategory' . $model->slug . '"><a href="#" ><button class="btn btn-danger btn-xs"></a>'. \Lang::get("lang.delete") .'</button></span> <a href=category/' . $model->id . '/edit class="btn btn-warning btn-xs">'. \Lang::get("lang.edit") .'</a> <a href=article-list class="btn btn-primary btn-xs">'. \Lang::get("lang.view") .'</a>
|
||||
return '<span data-toggle="modal" data-target="#deletecategory' . $model->slug . '"><a href="#" ><button class="btn btn-danger btn-xs"></a>' . \Lang::get("lang.delete") . '</button></span> <a href=category/' . $model->id . '/edit class="btn btn-warning btn-xs">' . \Lang::get("lang.edit") . '</a> <a href=article-list class="btn btn-primary btn-xs">' . \Lang::get("lang.view") . '</a>
|
||||
<div class="modal fade" id="deletecategory' . $model->slug . '">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
@@ -93,7 +92,7 @@ class CategoryController extends Controller {
|
||||
<h4 class="modal-title">Are You Sure ?</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
'.$model->name.'
|
||||
' . $model->name . '
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">Close</button>
|
||||
@@ -104,7 +103,6 @@ class CategoryController extends Controller {
|
||||
</div>';
|
||||
})
|
||||
->make();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -116,11 +114,11 @@ class CategoryController extends Controller {
|
||||
/* 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*/
|
||||
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]);
|
||||
} catch (Exception $e) {
|
||||
return redirect()->back()->with('fails', $e->errorInfo[2]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,11 +134,11 @@ class CategoryController extends Controller {
|
||||
$slug = str_slug($sl, "-");
|
||||
$category->slug = $slug;
|
||||
// send success message to index page
|
||||
try{
|
||||
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'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
} catch (Exception $e) {
|
||||
return Redirect::back()->with('fails', 'Category Not Inserted' . '<li>' . $e->errorInfo[2] . '</li>');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,14 +175,14 @@ class CategoryController extends Controller {
|
||||
$category->slug = $slug;
|
||||
/* update the values at the table via model according with the request */
|
||||
//redirct to index page with success message
|
||||
try{
|
||||
try {
|
||||
$category->fill($request->all())->save();
|
||||
$category->slug = $slug;
|
||||
$category->save();
|
||||
return redirect('category')->with('success', 'Category Updated Successfully');
|
||||
} catch(Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
//redirect to index with fails message
|
||||
return redirect('category')->with('fails', 'Category Not Updated'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
return redirect('category')->with('fails', 'Category Not Updated' . '<li>' . $e->errorInfo[2] . '</li>');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,18 +196,17 @@ class CategoryController extends Controller {
|
||||
public function destroy($id, Category $category, Relationship $relation) {
|
||||
|
||||
$relation = $relation->where('category_id', $id)->first();
|
||||
if($relation != null){
|
||||
if ($relation != null) {
|
||||
return Redirect::back()->with('fails', 'Category Not Deleted');
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
/* delete the category selected, id == $id */
|
||||
$category = $category->whereId($id)->first();
|
||||
// redirect to index with success message
|
||||
try{
|
||||
try {
|
||||
$category->delete();
|
||||
return Redirect::back()->with('success', 'Category Deleted Successfully');
|
||||
} catch(Exception $e){
|
||||
return Redirect::back()->with('fails', 'Category Not Deleted'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
} catch (Exception $e) {
|
||||
return Redirect::back()->with('fails', 'Category Not Deleted' . '<li>' . $e->errorInfo[2] . '</li>');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,6 @@
|
||||
<?php namespace App\Http\Controllers\Agent\kb;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Agent\kb;
|
||||
|
||||
// controllers
|
||||
use App\Http\Controllers\client\kb\UserController;
|
||||
@@ -6,15 +8,12 @@ use App\Http\Controllers\Agent\kb\ArticleController;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Controllers\Agent\kb\SettingsController;
|
||||
use App\Http\Controllers\Agent\helpdesk\TicketController;
|
||||
|
||||
// request
|
||||
use App\Http\Requests\kb\PageRequest;
|
||||
use App\Http\Requests\kb\PageUpdate;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
// Model
|
||||
use App\Model\kb\Page;
|
||||
|
||||
// classes
|
||||
use Datatable;
|
||||
use Exception;
|
||||
@@ -53,10 +52,10 @@ class PageController extends Controller {
|
||||
public function index() {
|
||||
$pages = $this->page->paginate(3);
|
||||
$pages->setPath('page');
|
||||
try{
|
||||
try {
|
||||
return view('themes.default1.agent.kb.pages.index', compact('pages'));
|
||||
} catch(Exception $e) {
|
||||
return redirect()->back()->with('fails',$e->errorInfo[2]);
|
||||
} catch (Exception $e) {
|
||||
return redirect()->back()->with('fails', $e->errorInfo[2]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,7 +82,7 @@ class PageController extends Controller {
|
||||
/* add column Actions */
|
||||
/* there are action buttons and modal popup to delete a data column */
|
||||
->addColumn('Actions', function ($model) {
|
||||
return '<span data-toggle="modal" data-target="#deletepage' . $model->id . '"><a href="#" ><button class="btn btn-danger btn-xs"></a> '. \Lang::get('lang.delete') .'</button></span> <a href=page/' . $model->slug . '/edit class="btn btn-warning btn-xs">'. \Lang::get('lang.edit') .'</a> <a href=pages/' . $model->slug . ' class="btn btn-primary btn-xs">'. \Lang::get('lang.view') .'</a>
|
||||
return '<span data-toggle="modal" data-target="#deletepage' . $model->id . '"><a href="#" ><button class="btn btn-danger btn-xs"></a> ' . \Lang::get('lang.delete') . '</button></span> <a href=page/' . $model->slug . '/edit class="btn btn-warning btn-xs">' . \Lang::get('lang.edit') . '</a> <a href=pages/' . $model->slug . ' class="btn btn-primary btn-xs">' . \Lang::get('lang.view') . '</a>
|
||||
<div class="modal fade" id="deletepage' . $model->id . '">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
@@ -92,7 +91,7 @@ class PageController extends Controller {
|
||||
<h4 class="modal-title">Are You Sure ?</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
'.$model->name.'
|
||||
' . $model->name . '
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">Close</button>
|
||||
@@ -122,11 +121,11 @@ class PageController extends Controller {
|
||||
$sl = $request->input('slug');
|
||||
$slug = str_slug($sl, "-");
|
||||
$this->page->slug = $slug;
|
||||
try{
|
||||
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]);
|
||||
return redirect('page')->with('success', 'Page created successfully');
|
||||
} catch (Exception $e) {
|
||||
return redirect('page')->with('fails', $e->errorInfo[2]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,11 +135,11 @@ class PageController extends Controller {
|
||||
* @return type view
|
||||
*/
|
||||
public function edit($slug) {
|
||||
try{
|
||||
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]);
|
||||
return redirect('page')->with('fails', $e->errorInfo[2]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,12 +155,12 @@ class PageController extends Controller {
|
||||
$sl = $request->input('slug');
|
||||
$slug = str_slug($sl, "-");
|
||||
$this->page->slug = $slug;
|
||||
try{
|
||||
try {
|
||||
$pages->fill($request->all())->save();
|
||||
$pages->slug = $slug;
|
||||
$pages->save();
|
||||
return redirect('page')->with('success', 'Your Page Updated Successfully');
|
||||
} catch(Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
return redirect('page')->with('fails', $e->errorInfo[2]);
|
||||
}
|
||||
}
|
||||
@@ -172,7 +171,7 @@ class PageController extends Controller {
|
||||
* @return type redirect
|
||||
*/
|
||||
public function destroy($id) {
|
||||
try{
|
||||
try {
|
||||
// get the page to be deleted
|
||||
$page = $this->page->whereId($id)->first();
|
||||
$page->delete();
|
||||
|
@@ -1,10 +1,11 @@
|
||||
<?php namespace App\Http\Controllers\Agent\kb;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Agent\kb;
|
||||
|
||||
// Controllers
|
||||
use App\Http\Controllers\Agent\kb\ArticleController;
|
||||
use App\Http\Controllers\Agent\helpdesk\TicketController;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
// Request
|
||||
use App\Http\Requests\kb\FooterRequest;
|
||||
use App\Http\Requests\kb\ProfilePassword;
|
||||
@@ -12,7 +13,6 @@ use App\Http\Requests\kb\ProfileRequest;
|
||||
use App\Http\Requests\kb\SettingsRequests;
|
||||
use App\Http\Requests\kb\SocialRequest;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
// Model
|
||||
use App\Model\kb\Comment;
|
||||
use App\Model\kb\Faq;
|
||||
@@ -22,7 +22,6 @@ use App\Model\kb\Side2;
|
||||
use App\Model\kb\Social;
|
||||
use App\Model\helpdesk\Utility\Timezones;
|
||||
use App\Model\helpdesk\Utility\Date_format;
|
||||
|
||||
// Classes
|
||||
use Auth;
|
||||
use Config;
|
||||
@@ -78,8 +77,7 @@ class SettingsController extends Controller {
|
||||
* @return Response
|
||||
*/
|
||||
public function postSettings($id, Settings $settings, SettingsRequests $request) {
|
||||
try
|
||||
{
|
||||
try {
|
||||
/* fetch the values of company request */
|
||||
$settings = $settings->whereId('1')->first();
|
||||
if (Input::file('logo')) {
|
||||
@@ -122,7 +120,6 @@ class SettingsController extends Controller {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('settings')->with('fails', 'Settings can not Updated');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -157,16 +154,16 @@ class SettingsController extends Controller {
|
||||
->addColumn('status', function ($model) {
|
||||
$status = $model->status;
|
||||
if ($status == 1) {
|
||||
return '<p style="color:blue"">'.\Lang::get('lang.published');
|
||||
return '<p style="color:blue"">' . \Lang::get('lang.published');
|
||||
} else {
|
||||
return '<p style="color:red"">'.\Lang::get('lang.not_published');
|
||||
return '<p style="color:red"">' . \Lang::get('lang.not_published');
|
||||
}
|
||||
})
|
||||
->addColumn('Created', function ($model) {
|
||||
return TicketController::usertimezone(date($model->created_at));
|
||||
})
|
||||
->addColumn('Actions', function ($model) {
|
||||
return '<a href=comment/delete/' . $model->id . ' class="btn btn-danger btn-xs">'.\Lang::get('lang.delete').'</a> <a href=published/' . $model->id . ' class="btn btn-warning btn-xs">'.\Lang::get('lang.publish').'</a>';
|
||||
return '<a href=comment/delete/' . $model->id . ' class="btn btn-danger btn-xs">' . \Lang::get('lang.delete') . '</a> <a href=published/' . $model->id . ' class="btn btn-warning btn-xs">' . \Lang::get('lang.publish') . '</a>';
|
||||
})
|
||||
->make();
|
||||
}
|
||||
@@ -268,7 +265,6 @@ class SettingsController extends Controller {
|
||||
} else {
|
||||
return redirect('profile')->with('fails2', 'Old password Wrong');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -13,7 +13,7 @@ use App\Model\helpdesk\Ticket\Ticket_attachments;
|
||||
use App\Http\Requests\helpdesk\TicketRequest;
|
||||
use App\User;
|
||||
use App\Model\helpdesk\Agent\Teams;
|
||||
use App\Model\kb\Settings;
|
||||
use App\Model\helpdesk\Settings\System;
|
||||
use App\Model\helpdesk\Manage\Help_topic;
|
||||
use App\Model\helpdesk\Manage\Sla_plan;
|
||||
use App\Model\helpdesk\Utility\Priority;
|
||||
@@ -86,7 +86,7 @@ class ApiController extends Controller {
|
||||
$team = new Teams();
|
||||
$this->team = $team;
|
||||
|
||||
$setting = new Settings();
|
||||
$setting = new System();
|
||||
$this->setting = $setting;
|
||||
|
||||
$helptopic = new Help_topic();
|
||||
@@ -150,6 +150,7 @@ class ApiController extends Controller {
|
||||
/**
|
||||
* return ticket details
|
||||
*/
|
||||
//dd($response);
|
||||
$result = $this->thread->where('id', $response)->first();
|
||||
//$result = $this->attach($result->id,$file);
|
||||
return response()->json(compact('result'));
|
||||
@@ -259,7 +260,7 @@ class ApiController extends Controller {
|
||||
*/
|
||||
public function OpenedTickets() {
|
||||
try {
|
||||
$result = $this->model->where('status', '=', 1)->where('isanswered', '=', 0)->where('assigned_to', '=', 0)->orderBy('id', 'DESC')->get();
|
||||
$result = $this->model->where('status', '=', 1)->where('isanswered', '=', 0)->where('assigned_to', '=', null)->orderBy('id', 'DESC')->get();
|
||||
return response()->json(compact('result'));
|
||||
} catch (\Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
@@ -278,7 +279,7 @@ class ApiController extends Controller {
|
||||
*/
|
||||
public function UnassignedTickets() {
|
||||
try {
|
||||
$result = $this->model->where('assigned_to', '=', 0)->where('status', '1')->orderBy('id', 'DESC')->get();
|
||||
$result = $this->model->where('assigned_to', '=', null)->where('status', '1')->orderBy('id', 'DESC')->get();
|
||||
return response()->json(compact('result'));
|
||||
} catch (\Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
@@ -316,7 +317,7 @@ class ApiController extends Controller {
|
||||
*/
|
||||
public function GetAgents() {
|
||||
try {
|
||||
$result = $this->faveoUser->where('role', 'agent')->where('active', 1)->get();
|
||||
$result = $this->faveoUser->where('role', 'agent')->orWhere('role', 'admin')->where('active', 1)->get();
|
||||
return response()->json(compact('result'));
|
||||
} catch (Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
@@ -505,8 +506,9 @@ class ApiController extends Controller {
|
||||
}
|
||||
|
||||
$url = $this->request->input('url');
|
||||
$url = $url . "/api/v1/helpdesk/check-url?token=" . \Config::get('app.token');
|
||||
$url = $url . "/api/v1/helpdesk/check-url?api-key=" . $this->request->input('api-key') . "&token=" . \Config::get('app.token');
|
||||
$result = $this->CallGetApi($url);
|
||||
//dd($result);
|
||||
return response()->json(compact('result'));
|
||||
} catch (Exception $ex) {
|
||||
$error = $e->getMessage();
|
||||
@@ -579,6 +581,7 @@ class ApiController extends Controller {
|
||||
public function GenerateApiKey() {
|
||||
try {
|
||||
$set = $this->setting->where('id', '1')->first();
|
||||
//dd($set);
|
||||
if ($set->api_enable == 1) {
|
||||
$key = str_random(32);
|
||||
$set->api_key = $key;
|
||||
@@ -675,6 +678,7 @@ class ApiController extends Controller {
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Getting the tickets
|
||||
* @return type json
|
||||
@@ -699,7 +703,6 @@ class ApiController extends Controller {
|
||||
* Fetching the Inbox details
|
||||
* @return type json
|
||||
*/
|
||||
|
||||
public function Inbox() {
|
||||
try {
|
||||
$result = $this->user->join('tickets', 'users.id', '=', 'tickets.user_id')
|
||||
@@ -725,6 +728,7 @@ class ApiController extends Controller {
|
||||
return response()->json(compact('error', 'file', 'line'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create internal note
|
||||
* @return type json
|
||||
@@ -754,6 +758,4 @@ class ApiController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php namespace App\Http\Controllers\Api\v1;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\v1;
|
||||
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
// requests
|
||||
@@ -55,7 +58,7 @@ class InstallerApiController extends Controller {
|
||||
$dbpassword = $request->dbpassword;
|
||||
$port = $request->port;
|
||||
|
||||
if(isset($default) && isset($host) && isset($database) && isset($dbusername)){
|
||||
if (isset($default) && isset($host) && isset($database) && isset($dbusername)) {
|
||||
|
||||
// Setting environment values
|
||||
$_ENV['DB_TYPE'] = $default;
|
||||
@@ -71,16 +74,16 @@ class InstallerApiController extends Controller {
|
||||
}
|
||||
|
||||
// Write environment file
|
||||
$fp = fopen(base_path()."/.env", 'w');
|
||||
$fp = fopen(base_path() . "/.env", 'w');
|
||||
fwrite($fp, $config);
|
||||
fclose($fp);
|
||||
|
||||
return ['response'=>'success','status'=>'1'];
|
||||
return ['response' => 'success', 'status' => '1'];
|
||||
} else {
|
||||
return ['response'=>'fail','reason'=>'insufficient parameters','status'=>'0'];
|
||||
return ['response' => 'fail', 'reason' => 'insufficient parameters', 'status' => '0'];
|
||||
}
|
||||
} else {
|
||||
return ['response'=>'fail','reason'=>'this system is already installed','status'=>'0'];
|
||||
return ['response' => 'fail', 'reason' => 'this system is already installed', 'status' => '0'];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,14 +108,14 @@ class InstallerApiController extends Controller {
|
||||
Artisan::call('db:seed', array('--force' => true));
|
||||
|
||||
// checking requested timezone for the admin and system
|
||||
$timezones = Timezones::where('name','=',$timezone)->first();
|
||||
if($timezones->id == null){
|
||||
return ['response'=>'fail','reason'=>'Invalid time-zone','status'=>'0'];
|
||||
$timezones = Timezones::where('name', '=', $timezone)->first();
|
||||
if ($timezones->id == null) {
|
||||
return ['response' => 'fail', 'reason' => 'Invalid time-zone', 'status' => '0'];
|
||||
}
|
||||
// checking requested date time format for the admin and system
|
||||
$date_time_format = Date_time_format::where('format','=',$datetime)->first();
|
||||
if($date_time_format->id == null){
|
||||
return ['response'=>'fail','reason'=>'invalid date-time format','status'=>'0'];
|
||||
$date_time_format = Date_time_format::where('format', '=', $datetime)->first();
|
||||
if ($date_time_format->id == null) {
|
||||
return ['response' => 'fail', 'reason' => 'invalid date-time format', 'status' => '0'];
|
||||
}
|
||||
// Creating minum settings for system
|
||||
$system = new System;
|
||||
@@ -144,17 +147,23 @@ class InstallerApiController extends Controller {
|
||||
|
||||
// Applying email configuration on route
|
||||
$smtpfilepath = "\App\Http\Controllers\Common\SettingsController::smtp()";
|
||||
$lfmpath = "url('photos').'/'";
|
||||
$path22 = app_path('Http/routes.php');
|
||||
$path23 = app_path('config/lfm.php');
|
||||
$content23 = File::get($path22);
|
||||
$content24 = File::get($path23);
|
||||
$content23 = str_replace('"%smtplink%"', $smtpfilepath, $content23);
|
||||
$content24 = str_replace("'%url%'", $lfmpath, $content24);
|
||||
File::put($path22, $content23);
|
||||
File::put($path23, $content24);
|
||||
|
||||
// If user created return success
|
||||
if($user){
|
||||
return ['response'=>'success','status'=>'1'];
|
||||
if ($user) {
|
||||
return ['response' => 'success', 'status' => '1'];
|
||||
}
|
||||
} else {
|
||||
return ['response'=>'fail','reason'=>'this system is already installed','status'=>'0'];
|
||||
return ['response' => 'fail', 'reason' => 'this system is already installed', 'status' => '0'];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -57,27 +57,27 @@ class TestController extends Controller {
|
||||
|
||||
public function TicketReply() {
|
||||
|
||||
$file = file_get_contents(base_path() . '/../lb-faveo/Img/Ladybird.png');
|
||||
//$file = file_get_contents(base_path() . '/../lb-faveo/Img/Ladybird.png');
|
||||
|
||||
$data = [
|
||||
|
||||
'ticket_ID' => '81',
|
||||
'ticket_ID' => '13',
|
||||
'ReplyContent' => 'reply for the ticket id',
|
||||
'api-key' => 'clYbe1g7BYVEJznBdvCEBR0xDCLDqKgg',
|
||||
'attachments' => [
|
||||
[
|
||||
'name' => 'ladybird',
|
||||
'size' => '26398',
|
||||
'type' => 'png',
|
||||
'file' => $file,
|
||||
],
|
||||
[
|
||||
'name' => 'ladybird',
|
||||
'size' => '26398',
|
||||
'type' => 'png',
|
||||
'file' => $file,
|
||||
]
|
||||
],
|
||||
// 'attachments' => [
|
||||
// [
|
||||
// 'name' => 'ladybird',
|
||||
// 'size' => '26398',
|
||||
// 'type' => 'png',
|
||||
// 'file' => $file,
|
||||
// ],
|
||||
// [
|
||||
// 'name' => 'ladybird',
|
||||
// 'size' => '26398',
|
||||
// 'type' => 'png',
|
||||
// 'file' => $file,
|
||||
// ]
|
||||
// ],
|
||||
];
|
||||
$data = http_build_query($data, '', '&');
|
||||
|
||||
@@ -90,10 +90,10 @@ class TestController extends Controller {
|
||||
|
||||
public function CreateTicket() {
|
||||
|
||||
$file = file_get_contents(base_path() . '/../lb-faveo/Img/Ladybird.png');
|
||||
//$file = file_get_contents(base_path() . '/../lb-faveo/Img/Ladybird.png');
|
||||
|
||||
$data = [
|
||||
'user_id' => '1',
|
||||
'user_id' => 1,
|
||||
'subject' => 'Api create via faveo api',
|
||||
'body' => 'Test me when call api',
|
||||
'helptopic' => '1',
|
||||
@@ -101,24 +101,22 @@ class TestController extends Controller {
|
||||
'priority' => '1',
|
||||
'headers' => [0 => 'vijaycodename47@gmail.com'],
|
||||
'dept' => '1',
|
||||
'assignto' => '0',
|
||||
'source' => 'api',
|
||||
'api-key' => 'clYbe1g7BYVEJznBdvCEBR0xDCLDqKgg',
|
||||
/** if attachment */
|
||||
'attachments' => [
|
||||
[
|
||||
'name' => 'ladybird',
|
||||
'size' => '26398',
|
||||
'type' => 'png',
|
||||
'file' => $file,
|
||||
],
|
||||
[
|
||||
'name' => 'ladybird',
|
||||
'size' => '26398',
|
||||
'type' => 'png',
|
||||
'file' => $file,
|
||||
]
|
||||
],
|
||||
// 'attachments' => [
|
||||
// [
|
||||
// 'name' => 'ladybird',
|
||||
// 'size' => '26398',
|
||||
// 'type' => 'png',
|
||||
// 'file' => $file,
|
||||
// ],
|
||||
// [
|
||||
// 'name' => 'ladybird',
|
||||
// 'size' => '26398',
|
||||
// 'type' => 'png',
|
||||
// 'file' => $file,
|
||||
// ]
|
||||
// ],
|
||||
];
|
||||
$data = http_build_query($data, '', '&');
|
||||
|
||||
@@ -162,7 +160,7 @@ class TestController extends Controller {
|
||||
|
||||
public function GetAuthUser() {
|
||||
|
||||
$url = $this->server . "authenticate/user?token=" . \Config::get('app.token');
|
||||
$url = $this->server . "authenticate/user?api-key=clYbe1g7BYVEJznBdvCEBR0xDCLDqKgg&token=" . \Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->CallGetApi($url);
|
||||
return $respose;
|
||||
@@ -170,12 +168,12 @@ class TestController extends Controller {
|
||||
|
||||
public function EditTicket() {
|
||||
$data = [
|
||||
'ticket_id' => '81',
|
||||
'ticket_id' => '13',
|
||||
'subject' => 'Api editing ticket via faveo api',
|
||||
'sla_plan' => '2',
|
||||
'help_topic' => '2',
|
||||
'ticket_source' => '2',
|
||||
'api-key' => 'clYbe1g7BYVEJznBdvCEBR0xDCLDqKgg',
|
||||
'api-key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN',
|
||||
'ticket_priority' => '2',
|
||||
];
|
||||
|
||||
@@ -188,8 +186,8 @@ class TestController extends Controller {
|
||||
|
||||
public function DeleteTicket() {
|
||||
$data = [
|
||||
'ticket_id' => [],
|
||||
'api-key' => 'clYbe1g7BYVEJznBdvCEBR0xDCLDqKgg'
|
||||
'ticket_id' => [11],
|
||||
'api-key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN'
|
||||
];
|
||||
|
||||
$data = http_build_query($data, '', '&');
|
||||
@@ -200,35 +198,35 @@ class TestController extends Controller {
|
||||
}
|
||||
|
||||
public function OpenedTickets() {
|
||||
$url = $this->server . "helpdesk/open?token=" . \Config::get('app.token');
|
||||
$url = $this->server . "helpdesk/open?api-key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->CallGetApi($url);
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function UnassignedTickets() {
|
||||
$url = $this->server . "helpdesk/unassigned?token=" . \Config::get('app.token');
|
||||
$url = $this->server . "helpdesk/unassigned?api-key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->CallGetApi($url);
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function CloseTickets() {
|
||||
$url = $this->server . "helpdesk/closed?token=" . \Config::get('app.token');
|
||||
$url = $this->server . "helpdesk/closed?api-key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->CallGetApi($url);
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function GetAgents() {
|
||||
$url = $this->server . "helpdesk/agents?token=" . \Config::get('app.token');
|
||||
$url = $this->server . "helpdesk/agents?api-key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->CallGetApi($url);
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function GetTeams() {
|
||||
$url = $this->server . "helpdesk/teams?token=" . \Config::get('app.token');
|
||||
$url = $this->server . "helpdesk/teams?api-key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->CallGetApi($url);
|
||||
return $respose;
|
||||
@@ -236,9 +234,9 @@ class TestController extends Controller {
|
||||
|
||||
public function AssignTicket() {
|
||||
$data = [
|
||||
'ticket_id' => '8',
|
||||
'user' => 'vijay.sebastian@ladybird.com',
|
||||
'api-key' => 'clYbe1g7BYVEJznBdvCEBR0xDCLDqKgg'
|
||||
'ticket_id' => 1,
|
||||
'user' => 'vijay.sebastian@ladybirdweb.com',
|
||||
'api-key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN'
|
||||
];
|
||||
$data = http_build_query($data, '', '&');
|
||||
$url = $this->server . "helpdesk/assign?token=" . \Config::get('app.token');
|
||||
@@ -250,7 +248,7 @@ class TestController extends Controller {
|
||||
public function GetCustomers() {
|
||||
$search = [
|
||||
'search' => 'vij',
|
||||
'api-key' => 'clYbe1g7BYVEJznBdvCEBR0xDCLDqKgg'
|
||||
'api-key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN'
|
||||
];
|
||||
$data = http_build_query($search, '', '&');
|
||||
$url = $this->server . "helpdesk/customers?token=" . \Config::get('app.token');
|
||||
@@ -263,7 +261,7 @@ class TestController extends Controller {
|
||||
public function GetCustomer() {
|
||||
$search = [
|
||||
'user_id' => '1',
|
||||
'api-key' => 'clYbe1g7BYVEJznBdvCEBR0xDCLDqKgg'
|
||||
'api-key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN'
|
||||
];
|
||||
$data = http_build_query($search, '', '&');
|
||||
$url = $this->server . "helpdesk/customer?token=" . \Config::get('app.token');
|
||||
@@ -276,7 +274,7 @@ class TestController extends Controller {
|
||||
public function GetSearch() {
|
||||
$search = [
|
||||
'search' => 'api',
|
||||
'api-key' => 'clYbe1g7BYVEJznBdvCEBR0xDCLDqKgg'
|
||||
'api-key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN'
|
||||
];
|
||||
$data = http_build_query($search, '', '&');
|
||||
$url = $this->server . "helpdesk/ticket-search?token=" . \Config::get('app.token');
|
||||
@@ -288,8 +286,8 @@ class TestController extends Controller {
|
||||
|
||||
public function TicketThreads() {
|
||||
$search = [
|
||||
'id' => '8',
|
||||
'api-key' => 'clYbe1g7BYVEJznBdvCEBR0xDCLDqKgg'
|
||||
'id' => '1',
|
||||
'api-key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN'
|
||||
];
|
||||
$data = http_build_query($search, '', '&');
|
||||
$url = $this->server . "helpdesk/ticket-thread?token=" . \Config::get('app.token');
|
||||
@@ -301,8 +299,8 @@ class TestController extends Controller {
|
||||
|
||||
public function Url() {
|
||||
$search = [
|
||||
'url' => 'http://localhost/FaveoHELPDESK+KBLatests',
|
||||
'api-key' => 'clYbe1g7BYVEJznBdvCEBR0xDCLDqKgg'
|
||||
'url' => 'http://localhost/Faveo-HelpDesk-My-Branch/public/',
|
||||
'api-key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN'
|
||||
];
|
||||
$data = http_build_query($search, '', '&');
|
||||
$url = $this->server . "helpdesk/url?token=" . \Config::get('app.token');
|
||||
@@ -313,21 +311,21 @@ class TestController extends Controller {
|
||||
}
|
||||
|
||||
public function GenerateApiKey() {
|
||||
$url = $this->server . "helpdesk/api-key?token=" . \Config::get('app.token');
|
||||
$url = $this->server . "helpdesk/api-key?api-key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->CallGetApi($url);
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function GetHelpTopic() {
|
||||
$url = $this->server . "helpdesk/help-topic?api-key=clYbe1g7BYVEJznBdvCEBR0xDCLDqKgg&token=" . \Config::get('app.token');
|
||||
$url = $this->server . "helpdesk/help-topic?api-key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->CallGetApi($url);
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function GetSlaPlan() {
|
||||
$url = $this->server . "helpdesk/sla-plan?api-key=clYbe1g7BYVEJznBdvCEBR0xDCLDqKgg&token=" . \Config::get('app.token');
|
||||
$url = $this->server . "helpdesk/sla-plan?api-key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->CallGetApi($url);
|
||||
return $respose;
|
||||
@@ -341,21 +339,21 @@ class TestController extends Controller {
|
||||
}
|
||||
|
||||
public function GetDepartment() {
|
||||
$url = $this->server . "helpdesk/department?api-key=clYbe1g7BYVEJznBdvCEBR0xDCLDqKgg&token=" . \Config::get('app.token');
|
||||
$url = $this->server . "helpdesk/department?api-key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->CallGetApi($url);
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function GetTickets() {
|
||||
$url = $this->server . "helpdesk/tickets?api-key=clYbe1g7BYVEJznBdvCEBR0xDCLDqKgg&token=" . \Config::get('app.token');
|
||||
$url = $this->server . "helpdesk/tickets?api-key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->CallGetApi($url);
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function Inbox() {
|
||||
$url = $this->server . "helpdesk/inbox?api-key=clYbe1g7BYVEJznBdvCEBR0xDCLDqKgg&token=" . \Config::get('app.token');
|
||||
$url = $this->server . "helpdesk/inbox?api-key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->CallGetApi($url);
|
||||
return $respose;
|
||||
@@ -366,7 +364,7 @@ class TestController extends Controller {
|
||||
'ticketid' => '23',
|
||||
'userid' => 1,
|
||||
'body' => 'Testing the api internal note',
|
||||
'api-key' => 'clYbe1g7BYVEJznBdvCEBR0xDCLDqKgg'
|
||||
'api-key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN'
|
||||
];
|
||||
$data = http_build_query($data, '', '&');
|
||||
$url = $this->server . "helpdesk/internal-note?token=" . \Config::get('app.token');
|
||||
|
@@ -17,6 +17,7 @@ use App\Model\helpdesk\Ticket\Ticket_Status;
|
||||
use App\Model\helpdesk\Ticket\Ticket_attachments;
|
||||
use App\Model\helpdesk\Settings\System;
|
||||
use App\Model\helpdesk\Settings\Alert;
|
||||
use Hash;
|
||||
|
||||
/**
|
||||
* -----------------------------------------------------------------------------
|
||||
@@ -31,7 +32,6 @@ use App\Model\helpdesk\Settings\Alert;
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
class TicketController extends Controller {
|
||||
|
||||
/**
|
||||
@@ -47,6 +47,7 @@ class TicketController extends Controller {
|
||||
public function create_ticket($user_id, $subject, $body, $helptopic, $sla, $priority, $source, $headers, $dept, $assignto, $form_data, $attach = '') {
|
||||
try {
|
||||
$max_number = Tickets::whereRaw('id = (select max(`id`) from tickets)')->first();
|
||||
//dd($max_number);
|
||||
if ($max_number == null) {
|
||||
$ticket_number = "AAAA-9999-9999999";
|
||||
} else {
|
||||
@@ -56,6 +57,7 @@ class TicketController extends Controller {
|
||||
}
|
||||
$ticket = new Tickets;
|
||||
$ticket->ticket_number = $this->ticket_number($ticket_number);
|
||||
//dd($this->ticket_number($ticket_number));
|
||||
$ticket->user_id = $user_id;
|
||||
$ticket->dept_id = $dept;
|
||||
$ticket->help_topic_id = $helptopic;
|
||||
@@ -65,6 +67,7 @@ class TicketController extends Controller {
|
||||
$ticket->priority_id = $priority;
|
||||
$ticket->source = $source;
|
||||
$ticket->save();
|
||||
//dd($ticket);
|
||||
$ticket_number = $ticket->ticket_number;
|
||||
$id = $ticket->id;
|
||||
if ($form_data != null) {
|
||||
@@ -93,6 +96,7 @@ class TicketController extends Controller {
|
||||
}
|
||||
return $thread;
|
||||
} catch (\Exception $e) {
|
||||
dd($e);
|
||||
return $e->getMessage();
|
||||
}
|
||||
}
|
||||
@@ -170,6 +174,7 @@ class TicketController extends Controller {
|
||||
*/
|
||||
public function ticket_number($ticket_number) {
|
||||
try {
|
||||
//dd($ticket_number);
|
||||
$number = $ticket_number;
|
||||
$number = explode('-', $number);
|
||||
$number1 = $number[0];
|
||||
@@ -193,6 +198,7 @@ class TicketController extends Controller {
|
||||
$number = implode('-', $array);
|
||||
return $number;
|
||||
} catch (\Exception $e) {
|
||||
dd($e);
|
||||
return $e->getMessage();
|
||||
}
|
||||
}
|
||||
@@ -373,15 +379,24 @@ class TicketController extends Controller {
|
||||
public function assign($id) {
|
||||
try {
|
||||
$UserEmail = Input::get('user');
|
||||
//dd($id);
|
||||
//dd($UserEmail);
|
||||
// $UserEmail = 'sujitprasad12@yahoo.in';
|
||||
$user = User::where('email', '=', $UserEmail)->first();
|
||||
if (!$user) {
|
||||
return ['error' => 'No agent not found'];
|
||||
}
|
||||
$user_id = $user->id;
|
||||
$ticket = Tickets::where('id', '=', $id)->first();
|
||||
if (!$ticket) {
|
||||
return ['error' => 'No ticket not found'];
|
||||
}
|
||||
$ticket_number = $ticket->ticket_number;
|
||||
$ticket->assigned_to = $user_id;
|
||||
$ticket->save();
|
||||
$ticket_thread = Ticket_Thread::where('ticket_id', '=', $id)->first();
|
||||
if (!$ticket_thread) {
|
||||
return ['error' => 'No thread not found'];
|
||||
}
|
||||
$ticket_subject = $ticket_thread->title;
|
||||
$thread = New Ticket_Thread;
|
||||
$thread->ticket_id = $ticket->id;
|
||||
@@ -497,6 +512,7 @@ class TicketController extends Controller {
|
||||
return $e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create Attachment
|
||||
* @param type $thread
|
||||
|
@@ -23,18 +23,19 @@ use Illuminate\Support\Facades\Hash;
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
class TokenAuthController extends Controller {
|
||||
|
||||
public function __construct() {
|
||||
$this->middleware('api');
|
||||
}
|
||||
|
||||
/**
|
||||
* Authenticating user with username and password and retuen token
|
||||
* @param Request $request
|
||||
* @return type json
|
||||
*/
|
||||
public function authenticate(Request $request) {
|
||||
|
||||
$usernameinput = $request->input('username');
|
||||
$password = $request->input('password');
|
||||
$field = filter_var($usernameinput, FILTER_VALIDATE_EMAIL) ? 'email' : 'user_name';
|
||||
@@ -43,11 +44,11 @@ class TokenAuthController extends Controller {
|
||||
|
||||
try {
|
||||
if (!$token = JWTAuth::attempt([$field => $usernameinput, 'password' => $password])) {
|
||||
return response()->json(['error' => 'invalid_credentials', 'status_code'=>401]);
|
||||
return response()->json(['error' => 'invalid_credentials', 'status_code' => 401]);
|
||||
}
|
||||
} catch (JWTException $e) {
|
||||
return response()->json(['error' => 'could_not_create_token', 500]);
|
||||
} catch (\Exception $e){
|
||||
} catch (\Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
@@ -55,6 +56,7 @@ class TokenAuthController extends Controller {
|
||||
// if no errors are encountered we can return a JWT
|
||||
return response()->json(compact('token'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the user details from token
|
||||
* @return type json
|
||||
@@ -75,8 +77,7 @@ class TokenAuthController extends Controller {
|
||||
} catch (\Tymon\JWTAuth\Exceptions\JWTException $e) {
|
||||
|
||||
return response()->json(['token_absent', $e->getStatusCode()]);
|
||||
}
|
||||
catch (\Exception $e){
|
||||
} catch (\Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
@@ -110,6 +111,7 @@ class TokenAuthController extends Controller {
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* verify the url is existing or not
|
||||
* @return type json
|
||||
@@ -125,8 +127,7 @@ class TokenAuthController extends Controller {
|
||||
}
|
||||
|
||||
$url = $this->request->input('url');
|
||||
$url = $url.'/api/v1/helpdesk/check-url';
|
||||
|
||||
$url = $url . '/api/v1/helpdesk/check-url';
|
||||
} catch (Exception $ex) {
|
||||
$error = $e->getMessage();
|
||||
return response()->json(compact('error'));
|
||||
|
@@ -1,14 +1,15 @@
|
||||
<?php namespace App\Http\Controllers\Auth;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Controllers\Common\SettingsController;
|
||||
|
||||
use App\Http\Controllers\Common\PhpMailController;
|
||||
// requests
|
||||
use App\Http\Requests\helpdesk\LoginRequest;
|
||||
use App\Http\Requests\helpdesk\RegisterRequest;
|
||||
use App\User;
|
||||
|
||||
// classes
|
||||
use Hash;
|
||||
use Illuminate\Contracts\Auth\Guard;
|
||||
@@ -18,7 +19,6 @@ use Mail;
|
||||
use Auth;
|
||||
use Exception;
|
||||
|
||||
|
||||
/**
|
||||
* ---------------------------------------------------
|
||||
* AuthController
|
||||
@@ -35,6 +35,7 @@ class AuthController extends Controller {
|
||||
|
||||
use AuthenticatesAndRegistersUsers;
|
||||
/* to redirect after login */
|
||||
|
||||
// if auth is agent
|
||||
protected $redirectTo = '/dashboard';
|
||||
// if auth is user
|
||||
@@ -50,7 +51,8 @@ class AuthController extends Controller {
|
||||
* @param \Illuminate\Contracts\Auth\Registrar $registrar
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Guard $auth, Registrar $registrar) {
|
||||
public function __construct(Guard $auth, Registrar $registrar, PhpMailController $PhpMailController) {
|
||||
$this->PhpMailController = $PhpMailController;
|
||||
SettingsController::smtp();
|
||||
$this->auth = $auth;
|
||||
$this->registrar = $registrar;
|
||||
@@ -64,10 +66,10 @@ class AuthController extends Controller {
|
||||
public function getRegister() {
|
||||
// Event for login
|
||||
\Event::fire(new \App\Events\FormRegisterEvent());
|
||||
if(Auth::user()) {
|
||||
if(Auth::user()->role == "admin" || Auth::user()->role == "agent") {
|
||||
if (Auth::user()) {
|
||||
if (Auth::user()->role == "admin" || Auth::user()->role == "agent") {
|
||||
return \Redirect::route('dashboard');
|
||||
} elseif(Auth::user()->role == "user") {
|
||||
} elseif (Auth::user()->role == "user") {
|
||||
// return view('auth.register');
|
||||
}
|
||||
} else {
|
||||
@@ -99,13 +101,17 @@ class AuthController extends Controller {
|
||||
$user->remember_token = $code;
|
||||
$user->save();
|
||||
// send mail for successful registration
|
||||
$mail = Mail::send('auth.activate', array('link' => url('getmail', $code), 'username' => $name), function ($message) use ($user) {
|
||||
$message->to($user->email, $user->full_name)->subject('active your account');
|
||||
});
|
||||
// $mail = Mail::send('auth.activate', array('link' => url('getmail', $code), 'username' => $name), function ($message) use ($user) {
|
||||
// $message->to($user->email, $user->full_name)->subject('active your account');
|
||||
// });
|
||||
|
||||
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $name, 'email' => $request->input('email')], $message = ['subject' => 'password', 'scenario' => 'registration-notification'], $template_variables = ['user' => $name, 'email_address' => $request->input('email'), 'password_reset_link' => url('password/reset/' . $code)]);
|
||||
|
||||
|
||||
|
||||
return redirect('home')->with('success', 'Activate Your Account ! Click on Link that send to your mail');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get mail function
|
||||
* @param type $token
|
||||
@@ -128,10 +134,10 @@ class AuthController extends Controller {
|
||||
* @return type Response
|
||||
*/
|
||||
public function getLogin() {
|
||||
if(Auth::user()) {
|
||||
if(Auth::user()->role == "admin" || Auth::user()->role == "agent"){
|
||||
if (Auth::user()) {
|
||||
if (Auth::user()->role == "admin" || Auth::user()->role == "agent") {
|
||||
return \Redirect::route('dashboard');
|
||||
} elseif(Auth::user()->role == "user") {
|
||||
} elseif (Auth::user()->role == "user") {
|
||||
return \Redirect::route('home');
|
||||
}
|
||||
} else {
|
||||
@@ -174,7 +180,7 @@ class AuthController extends Controller {
|
||||
// If auth ok, redirect to restricted area
|
||||
\Session::put('loginAttempts', $loginAttempts + 1);
|
||||
if ($this->auth->attempt([$field => $usernameinput, 'password' => $password], $request->has('remember'))) {
|
||||
if(Auth::user()->role == 'user') {
|
||||
if (Auth::user()->role == 'user') {
|
||||
return \Redirect::route('/');
|
||||
} else {
|
||||
return redirect()->intended($this->redirectPath());
|
||||
|
@@ -1,14 +1,15 @@
|
||||
<?php namespace App\Http\Controllers\Auth;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Controllers\Common\SettingsController;
|
||||
|
||||
use App\Http\Controllers\Common\PhpMailController;
|
||||
// request
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
// model
|
||||
use App\User;
|
||||
|
||||
// classes
|
||||
use Illuminate\Contracts\Auth\Guard;
|
||||
use Illuminate\Contracts\Auth\PasswordBroker;
|
||||
@@ -34,14 +35,14 @@ class PasswordController extends Controller {
|
||||
* @param \Illuminate\Contracts\Auth\PasswordBroker $passwords
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Guard $auth, PasswordBroker $passwords) {
|
||||
public function __construct(Guard $auth, PasswordBroker $passwords, PhpMailController $PhpMailController) {
|
||||
$this->PhpMailController = $PhpMailController;
|
||||
$this->auth = $auth;
|
||||
$this->passwords = $passwords;
|
||||
$this->middleware('guest');
|
||||
SettingsController::smtp();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Display the form to request a password reset link.
|
||||
*
|
||||
@@ -51,5 +52,35 @@ class PasswordController extends Controller {
|
||||
return view('auth.password');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the form to request a password reset link.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function postEmail(Request $request) {
|
||||
$date = date('Y-m-d H:i:s');
|
||||
$this->validate($request, ['email' => 'required|email']);
|
||||
$user = User::where('email', '=', $request->only('email'))->first();
|
||||
if (isset($user)) {
|
||||
$user1 = $user->email;
|
||||
//gen new code and pass
|
||||
$code = str_random(60);
|
||||
$password_reset_table = \DB::table('password_resets')->where('email', '=', $user->email)->first();
|
||||
if (isset($password_reset_table)) {
|
||||
|
||||
$password_reset_table = \DB::table('password_resets')->where('email', '=', $user->email)->update(['token' => $code, 'created_at' => $date]);
|
||||
// $password_reset_table->token = $code;
|
||||
// $password_reset_table->update(['token' => $code]);
|
||||
} else {
|
||||
$create_password_reset = \DB::table('password_resets')->insert(['email' => $user->email, 'token' => $code, 'created_at' => $date]);
|
||||
}
|
||||
|
||||
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $user->user_name, 'email' => $user->email], $message = ['subject' => 'Your Password Reset Link', 'scenario' => 'reset-password'], $template_variables = ['user' => $user->user_name, 'email_address' => $user->email, 'password_reset_link' => url('password/reset/' . $code)]);
|
||||
|
||||
return redirect()->back()->with('status', 'We have e-mailed your password reset link!');
|
||||
} else {
|
||||
return redirect()->back()->with('errors', "We can't find a user with that e-mail address.");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php namespace App\Http\Controllers\Agent\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Agent\helpdesk;
|
||||
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
// requests
|
||||
@@ -72,7 +75,7 @@ class UserController extends Controller {
|
||||
*/
|
||||
public function user_list() {
|
||||
|
||||
return \Datatable::collection(User::where('role','!=','admin')->where('role','!=','agent')->get())
|
||||
return \Datatable::collection(User::where('role', '!=', 'admin')->where('role', '!=', 'agent')->get())
|
||||
->searchColumns('user_name')
|
||||
->orderColumns('user_name', 'email')
|
||||
->addColumn('user_name', function ($model) {
|
||||
@@ -84,19 +87,19 @@ class UserController extends Controller {
|
||||
})
|
||||
->addColumn('phone', function ($model) {
|
||||
$phone = "";
|
||||
if($model->phone_number) {
|
||||
if ($model->phone_number) {
|
||||
$phone = $model->ext . ' ' . $model->phone_number;
|
||||
}
|
||||
$mobile = "";
|
||||
if($model->mobile) {
|
||||
if ($model->mobile) {
|
||||
$mobile = $model->mobile;
|
||||
}
|
||||
$phone = $phone ." ". $mobile;
|
||||
$phone = $phone . " " . $mobile;
|
||||
return $phone;
|
||||
})
|
||||
->addColumn('status', function ($model) {
|
||||
$status = $model->active;
|
||||
if($status == 1) {
|
||||
if ($status == 1) {
|
||||
$stat = '<button class="btn btn-success btn-xs">Active</button>';
|
||||
} else {
|
||||
$stat = '<button class="btn btn-danger btn-xs">Inactive</button>';
|
||||
@@ -110,8 +113,8 @@ class UserController extends Controller {
|
||||
->addColumn('Actions', function ($model) {
|
||||
//return '<a href=article/delete/ ' . $model->id . ' class="btn btn-danger btn-flat" onclick="myFunction()">Delete</a> <a href=article/' . $model->id . '/edit class="btn btn-warning btn-flat">Edit</a> <a href=show/' . $model->id . ' class="btn btn-warning btn-flat">View</a>';
|
||||
//return '<form action="article/delete/ ' . $model->id . '" method="post" onclick="alert()"><button type="sumbit" value="Delete"></button></form><a href=article/' . $model->id . '/edit class="btn btn-warning btn-flat">Edit</a> <a href=show/' . $model->id . ' class="btn btn-warning btn-flat">View</a>';
|
||||
return '<span data-toggle="modal" data-target="#deletearticle'.$model->id .'"><a href="#" ><button class="btn btn-danger btn-xs"></a> ' . \Lang::get('lang.delete') . ' </button></span> <a href="'.route('user.edit', $model->id).'" class="btn btn-warning btn-xs">' . \Lang::get('lang.edit') . '</a> <a href="'.route('user.show', $model->id).'" class="btn btn-primary btn-xs">' . \Lang::get('lang.view') . '</a>
|
||||
<div class="modal fade" id="deletearticle'.$model->id .'">
|
||||
return '<span data-toggle="modal" data-target="#deletearticle' . $model->id . '"><a href="#" ><button class="btn btn-danger btn-xs"></a> ' . \Lang::get('lang.delete') . ' </button></span> <a href="' . route('user.edit', $model->id) . '" class="btn btn-warning btn-xs">' . \Lang::get('lang.edit') . '</a> <a href="' . route('user.show', $model->id) . '" class="btn btn-primary btn-xs">' . \Lang::get('lang.view') . '</a>
|
||||
<div class="modal fade" id="deletearticle' . $model->id . '">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
@@ -119,11 +122,11 @@ class UserController extends Controller {
|
||||
<h4 class="modal-title">Are You Sure ?</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
'.$model->user_name.'
|
||||
' . $model->user_name . '
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">Close</button>
|
||||
<a href="'.route('user.delete',$model->id).'"><button class="btn btn-danger">delete</button></a>
|
||||
<a href="' . route('user.delete', $model->id) . '"><button class="btn btn-danger">delete</button></a>
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
@@ -352,21 +355,21 @@ class UserController extends Controller {
|
||||
*/
|
||||
public function User_Create_Org($id) {
|
||||
|
||||
if(Input::get('website')!=null) {
|
||||
if (Input::get('website') != null) {
|
||||
// checking website
|
||||
$check = Organization::where('website','=',Input::get('website'))->first();
|
||||
$check = Organization::where('website', '=', Input::get('website'))->first();
|
||||
} else {
|
||||
$check = null;
|
||||
}
|
||||
|
||||
// checking name
|
||||
$check2 = Organization::where('name','=',Input::get('name'))->first();
|
||||
$check2 = Organization::where('name', '=', Input::get('name'))->first();
|
||||
|
||||
if (\Input::get('name') == null) {
|
||||
return "Name is required";
|
||||
} elseif($check2 != null) {
|
||||
} elseif ($check2 != null) {
|
||||
return "Name should be Unique";
|
||||
} elseif($check != null) {
|
||||
} elseif ($check != null) {
|
||||
return "Website should be Unique";
|
||||
} else {
|
||||
$org = new Organization;
|
||||
@@ -385,4 +388,5 @@ class UserController extends Controller {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -1,16 +1,16 @@
|
||||
<?php namespace App\Http\Controllers\Client\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Client\helpdesk;
|
||||
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Controllers\Agent\helpdesk\TicketController;
|
||||
use App\Http\Controllers\Common\SettingsController;
|
||||
|
||||
// requests
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Requests\helpdesk\CreateTicketRequest;
|
||||
use App\Http\Requests\helpdesk\TicketRequest;
|
||||
use App\Http\Requests\helpdesk\TicketEditRequest;
|
||||
|
||||
// models
|
||||
use App\Model\helpdesk\Email\Banlist;
|
||||
use App\Model\helpdesk\Ticket\Tickets;
|
||||
@@ -24,7 +24,6 @@ use App\Model\helpdesk\Ticket\Ticket_Status;
|
||||
use App\Model\helpdesk\Email\Emails;
|
||||
use App\Model\helpdesk\Agent\Department;
|
||||
use App\User;
|
||||
|
||||
// classes
|
||||
use Auth;
|
||||
use Hash;
|
||||
@@ -69,8 +68,8 @@ class ClientTicketController extends Controller {
|
||||
*/
|
||||
public function reply($id, Request $request) {
|
||||
$comment = $request->input('comment');
|
||||
if($comment != null) {
|
||||
$tickets = Tickets::where('id','=',$id)->first();
|
||||
if ($comment != null) {
|
||||
$tickets = Tickets::where('id', '=', $id)->first();
|
||||
$tickets->closed_at = null;
|
||||
$tickets->closed = 0;
|
||||
$tickets->reopened_at = date('Y-m-d H:i:s');
|
||||
@@ -83,14 +82,13 @@ class ClientTicketController extends Controller {
|
||||
try {
|
||||
$threads->save();
|
||||
$tickets->save();
|
||||
return \Redirect::back()->with('success1','Successfully replied');
|
||||
} catch(Exception $e) {
|
||||
return \Redirect::back()->with('fails1',$e->errorInfo[2]);
|
||||
return \Redirect::back()->with('success1', 'Successfully replied');
|
||||
} catch (Exception $e) {
|
||||
return \Redirect::back()->with('fails1', $e->errorInfo[2]);
|
||||
}
|
||||
} else {
|
||||
return \Redirect::back()->with('fails1','Please fill some data!');
|
||||
return \Redirect::back()->with('fails1', 'Please fill some data!');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -1,11 +1,11 @@
|
||||
<?php namespace App\Http\Controllers\Client\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Client\helpdesk;
|
||||
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
// models
|
||||
use App\Model\helpdesk\Email\Emails;
|
||||
|
||||
// classes
|
||||
use Exception;
|
||||
|
||||
@@ -23,9 +23,8 @@ class OuthouseController extends Controller {
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function port()
|
||||
{
|
||||
$port = Emails::where('id','=','1')->first();
|
||||
public static function port() {
|
||||
$port = Emails::where('id', '=', '1')->first();
|
||||
$portvalue = $port->option_value;
|
||||
return $portvalue;
|
||||
}
|
||||
@@ -35,10 +34,9 @@ class OuthouseController extends Controller {
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function host()
|
||||
{
|
||||
$host=Option::where('option_name','=','host')->first();
|
||||
$hostvalue=$host->option_value;
|
||||
public static function host() {
|
||||
$host = Option::where('option_name', '=', 'host')->first();
|
||||
$hostvalue = $host->option_value;
|
||||
return $hostvalue;
|
||||
}
|
||||
|
||||
@@ -47,10 +45,9 @@ class OuthouseController extends Controller {
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function username()
|
||||
{
|
||||
$username=Option::where('option_name','=','username')->first();
|
||||
$uservalue=$username->option_value;
|
||||
public static function username() {
|
||||
$username = Option::where('option_name', '=', 'username')->first();
|
||||
$uservalue = $username->option_value;
|
||||
|
||||
return $uservalue;
|
||||
}
|
||||
@@ -60,10 +57,9 @@ class OuthouseController extends Controller {
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function password()
|
||||
{
|
||||
$password=Option::where('option_name','=','password')->first();
|
||||
$passvalue=$password->option_value;
|
||||
public static function password() {
|
||||
$password = Option::where('option_name', '=', 'password')->first();
|
||||
$passvalue = $password->option_value;
|
||||
|
||||
return $passvalue;
|
||||
}
|
||||
@@ -73,10 +69,9 @@ class OuthouseController extends Controller {
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function encryption()
|
||||
{
|
||||
$encryption=Option::where('option_name','=','encryption')->first();
|
||||
$encryptvalue=$encryption->option_value;
|
||||
public static function encryption() {
|
||||
$encryption = Option::where('option_name', '=', 'encryption')->first();
|
||||
$encryptvalue = $encryption->option_value;
|
||||
|
||||
return $encryptvalue;
|
||||
}
|
||||
|
@@ -1,14 +1,14 @@
|
||||
<?php namespace App\Http\Controllers\Client\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Client\helpdesk;
|
||||
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Controllers\Agent\helpdesk\TicketController;
|
||||
use App\Http\Controllers\Common\SettingsController;
|
||||
|
||||
// requests
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Requests\helpdesk\ClientRequest;
|
||||
|
||||
// models
|
||||
use App\Model\helpdesk\Form\Forms;
|
||||
use App\Model\helpdesk\Manage\Help_topic;
|
||||
@@ -22,7 +22,6 @@ use App\Model\helpdesk\Ticket\Ticket_source;
|
||||
use App\User;
|
||||
use App\Model\helpdesk\Form\Fields;
|
||||
use App\Model\helpdesk\Form\Form_value;
|
||||
|
||||
// classes
|
||||
use Form;
|
||||
use Input;
|
||||
@@ -61,10 +60,10 @@ class FormController extends Controller {
|
||||
* @return type
|
||||
*/
|
||||
public function getForm(Help_topic $topic) {
|
||||
if(\Config::get('database.install') == '%0%') {
|
||||
if (\Config::get('database.install') == '%0%') {
|
||||
return \Redirect::route('license');
|
||||
}
|
||||
if(System::first()->status == 1) {
|
||||
if (System::first()->status == 1) {
|
||||
$topics = $topic->get();
|
||||
return view('themes.default1.client.helpdesk.form', compact('topics'));
|
||||
} else {
|
||||
@@ -80,41 +79,42 @@ class FormController extends Controller {
|
||||
*/
|
||||
public function postForm($id, Help_topic $topic) {
|
||||
// dd($id);
|
||||
if($id != 0 ){
|
||||
if ($id != 0) {
|
||||
$helptopic = $topic->where('id', '=', $id)->first();
|
||||
$custom_form = $helptopic->custom_form;
|
||||
$values = Fields::where('forms_id', '=', $custom_form)->get();
|
||||
if(!$values) {
|
||||
} if($values) {
|
||||
foreach($values as $value){
|
||||
if($value->type == "select") {
|
||||
if (!$values) {
|
||||
|
||||
} if ($values) {
|
||||
foreach ($values as $value) {
|
||||
if ($value->type == "select") {
|
||||
$data = $value->value;
|
||||
$value = explode(',', $data);
|
||||
echo '<select class="form-control">';
|
||||
foreach($value as $option){
|
||||
echo '<option>'.$option.'</option>';
|
||||
foreach ($value as $option) {
|
||||
echo '<option>' . $option . '</option>';
|
||||
}
|
||||
echo '</select></br>';
|
||||
} elseif ($value->type == "radio" ) {
|
||||
} elseif ($value->type == "radio") {
|
||||
$type2 = $value->value;
|
||||
$val = explode(',', $type2);
|
||||
echo '<label class="radio-inline">'.$value->label.'</label>   <input type="'.$value->type.'" name="'.$value->name.'"> '.$val[0].'
|
||||
   <input type="'.$value->type.'" name="'.$value->name.'"> '.$val[1].'</br>';
|
||||
} elseif($value->type == "textarea" ) {
|
||||
echo '<label class="radio-inline">' . $value->label . '</label>   <input type="' . $value->type . '" name="' . $value->name . '"> ' . $val[0] . '
|
||||
   <input type="' . $value->type . '" name="' . $value->name . '"> ' . $val[1] . '</br>';
|
||||
} elseif ($value->type == "textarea") {
|
||||
$type3 = $value->value;
|
||||
$v = explode(',', $type3);
|
||||
//dd($v);
|
||||
if(array_key_exists(1, $v)){
|
||||
echo '<label>'.$value->label.'</label></br><textarea class=form-control rows="'.$v[0].'" cols="'.$v[1].'"></textarea></br>';
|
||||
if (array_key_exists(1, $v)) {
|
||||
echo '<label>' . $value->label . '</label></br><textarea class=form-control rows="' . $v[0] . '" cols="' . $v[1] . '"></textarea></br>';
|
||||
} else {
|
||||
echo '<label>'.$value->label.'</label></br><textarea class=form-control rows="10" cols="60"></textarea></br>';
|
||||
echo '<label>' . $value->label . '</label></br><textarea class=form-control rows="10" cols="60"></textarea></br>';
|
||||
}
|
||||
} elseif($value->type == "checkbox" ) {
|
||||
} elseif ($value->type == "checkbox") {
|
||||
$type4 = $value->value;
|
||||
$check = explode(',', $type4);
|
||||
echo '<label class="radio-inline">'.$value->label.'   <input type="'.$value->type.'" name="'.$value->name.'">  '.$check[0].'</label><label class="radio-inline"><input type="'.$value->type.'" name="'.$value->name.'">  '.$check[1].'</label></br>';
|
||||
echo '<label class="radio-inline">' . $value->label . '   <input type="' . $value->type . '" name="' . $value->name . '">  ' . $check[0] . '</label><label class="radio-inline"><input type="' . $value->type . '" name="' . $value->name . '">  ' . $check[1] . '</label></br>';
|
||||
} else {
|
||||
echo '<label>'.$value->label.'</label><input type="'.$value->type.'" class="form-control" name="'.$value->name.'" /></br>';
|
||||
echo '<label>' . $value->label . '</label><input type="' . $value->type . '" class="form-control" name="' . $value->name . '" /></br>';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -130,7 +130,7 @@ class FormController extends Controller {
|
||||
*/
|
||||
public function postedForm(User $user, ClientRequest $request, Ticket $ticket_settings, Ticket_source $ticket_source) {
|
||||
|
||||
$form_extras = $request->except('Name','Phone','Email','Subject','Details','helptopic','_wysihtml5_mode','_token');
|
||||
$form_extras = $request->except('Name', 'Phone', 'Email', 'Subject', 'Details', 'helptopic', '_wysihtml5_mode', '_token');
|
||||
|
||||
$name = $request->input('Name');
|
||||
$phone = $request->input('Phone');
|
||||
@@ -138,26 +138,24 @@ class FormController extends Controller {
|
||||
$subject = $request->input('Subject');
|
||||
$details = $request->input('Details');
|
||||
|
||||
$System = System::where('id','=',1)->first();
|
||||
$departments = Department::where('id','=',$System->department)->first();
|
||||
$System = System::where('id', '=', 1)->first();
|
||||
$departments = Department::where('id', '=', $System->department)->first();
|
||||
$department = $departments->id;
|
||||
|
||||
$status = $ticket_settings->first()->status;
|
||||
$helptopic = $ticket_settings->first()->help_topic;
|
||||
$sla = $ticket_settings->first()->sla;
|
||||
$priority = $ticket_settings->first()->priority;
|
||||
$source = $ticket_source->where('name','=','web')->first();
|
||||
$source = $ticket_source->where('name', '=', 'web')->first();
|
||||
|
||||
$collaborator = null;
|
||||
$assignto = null;
|
||||
|
||||
if($this->TicketController->create_user($email, $name, $subject, $details, $phone, $helptopic, $sla, $priority, $source->id, $collaborator, $department,$assignto, $form_extras)) {
|
||||
return Redirect::route('guest.getform')->with('success','Ticket Created Successfully');
|
||||
if ($this->TicketController->create_user($email, $name, $subject, $details, $phone, $helptopic, $sla, $priority, $source->id, $collaborator, $department, $assignto, $form_extras)) {
|
||||
return Redirect::route('guest.getform')->with('success', 'Ticket Created Successfully');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* reply
|
||||
* @param type $value
|
||||
@@ -165,8 +163,8 @@ class FormController extends Controller {
|
||||
*/
|
||||
public function post_ticket_reply($id, Request $request) {
|
||||
$comment = $request->input('comment');
|
||||
if($comment != null) {
|
||||
$tickets = Tickets::where('id','=',$id)->first();
|
||||
if ($comment != null) {
|
||||
$tickets = Tickets::where('id', '=', $id)->first();
|
||||
$threads = new Ticket_Thread;
|
||||
$tickets->closed_at = null;
|
||||
$tickets->closed = 0;
|
||||
@@ -179,16 +177,13 @@ class FormController extends Controller {
|
||||
try {
|
||||
$threads->save();
|
||||
$tickets->save();
|
||||
return \Redirect::back()->with('success1','Successfully replied');
|
||||
} catch(Exception $e) {
|
||||
return \Redirect::back()->with('fails1',$e->errorInfo[2]);
|
||||
return \Redirect::back()->with('success1', 'Successfully replied');
|
||||
} catch (Exception $e) {
|
||||
return \Redirect::back()->with('fails1', $e->errorInfo[2]);
|
||||
}
|
||||
} else {
|
||||
return \Redirect::back()->with('fails1','Please fill some data!');
|
||||
return \Redirect::back()->with('fails1', 'Please fill some data!');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -1,15 +1,16 @@
|
||||
<?php namespace App\Http\Controllers\Client\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Client\helpdesk;
|
||||
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Controllers\Common\SettingsController;
|
||||
|
||||
use App\Http\Controllers\Common\PhpMailController;
|
||||
// requests
|
||||
use App\Http\Requests\helpdesk\CheckTicket;
|
||||
use App\Http\Requests\helpdesk\ProfilePassword;
|
||||
use App\Http\Requests\helpdesk\ProfileRequest;
|
||||
use App\Http\Requests\helpdesk\TicketRequest;
|
||||
|
||||
// models
|
||||
use App\Model\helpdesk\Manage\Help_topic;
|
||||
use App\Model\helpdesk\Ticket\Tickets;
|
||||
@@ -17,7 +18,6 @@ use App\Model\helpdesk\Ticket\Ticket_Thread;
|
||||
use App\Model\helpdesk\Settings\Company;
|
||||
use App\Model\helpdesk\Settings\System;
|
||||
use App\User;
|
||||
|
||||
// classes
|
||||
use Auth;
|
||||
use Hash;
|
||||
@@ -37,8 +37,8 @@ class GuestController extends Controller {
|
||||
* Create a new controller instance.
|
||||
* @return type void
|
||||
*/
|
||||
|
||||
public function __construct() {
|
||||
public function __construct(PhpMailController $PhpMailController) {
|
||||
$this->PhpMailController = $PhpMailController;
|
||||
SettingsController::smtp();
|
||||
// checking authentication
|
||||
$this->middleware('auth');
|
||||
@@ -60,7 +60,7 @@ class GuestController extends Controller {
|
||||
* @return type Response
|
||||
*/
|
||||
public function postProfile(ProfileRequest $request) {
|
||||
$user = User::where('id','=',Auth::user()->id)->first();
|
||||
$user = User::where('id', '=', Auth::user()->id)->first();
|
||||
$user->gender = $request->get('gender');
|
||||
$user->save();
|
||||
if ($user->profile_pic == 'avatar5.png' || $user->profile_pic == 'avatar2.png') {
|
||||
@@ -107,10 +107,10 @@ class GuestController extends Controller {
|
||||
* @return type
|
||||
*/
|
||||
public function getForm(Help_topic $topic) {
|
||||
if(\Config::get('database.install') == '%0%') {
|
||||
if (\Config::get('database.install') == '%0%') {
|
||||
return \Redirect::route('license');
|
||||
}
|
||||
if(System::first()->status == 1) {
|
||||
if (System::first()->status == 1) {
|
||||
$topics = $topic->get();
|
||||
return view('themes.default1.client.helpdesk.form', compact('topics'));
|
||||
} else {
|
||||
@@ -153,6 +153,7 @@ class GuestController extends Controller {
|
||||
* @return
|
||||
*/
|
||||
public function ticketEdit() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -166,7 +167,7 @@ class GuestController extends Controller {
|
||||
//echo $user->password;
|
||||
if (Hash::check($request->input('old_password'), $user->getAuthPassword())) {
|
||||
$user->password = Hash::make($request->input('new_password'));
|
||||
try{
|
||||
try {
|
||||
$user->save();
|
||||
return redirect()->back()->with('success2', 'Password Updated sucessfully');
|
||||
} catch (Exception $e) {
|
||||
@@ -220,19 +221,19 @@ class GuestController extends Controller {
|
||||
$Ticket_number = \Input::get('ticket_number');
|
||||
|
||||
$ticket = Tickets::where('ticket_number', '=', $Ticket_number)->first();
|
||||
if($ticket == null) {
|
||||
if ($ticket == null) {
|
||||
return \Redirect::route('form')->with('fails', 'There is no such Ticket Number');
|
||||
} else {
|
||||
$userId = $ticket->user_id;
|
||||
$user = User::where('id', '=', $userId)->first();
|
||||
|
||||
if($user->role == 'user') {
|
||||
if ($user->role == 'user') {
|
||||
$username = $user->user_name;
|
||||
} else {
|
||||
$username = $user->first_name." ".$user->last_name;
|
||||
$username = $user->first_name . " " . $user->last_name;
|
||||
}
|
||||
|
||||
if($user->email != $Email) {
|
||||
if ($user->email != $Email) {
|
||||
return \Redirect::route('form')->with('fails', "Email didn't match with Ticket Number");
|
||||
} else {
|
||||
$code = $ticket->id;
|
||||
@@ -240,14 +241,12 @@ class GuestController extends Controller {
|
||||
|
||||
$company = $this->company();
|
||||
|
||||
\Mail::send('emails.check_ticket',
|
||||
array('link'=>\URL::route('check_ticket',$code),'user'=>$username, 'from'=>$company),
|
||||
function($message) use($user, $username, $Ticket_number) {
|
||||
$message->to($user->email, $username)->subject('Ticket link Request ['.$Ticket_number.']');
|
||||
}
|
||||
$this->PhpMailController->sendmail(
|
||||
$from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $username, 'email' => $user->email], $message = ['subject' => 'Ticket link Request [' . $Ticket_number . ']', 'scenario' => 'check-ticket'], $template_variables = ['user' => $username, 'ticket_link_with_number' => \URL::route('check_ticket', $code)]
|
||||
);
|
||||
|
||||
return \Redirect::back()
|
||||
->with('success','We have sent you a link by Email. Please click on that link to view ticket');
|
||||
->with('success', 'We have sent you a link by Email. Please click on that link to view ticket');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -259,7 +258,7 @@ class GuestController extends Controller {
|
||||
*/
|
||||
public function get_ticket_email($id) {
|
||||
$id1 = \Crypt::decrypt($id);
|
||||
return view('themes.default1.client.helpdesk.ckeckticket',compact('id'));
|
||||
return view('themes.default1.client.helpdesk.ckeckticket', compact('id'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -276,10 +275,10 @@ class GuestController extends Controller {
|
||||
* @return type
|
||||
*/
|
||||
public function company() {
|
||||
$company = Company::Where('id','=','1')->first();
|
||||
if($company->company_name == null){
|
||||
$company = Company::Where('id', '=', '1')->first();
|
||||
if ($company->company_name == null) {
|
||||
$company = "Support Center";
|
||||
}else{
|
||||
} else {
|
||||
$company = $company->company_name;
|
||||
}
|
||||
return $company;
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php namespace App\Http\Controllers\Client\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Client\helpdesk;
|
||||
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
// models
|
||||
@@ -23,7 +26,7 @@ class WelcomepageController extends Controller {
|
||||
* @return Response
|
||||
*/
|
||||
public function get(System $note) {
|
||||
if(Config::get('database.install')=='%0%') {
|
||||
if (Config::get('database.install') == '%0%') {
|
||||
return Redirect::route('licence');
|
||||
}
|
||||
$notes = $note->get();
|
||||
@@ -34,9 +37,10 @@ class WelcomepageController extends Controller {
|
||||
}
|
||||
|
||||
public function index() {
|
||||
if(Config::get('database.install')=='%0%') {
|
||||
if (Config::get('database.install') == '%0%') {
|
||||
return Redirect::route('licence');
|
||||
}
|
||||
return view('themes.default1.client.helpdesk.guest-user.index');
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,4 +1,6 @@
|
||||
<?php namespace App\Http\Controllers\Client\kb;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Client\kb;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\kb\CommentRequest;
|
||||
@@ -40,6 +42,7 @@ class UserController extends Controller {
|
||||
* @package default
|
||||
*/
|
||||
public function getArticle(Article $article, Category $category, Settings $settings) {
|
||||
|
||||
$settings = $settings->first();
|
||||
$pagination = $settings->pagination;
|
||||
// $article = $article->where('status', '1');
|
||||
@@ -90,12 +93,16 @@ class UserController extends Controller {
|
||||
*/
|
||||
public function show($slug, Article $article, Category $category) {
|
||||
//ArticleController::timezone();
|
||||
$arti = $article->where('slug', $slug)->where('status','1')->where('type','1')->first();
|
||||
|
||||
// dd($arti);
|
||||
//$categorys = $category->get();
|
||||
//$avatar->get('vijaycodename47@gmail.com');
|
||||
$tz = \App\Model\helpdesk\Settings\System::where('id', '1')->first()->time_zone;
|
||||
$tz = \App\Model\helpdesk\Utility\Timezones::where('id', $tz)->first()->name;
|
||||
date_default_timezone_set($tz);
|
||||
$date = \Carbon\Carbon::now()->toDateTimeString();
|
||||
$arti = $article->where('slug', $slug)->where('status', '1')->where('type', '1')->where('publish_time', '<', $date)->first();
|
||||
if ($arti) {
|
||||
return view('themes.default1.client.kb.article-list.show', compact('arti'));
|
||||
} else {
|
||||
return redirect()->back()->with('fails', 'No records on publish time');
|
||||
}
|
||||
}
|
||||
|
||||
public function getCategory($slug, Article $article, Category $category, Relationship $relation) {
|
||||
@@ -108,15 +115,13 @@ class UserController extends Controller {
|
||||
$article_id = $all->lists('article_id');
|
||||
$categorys = $category->get();
|
||||
/* direct to view with $article_id */
|
||||
return view('themes.default1.client.kb.article-list.category', compact('all','id', 'categorys', 'article_id'));
|
||||
return view('themes.default1.client.kb.article-list.category', compact('all', 'id', 'categorys', 'article_id'));
|
||||
}
|
||||
|
||||
public function home(Article $article, Category $category, Relationship $relation) {
|
||||
if (Config::get('database.install') == '%0%') {
|
||||
return redirect('step1');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
//$categorys = $category->get();
|
||||
$categorys = $category->get();
|
||||
// $categorys->setPath('home');
|
||||
@@ -185,7 +190,7 @@ class UserController extends Controller {
|
||||
* @return type response
|
||||
*/
|
||||
public function postComment($slug, Article $article, CommentRequest $request, Comment $comment) {
|
||||
$article = $article->where('slug',$slug)->first();
|
||||
$article = $article->where('slug', $slug)->first();
|
||||
$id = $article->id;
|
||||
$comment->article_id = $id;
|
||||
if ($comment->fill($request->input())->save()) {
|
||||
@@ -200,23 +205,28 @@ class UserController extends Controller {
|
||||
//$this->timezone($page->created_at);
|
||||
return view('themes.default1.client.kb.article-list.pages', compact('page'));
|
||||
}
|
||||
|
||||
static function port() {
|
||||
$setting = Settings::whereId('1')->first();
|
||||
Config::set('mail.port', $setting->port);
|
||||
}
|
||||
|
||||
static function host() {
|
||||
$setting = Settings::whereId('1')->first();
|
||||
Config::set('mail.host', $setting->host);
|
||||
}
|
||||
|
||||
static function encryption() {
|
||||
$setting = Settings::whereId('1')->first();
|
||||
Config::set(['mail.encryption' => $setting->encryption, 'mail.username' => $setting->email]);
|
||||
}
|
||||
|
||||
static function email() {
|
||||
$setting = Settings::whereId('1')->first();
|
||||
Config::set(['mail.from' => ['address' => $setting->email, 'name' => 'asd']]);
|
||||
//dd(Config::get('mail'));
|
||||
}
|
||||
|
||||
static function password() {
|
||||
$setting = Settings::whereId('1')->first();
|
||||
Config::set(['mail.password' => $setting->password, 'mail.sendmail' => $setting->email]);
|
||||
@@ -228,7 +238,6 @@ class UserController extends Controller {
|
||||
// $categorys->setPath('home');
|
||||
/* direct to view with $article_id */
|
||||
return view('themes.default1.client.kb.article-list.categoryList', compact('categorys', 'article_id'));
|
||||
|
||||
}
|
||||
|
||||
// static function timezone($utc) {
|
||||
@@ -238,7 +247,6 @@ class UserController extends Controller {
|
||||
// //$utc = date('M d Y h:i:s A');
|
||||
// //echo 'UTC : ' . $utc;
|
||||
// date_default_timezone_set($tz);
|
||||
|
||||
// $offset = date('Z', strtotime($utc));
|
||||
// //print "offset: $offset \n";
|
||||
// $date = date($format, strtotime($utc) + $offset);
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php namespace App\Http\Controllers\Common;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Common;
|
||||
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
// requests
|
||||
@@ -43,7 +46,6 @@ class SettingsController extends Controller {
|
||||
SettingsController::password();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get the page to create the footer
|
||||
* @return response
|
||||
@@ -57,49 +59,46 @@ class SettingsController extends Controller {
|
||||
* @return response
|
||||
*/
|
||||
public function list_widget() {
|
||||
return \Datatable::collection(Widgets::where('id','<','7')->get())
|
||||
return \Datatable::collection(Widgets::where('id', '<', '7')->get())
|
||||
->searchColumns('name')
|
||||
->orderColumns('name', 'title', 'value')
|
||||
->addColumn('name', function ($model) {
|
||||
return $model->name;
|
||||
})
|
||||
|
||||
->addColumn('title', function ($model) {
|
||||
return $model->title;
|
||||
})
|
||||
|
||||
->addColumn('body', function ($model) {
|
||||
return $model->value;
|
||||
})
|
||||
|
||||
->addColumn('Actions', function ($model) {
|
||||
return '<span data-toggle="modal" data-target="#edit_widget'.$model->id .'"><a class="btn btn-warning btn-xs">' . \Lang::get('lang.edit') . '</a></span>
|
||||
<div class="modal fade" id="edit_widget'.$model->id .'">
|
||||
return '<span data-toggle="modal" data-target="#edit_widget' . $model->id . '"><a class="btn btn-warning btn-xs">' . \Lang::get('lang.edit') . '</a></span>
|
||||
<div class="modal fade" id="edit_widget' . $model->id . '">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<form action="'. url('edit-widget/'.$model->id) .'" method="POST">
|
||||
<form action="' . url('edit-widget/' . $model->id) . '" method="POST">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title">'.strtoupper($model->name).' </h4>
|
||||
<h4 class="modal-title">' . strtoupper($model->name) . ' </h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group" style="width:100%">
|
||||
<label>'.\Lang::get("lang.title").'</label><br/>
|
||||
<input type="text" name="title" value="'.$model->title.'" class="form-control" style="width:100%">
|
||||
<label>' . \Lang::get("lang.title") . '</label><br/>
|
||||
<input type="text" name="title" value="' . $model->title . '" class="form-control" style="width:100%">
|
||||
</div>
|
||||
<br/>
|
||||
<div class="form-group" style="width:100%">
|
||||
<label>'.\Lang::get("lang.content").'</label><br/>
|
||||
<textarea name="content" class="form-control" style="width:100%" id="Content'.$model->id.'">'.$model->value.'</textarea>
|
||||
<label>' . \Lang::get("lang.content") . '</label><br/>
|
||||
<textarea name="content" class="form-control" style="width:100%" id="Content' . $model->id . '">' . $model->value . '</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">'.\Lang::get('lang.close').'</button>
|
||||
<input type="submit" class="btn btn-primary" value="'.\Lang::get('lang.update').'">
|
||||
<button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">' . \Lang::get('lang.close') . '</button>
|
||||
<input type="submit" class="btn btn-primary" value="' . \Lang::get('lang.update') . '">
|
||||
</div>
|
||||
<script>
|
||||
$(function () {
|
||||
$("#Content'. $model->id .'").wysihtml5();
|
||||
$("#Content' . $model->id . '").wysihtml5();
|
||||
});
|
||||
</script>
|
||||
</form>
|
||||
@@ -107,11 +106,9 @@ class SettingsController extends Controller {
|
||||
</div>
|
||||
</div>';
|
||||
})
|
||||
|
||||
->make();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Post footer
|
||||
* @param type Footer $footer
|
||||
@@ -119,13 +116,13 @@ class SettingsController extends Controller {
|
||||
* @return type response
|
||||
*/
|
||||
public function edit_widget($id, Widgets $widgets, Request $request) {
|
||||
$widget = $widgets->where('id','=',$id)->first();
|
||||
$widget = $widgets->where('id', '=', $id)->first();
|
||||
$widget->title = $request->title;
|
||||
$widget->value = $request->content;
|
||||
try{
|
||||
try {
|
||||
$widget->save();
|
||||
return redirect()->back()->with('success', $widget->name.' Saved Successfully');
|
||||
} catch(Exception $e) {
|
||||
return redirect()->back()->with('success', $widget->name . ' Saved Successfully');
|
||||
} catch (Exception $e) {
|
||||
return redirect()->back()->with('fails', $e->errorInfo[2]);
|
||||
}
|
||||
}
|
||||
@@ -143,37 +140,35 @@ class SettingsController extends Controller {
|
||||
* @return response
|
||||
*/
|
||||
public function list_social_buttons() {
|
||||
return \Datatable::collection(Widgets::where('id','>','6')->get())
|
||||
return \Datatable::collection(Widgets::where('id', '>', '6')->get())
|
||||
->searchColumns('name')
|
||||
->orderColumns('name', 'value')
|
||||
->addColumn('name', function ($model) {
|
||||
return $model->name;
|
||||
})
|
||||
|
||||
->addColumn('link', function ($model) {
|
||||
return $model->value;
|
||||
})
|
||||
|
||||
->addColumn('Actions', function ($model) {
|
||||
return '<span data-toggle="modal" data-target="#edit_widget'.$model->id .'"><a class="btn btn-warning btn-xs">' . \Lang::get('lang.edit') . '</a></span>
|
||||
<div class="modal fade" id="edit_widget'.$model->id .'">
|
||||
return '<span data-toggle="modal" data-target="#edit_widget' . $model->id . '"><a class="btn btn-warning btn-xs">' . \Lang::get('lang.edit') . '</a></span>
|
||||
<div class="modal fade" id="edit_widget' . $model->id . '">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<form action="'. url('edit-widget/'.$model->id) .'" method="POST">
|
||||
<form action="' . url('edit-widget/' . $model->id) . '" method="POST">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title">'.strtoupper($model->name).' </h4>
|
||||
<h4 class="modal-title">' . strtoupper($model->name) . ' </h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<br/>
|
||||
<div class="form-group" style="width:100%">
|
||||
<label>'.\Lang::get("lang.link").'</label><br/>
|
||||
<input type="url" name="content" class="form-control" style="width:100%" value="'.$model->value.'">
|
||||
<label>' . \Lang::get("lang.link") . '</label><br/>
|
||||
<input type="url" name="content" class="form-control" style="width:100%" value="' . $model->value . '">
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">'.\Lang::get('lang.close').'</button>
|
||||
<input type="submit" class="btn btn-primary" value="'.\Lang::get('lang.update').'">
|
||||
<button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">' . \Lang::get('lang.close') . '</button>
|
||||
<input type="submit" class="btn btn-primary" value="' . \Lang::get('lang.update') . '">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@@ -190,14 +185,14 @@ class SettingsController extends Controller {
|
||||
* @return type response
|
||||
*/
|
||||
public function edit_social_buttons($id, Widgets $widgets, Request $request) {
|
||||
$widget = $widgets->where('id','=',$id)->first();
|
||||
$widget = $widgets->where('id', '=', $id)->first();
|
||||
$widget->title = $request->title;
|
||||
$widget->value = $request->content;
|
||||
try{
|
||||
try {
|
||||
$widget->save();
|
||||
return redirect()->back()->with('success', $widget->name.' Saved Successfully');
|
||||
return redirect()->back()->with('success', $widget->name . ' Saved Successfully');
|
||||
} catch (Exception $e) {
|
||||
return redirect()->back()->with('fails',$e->errorInfo[2]);
|
||||
return redirect()->back()->with('fails', $e->errorInfo[2]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -296,7 +291,7 @@ class SettingsController extends Controller {
|
||||
$data->name = $request->input('name');
|
||||
$data->email = $request->input('email');
|
||||
$data->password = Crypt::encrypt($request->input('password'));
|
||||
try{
|
||||
try {
|
||||
$data->save();
|
||||
return \Redirect::route('getsmtp')->with('success', 'success');
|
||||
} catch (Exception $e) {
|
||||
@@ -343,9 +338,9 @@ class SettingsController extends Controller {
|
||||
$pass = $request->input('password');
|
||||
$password = Crypt::encrypt($pass);
|
||||
$settings->password = $password;
|
||||
try{
|
||||
try {
|
||||
$settings->save();
|
||||
} catch(Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
return redirect()->back()->with('fails', $e->errorInfo[2]);
|
||||
}
|
||||
if (Input::file('logo')) {
|
||||
@@ -425,8 +420,8 @@ class SettingsController extends Controller {
|
||||
$activate = "<a href=" . url('plugin/status/' . $model['path']) . ">Deactivate</a>";
|
||||
}
|
||||
|
||||
$delete = "<a href= id=delete".$model['path']." data-toggle=modal data-target=#del".$model['path']."><span style='color:red'>Delete</span></a>"
|
||||
. "<div class='modal fade' id=del".$model['path'].">
|
||||
$delete = "<a href= id=delete" . $model['path'] . " data-toggle=modal data-target=#del" . $model['path'] . "><span style='color:red'>Delete</span></a>"
|
||||
. "<div class='modal fade' id=del" . $model['path'] . ">
|
||||
<div class='modal-dialog'>
|
||||
<div class=modal-content>
|
||||
<div class=modal-header>
|
||||
@@ -457,7 +452,7 @@ class SettingsController extends Controller {
|
||||
return ucfirst($model['author']);
|
||||
})
|
||||
->addColumn('website', function($model) {
|
||||
return "<a href=".$model['website']." target=_blank>".$model['website']."</a>";
|
||||
return "<a href=" . $model['website'] . " target=_blank>" . $model['website'] . "</a>";
|
||||
})
|
||||
->addColumn('version', function($model) {
|
||||
return $model['version'];
|
||||
@@ -523,7 +518,7 @@ class SettingsController extends Controller {
|
||||
$lines = file($app, FILE_IGNORE_NEW_LINES);
|
||||
$lines[$line_i_am_looking_for] = $str;
|
||||
file_put_contents($app, implode("\n", $lines));
|
||||
$plug->create(['name' => $filename, 'path' => $filename,'status'=>1]);
|
||||
$plug->create(['name' => $filename, 'path' => $filename, 'status' => 1]);
|
||||
return redirect()->back()->with('success', 'Installed SuccessFully');
|
||||
} else {
|
||||
/**
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php namespace App\Http\Controllers;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
// classes
|
||||
use Illuminate\Foundation\Bus\DispatchesCommands;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php namespace App\Http\Controllers\Error;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Error;
|
||||
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
@@ -18,4 +21,5 @@ class ErrorController extends Controller {
|
||||
public function error404() {
|
||||
return view('404');
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,9 +1,10 @@
|
||||
<?php namespace App\Http\Controllers;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Model\helpdesk\Manage\Sla_plan;
|
||||
use App\Model\helpdesk\Ticket\Tickets;
|
||||
|
||||
|
||||
class HomeController extends Controller {
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@@ -35,45 +36,43 @@ class HomeController extends Controller {
|
||||
return view('themes/default1/admin/dashboard');
|
||||
}
|
||||
|
||||
|
||||
public function getsmtp(){
|
||||
$smtp = \App\Model\helpdesk\Email\Smtp::where('id','=','1')->first();
|
||||
public function getsmtp() {
|
||||
$smtp = \App\Model\helpdesk\Email\Smtp::where('id', '=', '1')->first();
|
||||
return $smtp->host;
|
||||
}
|
||||
|
||||
Public function getdata(){
|
||||
Public function getdata() {
|
||||
return \View::make('emails/notifications/agent');
|
||||
}
|
||||
|
||||
public function getreport(){
|
||||
public function getreport() {
|
||||
return \View::make('test');
|
||||
}
|
||||
|
||||
public function pushdata(){
|
||||
public function pushdata() {
|
||||
|
||||
$date2 = strtotime(Date('Y-m-d'));
|
||||
$date3 = Date('Y-m-d');
|
||||
$format = 'Y-m-d';
|
||||
$date1 = strtotime(Date($format,strtotime('-1 month'. $date3)));
|
||||
$date1 = strtotime(Date($format, strtotime('-1 month' . $date3)));
|
||||
|
||||
$return = "";
|
||||
$last = "";
|
||||
for ( $i = $date1; $i <= $date2; $i = $i + 86400 ) {
|
||||
$thisDate = date( 'Y-m-d', $i );
|
||||
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();
|
||||
$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);
|
||||
$array = array_map('htmlentities', $value);
|
||||
$json = html_entity_decode(json_encode($array));
|
||||
$return .= $json.',';
|
||||
$return .= $json . ',';
|
||||
}
|
||||
$last = rtrim($return,',');
|
||||
|
||||
return '['.$last.']';
|
||||
$last = rtrim($return, ',');
|
||||
|
||||
return '[' . $last . ']';
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php namespace App\Http\Controllers\Installer\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Installer\helpdesk;
|
||||
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
// requests
|
||||
@@ -20,6 +23,7 @@ use Redirect;
|
||||
use Session;
|
||||
use View;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* |=======================================================================
|
||||
* |Class: InstallController
|
||||
@@ -34,15 +38,16 @@ use Exception;
|
||||
*
|
||||
*/
|
||||
class InstallController extends Controller {
|
||||
|
||||
/**
|
||||
* Get Licence (step 1)
|
||||
* @return type view
|
||||
*/
|
||||
public function licence() {
|
||||
// checking if the installation is running for the first time or not
|
||||
if (Session::get('step5') == 'step5') {
|
||||
return Redirect::route('account');
|
||||
}
|
||||
// if (Session::get('step5') == 'step5') {
|
||||
// return Redirect::route('account');
|
||||
// }
|
||||
// checking if the installation is running for the first time or not
|
||||
if (Config::get('database.install') == '%0%') {
|
||||
return view('themes/default1/installer/helpdesk/view1');
|
||||
@@ -51,6 +56,7 @@ class InstallController extends Controller {
|
||||
return redirect('/auth/login');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Post Licencecheck
|
||||
* @return type view
|
||||
@@ -66,6 +72,7 @@ class InstallController extends Controller {
|
||||
}
|
||||
// return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get prerequisites (step 2)
|
||||
*
|
||||
@@ -75,9 +82,9 @@ class InstallController extends Controller {
|
||||
*/
|
||||
public function prerequisites() {
|
||||
// checking if the installation is running for the first time or not
|
||||
if (Session::get('step5') == 'step5') {
|
||||
return Redirect::route('account');
|
||||
}
|
||||
// if (Session::get('step5') == 'step5') {
|
||||
// return Redirect::route('account');
|
||||
// }
|
||||
// checking if the installation is running for the first time or not
|
||||
if (Config::get('database.install') == '%0%') {
|
||||
if (Session::get('step1') == 'step1') {
|
||||
@@ -89,6 +96,7 @@ class InstallController extends Controller {
|
||||
return redirect('/auth/login');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Post Prerequisitescheck
|
||||
* checking prerequisites
|
||||
@@ -98,6 +106,7 @@ class InstallController extends Controller {
|
||||
Session::put('step2', 'step2');
|
||||
return Redirect::route('configuration');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Localization (step 3)
|
||||
* Requesting user recomended settings for installation
|
||||
@@ -105,9 +114,9 @@ class InstallController extends Controller {
|
||||
*/
|
||||
public function localization() {
|
||||
// checking if the installation is running for the first time or not
|
||||
if (Session::get('step5') == 'step5') {
|
||||
return Redirect::route('account');
|
||||
}
|
||||
// if (Session::get('step5') == 'step5') {
|
||||
// return Redirect::route('account');
|
||||
// }
|
||||
// checking if the installation is running for the first time or not
|
||||
if (Config::get('database.install') == '%0%') {
|
||||
if (Session::get('step2') == 'step2') {
|
||||
@@ -119,19 +128,24 @@ class InstallController extends Controller {
|
||||
return redirect('/auth/login');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Post localizationcheck
|
||||
* checking prerequisites
|
||||
* @return type view
|
||||
*/
|
||||
public function localizationcheck() {
|
||||
|
||||
Session::put('step3', 'step3');
|
||||
|
||||
Session::put('language', Input::get('language'));
|
||||
Session::put('timezone', Input::get('timezone'));
|
||||
Session::put('date', Input::get('date'));
|
||||
Session::put('datetime', Input::get('datetime'));
|
||||
|
||||
return Redirect::route('configuration');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Configuration (step 4)
|
||||
* checking prerequisites
|
||||
@@ -139,9 +153,9 @@ class InstallController extends Controller {
|
||||
*/
|
||||
public function configuration() {
|
||||
// checking if the installation is running for the first time or not
|
||||
if (Session::get('step5') == 'step5') {
|
||||
return Redirect::route('account');
|
||||
}
|
||||
// if (Session::get('step5') == 'step5') {
|
||||
// return Redirect::route('account');
|
||||
// }
|
||||
// checking if the installation is running for the first time or not
|
||||
if (Config::get('database.install') == '%0%') {
|
||||
if (Session::get('step2') == 'step2') {
|
||||
@@ -153,21 +167,26 @@ class InstallController extends Controller {
|
||||
return redirect('/auth/login');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Post configurationcheck
|
||||
* checking prerequisites
|
||||
* @return type view
|
||||
*/
|
||||
public function configurationcheck() {
|
||||
|
||||
Session::put('step4', 'step4');
|
||||
|
||||
Session::put('default', Input::get('default'));
|
||||
Session::put('host', Input::get('host'));
|
||||
Session::put('databasename', Input::get('databasename'));
|
||||
Session::put('username', Input::get('username'));
|
||||
Session::put('password', Input::get('password'));
|
||||
Session::put('port', Input::get('port'));
|
||||
|
||||
return Redirect::route('database');
|
||||
}
|
||||
|
||||
/**
|
||||
* postconnection
|
||||
* @return type view
|
||||
@@ -180,6 +199,7 @@ class InstallController extends Controller {
|
||||
$dbusername = Input::get('username');
|
||||
$dbpassword = Input::get('password');
|
||||
$port = Input::get('port');
|
||||
|
||||
// Setting environment values
|
||||
$_ENV['DB_TYPE'] = $default;
|
||||
$_ENV['DB_HOST'] = $host;
|
||||
@@ -187,16 +207,19 @@ class InstallController extends Controller {
|
||||
$_ENV['DB_DATABASE'] = $database;
|
||||
$_ENV['DB_USERNAME'] = $dbusername;
|
||||
$_ENV['DB_PASSWORD'] = $dbpassword;
|
||||
|
||||
$config = '';
|
||||
foreach ($_ENV as $key => $val) {
|
||||
$config .= "{$key}={$val}\n";
|
||||
}
|
||||
// Write environment file
|
||||
$fp = fopen(base_path()."/.env", 'w');
|
||||
$fp = fopen(base_path() . "/.env", 'w');
|
||||
fwrite($fp, $config);
|
||||
fclose($fp);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get database
|
||||
* checking prerequisites
|
||||
@@ -214,6 +237,7 @@ class InstallController extends Controller {
|
||||
return redirect('/auth/login');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get account
|
||||
* checking prerequisites
|
||||
@@ -235,6 +259,7 @@ class InstallController extends Controller {
|
||||
return redirect('/auth/login');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Post accountcheck
|
||||
* checking prerequisites
|
||||
@@ -242,35 +267,44 @@ class InstallController extends Controller {
|
||||
* @return type view
|
||||
*/
|
||||
public function accountcheck(InstallerRequest $request) {
|
||||
|
||||
// migrate database
|
||||
Artisan::call('migrate', array('--force' => true));
|
||||
Artisan::call('db:seed', array('--force' => true));
|
||||
|
||||
// create user
|
||||
$firstname = $request->input('firstname');
|
||||
$lastname = $request->input('Lastname');
|
||||
$email = $request->input('email');
|
||||
$username = $request->input('username');
|
||||
$password = $request->input('password');
|
||||
|
||||
$language = $request->input('language');
|
||||
$timezone = $request->input('timezone');
|
||||
$date = $request->input('date');
|
||||
$datetime = $request->input('datetime');
|
||||
|
||||
|
||||
//\Cache::forever('language', $language);
|
||||
|
||||
//\App::setLocale($language);
|
||||
// $system = System::where('id','=','1')->first();
|
||||
// $system->time_zone = $timezone;
|
||||
// $system->date_time_format = $datetime;
|
||||
// $system->save();
|
||||
// checking requested timezone for the admin and system
|
||||
$timezones = Timezones::where('name','=',$timezone)->first();
|
||||
if($timezones->id == null){
|
||||
return ['response'=>'fail','reason'=>'Invalid time-zone','status'=>'0'];
|
||||
$timezones = Timezones::where('name', '=', $timezone)->first();
|
||||
if ($timezones->id == null) {
|
||||
return ['response' => 'fail', 'reason' => 'Invalid time-zone', 'status' => '0'];
|
||||
}
|
||||
// var_dump($datetime);
|
||||
// checking requested date time format for the admin and system
|
||||
$date_time_format = Date_time_format::where('format','=',$datetime)->first();
|
||||
$date_time_format = Date_time_format::where('format', '=', $datetime)->first();
|
||||
// dd($date_time_format);
|
||||
if($date_time_format->id == null){
|
||||
return ['response'=>'fail','reason'=>'invalid date-time format','status'=>'0'];
|
||||
if ($date_time_format->id == null) {
|
||||
return ['response' => 'fail', 'reason' => 'invalid date-time format', 'status' => '0'];
|
||||
}
|
||||
|
||||
// Creating minum settings for system
|
||||
$system = new System;
|
||||
$system->status = 1;
|
||||
@@ -278,6 +312,8 @@ class InstallController extends Controller {
|
||||
$system->date_time_format = $date_time_format->id;
|
||||
$system->time_zone = $timezones->id;
|
||||
$system->save();
|
||||
|
||||
|
||||
// creating an user
|
||||
$user = User::create(array(
|
||||
'first_name' => $firstname,
|
||||
@@ -296,6 +332,7 @@ class InstallController extends Controller {
|
||||
return Redirect::route('final');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get finalize
|
||||
* checking prerequisites
|
||||
@@ -311,11 +348,22 @@ class InstallController extends Controller {
|
||||
File::put($install, $datacontent);
|
||||
// setting email settings in route
|
||||
$smtpfilepath = "\App\Http\Controllers\Common\SettingsController::smtp()";
|
||||
$lfmpath = "url('photos').'/'";
|
||||
$path22 = app_path('Http/routes.php');
|
||||
$path23 = base_path('config/lfm.php');
|
||||
$content23 = File::get($path22);
|
||||
$content24 = File::get($path23);
|
||||
$content23 = str_replace('"%smtplink%"', $smtpfilepath, $content23);
|
||||
$content24 = str_replace("'%url%'", $lfmpath, $content24);
|
||||
File::put($path22, $content23);
|
||||
File::put($path23, $content24);
|
||||
try {
|
||||
Session::forget('step1');
|
||||
Session::forget('step2');
|
||||
Session::forget('step3');
|
||||
Session::forget('step4');
|
||||
Session::forget('step5');
|
||||
Session::forget('step6');
|
||||
return View::make('themes/default1/installer/helpdesk/view6');
|
||||
} catch (Exception $e) {
|
||||
return Redirect::route('npl');
|
||||
@@ -324,6 +372,7 @@ class InstallController extends Controller {
|
||||
return redirect('/auth/login');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Post finalcheck
|
||||
* checking prerequisites
|
||||
@@ -336,4 +385,5 @@ class InstallController extends Controller {
|
||||
return redirect('/auth/login');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,119 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Requests;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Phpmailer\PHPMailerautoload;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class PhpMailController extends Controller {
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function index() {
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Sending emails from the system.
|
||||
*
|
||||
* @return Mail
|
||||
*/
|
||||
public function sendmail($host = '', $username = '', $password = '', $smtpsecure = '', $port = '', $from = '', $recipants = '', $subject = '', $body = '', $cc = '', $bc = '') {
|
||||
|
||||
$mail = new \PHPMailer;
|
||||
|
||||
//$mail->SMTPDebug = 3; // Enable verbose debug output
|
||||
|
||||
$mail->isSMTP(); // Set mailer to use SMTP
|
||||
$mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers
|
||||
$mail->SMTPAuth = true; // Enable SMTP authentication
|
||||
$mail->Username = 'sujitprasad4567@gmail.com'; // SMTP username
|
||||
$mail->Password = 'pankajprasad22.'; // SMTP password
|
||||
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
|
||||
$mail->Port = 587; // TCP port to connect to
|
||||
|
||||
$mail->setFrom('sujitprasad4567@gmail.com', 'Mailer');
|
||||
$mail->addAddress('sada059@gmail.com', 'Joe User'); // Add a recipient
|
||||
// Name is optional
|
||||
$mail->addReplyTo('sada059@gmail.com', 'Information');
|
||||
|
||||
|
||||
// Optional name
|
||||
$mail->isHTML(true); // Set email format to HTML
|
||||
|
||||
$mail->Subject = 'Here is the subject';
|
||||
$mail->Body = 'This is the HTML message body <b>in bold!</b>';
|
||||
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
|
||||
|
||||
if (!$mail->send()) {
|
||||
echo 'Message could not be sent.';
|
||||
echo 'Mailer Error: ' . $mail->ErrorInfo;
|
||||
} else {
|
||||
echo 'Message has been sent';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function create() {
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function store() {
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return Response
|
||||
*/
|
||||
public function show($id) {
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return Response
|
||||
*/
|
||||
public function edit($id) {
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return Response
|
||||
*/
|
||||
public function update($id) {
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return Response
|
||||
*/
|
||||
public function destroy($id) {
|
||||
//
|
||||
}
|
||||
|
||||
}
|
@@ -1,4 +1,6 @@
|
||||
<?php namespace App\Http;
|
||||
<?php
|
||||
|
||||
namespace App\Http;
|
||||
|
||||
use Illuminate\Foundation\Http\Kernel as HttpKernel;
|
||||
|
||||
@@ -36,6 +38,9 @@ class Kernel extends HttpKernel {
|
||||
'roles' => 'App\Http\Middleware\CheckRole',
|
||||
'role.agent' => 'App\Http\Middleware\CheckRoleAgent',
|
||||
'role.user' => 'App\Http\Middleware\CheckRoleUser',
|
||||
'api' => 'App\Http\Middleware\ApiKey',
|
||||
'jwt.auth' => \Tymon\JWTAuth\Middleware\GetUserFromToken::class,
|
||||
'jwt.refresh' => \Tymon\JWTAuth\Middleware\RefreshToken::class
|
||||
];
|
||||
|
||||
}
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php namespace App\Http\Middleware;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\Auth\Guard;
|
||||
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php namespace App\Http\Middleware;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
|
||||
/**
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php namespace App\Http\Middleware;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
|
||||
/**
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php namespace App\Http\Middleware;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
|
||||
/**
|
||||
|
@@ -1,4 +1,6 @@
|
||||
<?php namespace App\Http\Middleware;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Cache;
|
||||
use Closure;
|
||||
@@ -11,14 +13,14 @@ use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
|
||||
class LanguageMiddleware implements Middleware {
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
|
||||
public function handle($request, Closure $next) {
|
||||
if (Cache::has('language') AND array_key_exists(Cache::get('language'), Config::get('languages'))) {
|
||||
App::setLocale(Cache::get('language'));
|
||||
}
|
||||
else { // This is optional as Laravel will automatically set the fallback language if there is none specified
|
||||
} else { // This is optional as Laravel will automatically set the fallback language if there is none specified
|
||||
App::setLocale(Config::get('app.fallback_locale'));
|
||||
}
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
}
|
@@ -1,4 +1,6 @@
|
||||
<?php namespace App\Http\Middleware;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\Auth\Guard;
|
||||
|
@@ -1,4 +1,6 @@
|
||||
<?php namespace App\Http\Middleware;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as BaseVerifier;
|
||||
|
@@ -1,9 +1,9 @@
|
||||
<?php namespace App\Http\Requests;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
abstract class Request extends FormRequest {
|
||||
|
||||
//
|
||||
|
||||
}
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php namespace App\Http\Requests\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\helpdesk;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php namespace App\Http\Requests\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\helpdesk;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php namespace App\Http\Requests\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\helpdesk;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
class ArticleRequest extends Request {
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php namespace App\Http\Requests\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\helpdesk;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php namespace App\Http\Requests\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\helpdesk;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php namespace App\Http\Requests\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\helpdesk;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php namespace App\Http\Requests\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\helpdesk;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php namespace App\Http\Requests\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\helpdesk;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php namespace App\Http\Requests\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\helpdesk;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
@@ -25,10 +28,10 @@ class ClientRequest extends Request {
|
||||
*/
|
||||
public function rules() {
|
||||
return [
|
||||
'Name'=>'required',
|
||||
'Email'=>'required',
|
||||
'Subject'=>'required',
|
||||
'Details'=>'required',
|
||||
'Name' => 'required',
|
||||
'Email' => 'required',
|
||||
'Subject' => 'required',
|
||||
'Details' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php namespace App\Http\Requests\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\helpdesk;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
class CommentRequest extends Request {
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php namespace App\Http\Requests\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\helpdesk;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php namespace App\Http\Requests\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\helpdesk;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
class ContactRequest extends Request {
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php namespace App\Http\Requests\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\helpdesk;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php namespace App\Http\Requests\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\helpdesk;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php namespace App\Http\Requests\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\helpdesk;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php namespace App\Http\Requests\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\helpdesk;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php namespace App\Http\Requests\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\helpdesk;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php namespace App\Http\Requests\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\helpdesk;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
@@ -27,9 +30,9 @@ class EmailsEditRequest extends Request {
|
||||
return [
|
||||
'email_address' => 'email',
|
||||
'email_name' => 'required',
|
||||
'department' => 'required',
|
||||
'priority' => 'required',
|
||||
'help_topic' => 'required',
|
||||
// 'department' => 'required',
|
||||
// 'priority' => 'required',
|
||||
// 'help_topic' => 'required',
|
||||
// 'imap_config' => 'required',
|
||||
'password' => 'required|min:6',
|
||||
// 'user_name' => 'required',
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php namespace App\Http\Requests\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\helpdesk;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
@@ -27,9 +30,9 @@ class EmailsRequest extends Request {
|
||||
return [
|
||||
'email_address' => 'required|email|unique:emails',
|
||||
'email_name' => 'required',
|
||||
'department' => 'required',
|
||||
'priority' => 'required',
|
||||
'help_topic' => 'required',
|
||||
// 'department' => 'required',
|
||||
// 'priority' => 'required',
|
||||
// 'help_topic' => 'required',
|
||||
// 'imap_config' => 'required',
|
||||
'password' => 'required|min:6',
|
||||
// 'user_name' => 'required',
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php namespace App\Http\Requests\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\helpdesk;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php namespace App\Http\Requests\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\helpdesk;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php namespace App\Http\Requests\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\helpdesk;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php namespace App\Http\Requests\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\helpdesk;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php namespace App\Http\Requests\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\helpdesk;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php namespace App\Http\Requests\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\helpdesk;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
|
@@ -1,4 +1,6 @@
|
||||
<?php namespace App\Http\Requests\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\helpdesk;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
@@ -9,8 +11,7 @@ class MessageRequest extends Request {
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
public function authorize() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -19,14 +20,12 @@ class MessageRequest extends Request {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
public function rules() {
|
||||
return [
|
||||
|
||||
|
||||
'message_title' => 'required',
|
||||
'message' => 'required'
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php namespace App\Http\Requests\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\helpdesk;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php namespace App\Http\Requests\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\helpdesk;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php namespace App\Http\Requests\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\helpdesk;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php namespace App\Http\Requests\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\helpdesk;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php namespace App\Http\Requests\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\helpdesk;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php namespace App\Http\Requests\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\helpdesk;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php namespace App\Http\Requests\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\helpdesk;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php namespace App\Http\Requests\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\helpdesk;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php namespace App\Http\Requests\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\helpdesk;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php namespace App\Http\Requests\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\helpdesk;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php namespace App\Http\Requests\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\helpdesk;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php namespace App\Http\Requests\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\helpdesk;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php namespace App\Http\Requests\helpdesk;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\helpdesk;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user