update v1.0.5

This commit is contained in:
sujitprasad
2016-01-25 20:45:35 +05:30
parent 0b8ebb9c70
commit e7149e34e4
252 changed files with 9008 additions and 3152 deletions

9
.env
View File

@@ -1,18 +1,17 @@
APP_ENV=local APP_ENV=local
APP_DEBUG=true APP_DEBUG=true
APP_KEY=SomeRandomString APP_KEY=SomeRandomString
DB_HOST=localhost DB_HOST=localhost
DB_DATABASE= DB_DATABASE=fav
DB_USERNAME= DB_USERNAME=root
DB_PASSWORD= DB_PASSWORD=
CACHE_DRIVER=file CACHE_DRIVER=file
SESSION_DRIVER=file SESSION_DRIVER=file
QUEUE_DRIVER=sync QUEUE_DRIVER=sync
MAIL_DRIVER=smtp MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io MAIL_HOST=mailtrap.io
MAIL_PORT=2525 MAIL_PORT=2525
MAIL_USERNAME=null MAIL_USERNAME=null
MAIL_PASSWORD=null MAIL_PASSWORD=null
DB_TYPE=mysql
DB_PORT=

4
.gitignore vendored
View File

@@ -1 +1,3 @@
/node_modules /vendor
/node_modules
.env

View File

@@ -1,48 +1,27 @@
<h3>About Faveo</h3> ## Laravel PHP Framework
<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<4D>s empowering them with state of art, ticket based support system. In today<61>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.
<br/><br/>
To date, Faveo has been integrated with 6 platforms and every month there is 1 to 2 update releases with new features & platform integration.
<br/><br/>
Faveo can also be customised according to requirement and we do undertake such request.
<br/><br/>
Faveo is designed & developed by <a href="http://www.ladybirdweb.com/" target="_blank">Ladybird Web Solution Pvt Ltd</a>, and launched in October 2015.</p>
<h3>Flavors of Faveo</h3>
<ul>
<li>Community Edition <20> Free, Open source edition</li>
<li>Pro Edition <20> Downloadable edition. Install it in location of our choice on premises or any hosting of your choice </li>
<li>Cloud Edition <20> Coming soon. Get started in 5 minutes. We will take care of servers, backup etc. Always stay updated with the latest updates of Faveo</li>
</ul>
[![Build Status](https://travis-ci.org/laravel/framework.svg)](https://travis-ci.org/laravel/framework)
[![Total Downloads](https://poser.pugx.org/laravel/framework/d/total.svg)](https://packagist.org/packages/laravel/framework)
[![Latest Stable Version](https://poser.pugx.org/laravel/framework/v/stable.svg)](https://packagist.org/packages/laravel/framework)
[![Latest Unstable Version](https://poser.pugx.org/laravel/framework/v/unstable.svg)](https://packagist.org/packages/laravel/framework)
[![License](https://poser.pugx.org/laravel/framework/license.svg)](https://packagist.org/packages/laravel/framework)
<h3><a id="user-content-faveo-user-manual" href="https://github.com/ladybirdweb/faveo-helpdesk#faveo-user-manual" aria-hidden="true"></a>Faveo User Manual</h3> Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable, creative experience to be truly fulfilling. Laravel attempts to take the pain out of development by easing common tasks used in the majority of web projects, such as authentication, routing, sessions, queueing, and caching.
<p>Check out Faveo Knowledge Base <a href="http://www.ladybirdweb.com/support/knowledgebase" target="_blank">here</a></p>
<h3><a id="user-content-requirements" href="https://github.com/ladybirdweb/faveo-helpdesk#requirements" aria-hidden="true"></a>Requirements</h3>
<p>To run Faveo your host just needs a couple of things:</p>
<ul>
<li>PHP 5.5 or greater</li>
<li>MySQL 5.5 or greater</li>
<li>The mod_rewrite Apache module</li>
</ul>
<h3>Faveo Web Hosting</h3> Laravel is accessible, yet powerful, providing powerful tools needed for large, robust applications. A superb inversion of control container, expressive migration system, and tightly integrated unit testing support give you the tools you need to build any application with which you are tasked.
<p><a href="http://www.store.ladybirdwebhost.com/" target="_blank">Ladybird Web Host</a> Offers hosting with minimum requirement to host Faveo web application. Faveo has been tested on Ladybird Web Host servers &amp; works very well in their server environment. All web hosting packages offered by Ladybird Web Host come with 30 day money back gurantee.</p>
<h3><a id="user-content-credits" href="https://github.com/ladybirdweb/faveo-helpdesk#credits" aria-hidden="true"></a>Credits</h3>
<ul>
<li>Laravel Framework</li>
<li>Admin LTE Theme</li>
</ul>
<h3><a id="user-content-website" href="https://github.com/ladybirdweb/faveo-helpdesk#website" aria-hidden="true"></a>Website</h3> ## Official Documentation
<p><a href="http://www.faveohelpdesk.com/" target="_blank">www.faveohelpdesk.com</a></p>
<h3>YouTube Channel</h3> Documentation for the framework can be found on the [Laravel website](http://laravel.com/docs).
<p><a href="https://www.youtube.com/channel/UC-eqh-h241b1janp6sU7Iiw" target="_blank">Click here</a></p>
## Contributing
<h3>Road Map for Community Edition:</h3> Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](http://laravel.com/docs/contributions).
<p><a href="http://www.faveohelpdesk.com/faveo-helpdesk-road-map" target="_blank">Click here</a></p>
<h3>Don't panic if you come across bugs</h3> ## Security Vulnerabilities
<p>Faveo is very very new in the market, the product is fully working and is production worthy but it definitely will have some bugs like any software. We fully support Faveo whether free or pro edition, incase you come across any bugs, email us through the <a href="http://www.faveohelpdesk.com/contact-us/">contact form</a>. We want to make your experience of using Faveo as memorable as possible, so help us make Faveo a World, top class helpdesk application. Do check out our roadmap to stayed tuned with future releases </p>
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell at taylor@laravel.com. All security vulnerabilities will be promptly addressed.
### License
The Laravel framework is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)

View File

@@ -51,12 +51,12 @@ class Handler extends ExceptionHandler {
// return response()->view('errors.404', []); // return response()->view('errors.404', []);
// } else { // } else {
// if(\Config::get('database.install') == 1) { // if(\Config::get('database.install') == 1) {
// if(\Config::get('app.ErrorLog') == '%1%') { // // if(\Config::get('app.ErrorLog') == '%1%') {
// // \App\Http\Controllers\Common\SettingsController::smtp(); // // \App\Http\Controllers\Common\SettingsController::smtp();
// // \Mail::send('errors.report', array('e' => $e), function ($message) { // // \Mail::send('errors.report', array('e' => $e), function ($message) {
// // $message->to('', '')->subject(''); // // $message->to('', '')->subject('Faveo HELPDESK Pro ERROR');
// // }); // // });
// } // // }
// } // }
// return response()->view('errors.500', []); // return response()->view('errors.500', []);
// } // }

View File

@@ -18,6 +18,7 @@ use Input;
use Redirect; use Redirect;
use Session; use Session;
use View; use View;
use Exception;
/** /**
* |======================================================================= * |=======================================================================
@@ -40,7 +41,7 @@ class InstallerApiController extends Controller {
* @return type Json * @return type Json
*/ */
public function config_database(Request $request) { public function config_database(Request $request) {
error_reporting(E_ALL & ~E_NOTICE); error_reporting(E_ALL & ~E_NOTICE);
// Check for pre install // Check for pre install
if (\Config::get('database.install') == '%0%') { if (\Config::get('database.install') == '%0%') {
@@ -87,103 +88,90 @@ class InstallerApiController extends Controller {
* @return type Json * @return type Json
*/ */
public function config_system(Request $request) { public function config_system(Request $request) {
error_reporting(E_ALL & ~E_NOTICE); // Check for pre install
if (\Config::get('database.install') == '%0%') {
$firstname = $request->firstname;
$lastname = $request->lastname;
$email = $request->email;
$username = $request->username;
$password = $request->password;
$timezone = $request->timezone;
$datetime = $request->datetime;
try{ // Migrate database
\DB::connection()->getDatabaseName(); Artisan::call('migrate', array('--force' => true));
Artisan::call('db:seed', array('--force' => true));
// check for database connection // Creating minum settings
if(\DB::connection()->getDatabaseName()) { $system = System::where('id','=','1')->first();
echo "Connected sucessfully to database ".\DB::connection()->getDatabaseName()."."; $system->time_zone = $timezone;
$system->date_time_format = $datetime;
$system->save();
// Creating default form field
$form1 = new Form_details;
$form1->label = 'Name';
$form1->type = 'text';
$form1->form_name_id = '1';
$form1->save();
$form2 = new Form_details;
$form2->label = 'Phone';
$form2->type = 'number';
$form2->form_name_id = '1';
$form2->save();
$form3 = new Form_details;
$form3->label = 'Email';
$form3->type = 'text';
$form3->form_name_id = '1';
$form3->save();
$form4 = new Form_details;
$form4->label = 'Subject';
$form4->type = 'text';
$form4->form_name_id = '1';
$form4->save();
$form5 = new Form_details;
$form5->label = 'Details';
$form5->type = 'textarea';
$form5->form_name_id = '1';
$form5->save();
// Creating user
$user = User::create(array(
'first_name' => $firstname,
'last_name' => $lastname,
'email' => $email,
'user_name' => $username,
'password' => Hash::make($password),
'active' => 1,
'role' => 'admin',
'assign_group' => 'group A',
'primary_dpt' => 'support',
));
// Setting database installed status
$value = '1';
$install = app_path('../config/database.php');
$datacontent = File::get($install);
$datacontent = str_replace('%0%', $value, $datacontent);
File::put($install, $datacontent);
// Applying email configuration on route
$smtpfilepath = "\App\Http\Controllers\Common\SettingsController::smtp()";
$path22 = app_path('Http/routes.php');
$content23 = File::get($path22);
$content23 = str_replace('"%smtplink%"', $smtpfilepath, $content23);
File::put($path22, $content23);
// If user created return success
if($user){
return ['response'=>'success','status'=>'1'];
} }
} else {
// Check for pre install return ['response'=>'fail','reason'=>'this system is already installed','status'=>'0'];
if (\Config::get('database.install') == '%0%') {
$firstname = $request->firstname;
$lastname = $request->lastname;
$email = $request->email;
$username = $request->username;
$password = $request->password;
$timezone = $request->timezone;
$datetime = $request->datetime;
// Migrate database
Artisan::call('migrate', array('--force' => true));
Artisan::call('db:seed', array('--force' => true));
// Creating minum settings
$system = System::where('id','=','1')->first();
$system->time_zone = $timezone;
$system->date_time_format = $datetime;
$system->save();
// Creating default form field
$form1 = new Form_details;
$form1->label = 'Name';
$form1->type = 'text';
$form1->form_name_id = '1';
$form1->save();
$form2 = new Form_details;
$form2->label = 'Phone';
$form2->type = 'number';
$form2->form_name_id = '1';
$form2->save();
$form3 = new Form_details;
$form3->label = 'Email';
$form3->type = 'text';
$form3->form_name_id = '1';
$form3->save();
$form4 = new Form_details;
$form4->label = 'Subject';
$form4->type = 'text';
$form4->form_name_id = '1';
$form4->save();
$form5 = new Form_details;
$form5->label = 'Details';
$form5->type = 'textarea';
$form5->form_name_id = '1';
$form5->save();
// Creating user
$user = User::create(array(
'first_name' => $firstname,
'last_name' => $lastname,
'email' => $email,
'user_name' => $username,
'password' => Hash::make($password),
'active' => 1,
'role' => 'admin',
'assign_group' => 'group A',
'primary_dpt' => 'support',
));
// Setting database installed status
$value = '1';
$install = app_path('../config/database.php');
$datacontent = File::get($install);
$datacontent = str_replace('%0%', $value, $datacontent);
File::put($install, $datacontent);
// Applying email configuration on route
$smtpfilepath = "\App\Http\Controllers\Common\SettingsController::smtp()";
$path22 = app_path('Http/routes.php');
$content23 = File::get($path22);
$content23 = str_replace('"%smtplink%"', $smtpfilepath, $content23);
File::put($path22, $content23);
// If user created return success
if($user){
return ['response'=>'success','status'=>'1'];
}
} else {
return ['response'=>'fail','reason'=>'this system is already installed','status'=>'0'];
}
}catch(\Exception $e){
return $e->getMessage();
} }
} }
} }

View File

@@ -1,10 +1,13 @@
<?php namespace App\Http\Controllers\Admin\helpdesk; <?php namespace App\Http\Controllers\Admin\helpdesk;
// controller // controller
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Http\Controllers\Common\SettingsController; use App\Http\Controllers\Common\SettingsController;
// request // request
use App\Http\Requests\helpdesk\AgentRequest; use App\Http\Requests\helpdesk\AgentRequest;
use App\Http\Requests\helpdesk\AgentUpdate; use App\Http\Requests\helpdesk\AgentUpdate;
// model // model
use App\User; use App\User;
use App\Model\helpdesk\Agent\Assign_team_agent; use App\Model\helpdesk\Agent\Assign_team_agent;
@@ -13,13 +16,16 @@ use App\Model\helpdesk\Agent\Groups;
use App\Model\helpdesk\Agent\Teams; use App\Model\helpdesk\Agent\Teams;
use App\Model\helpdesk\Utility\Timezones; use App\Model\helpdesk\Utility\Timezones;
use App\Model\helpdesk\Settings\Company; use App\Model\helpdesk\Settings\Company;
// classes // classes
use DB; use DB;
use Mail; use Mail;
use Hash; use Hash;
use Exception;
/** /**
* AgentController * AgentController
* This controller is used to CRUD category
* *
* @package Controllers * @package Controllers
* @subpackage Controller * @subpackage Controller
@@ -27,18 +33,25 @@ use Hash;
*/ */
class AgentController extends Controller { class AgentController extends Controller {
/** /**
* Create a new controller instance. * Create a new controller instance.
* @return Response * constructor to check
* 1. authentication
* 2. user roles
* 3. roles must be agent
* @return void
*/ */
public function __construct() { public function __construct() {
SettingsController::smtp(); SettingsController::smtp();
// checking authentication
$this->middleware('auth'); $this->middleware('auth');
// checking admin roles
$this->middleware('roles'); $this->middleware('roles');
} }
/** /**
* get index page * Get all agent list page
* @param type User $user * @param type User $user
* @return type Response * @return type Response
*/ */
@@ -51,13 +64,13 @@ class AgentController extends Controller {
} }
/** /**
* Show the form for creating a new resource. * creating a new agent
* @param type Assign_team_agent $team_assign_agent * @param type Assign_team_agent $team_assign_agent
* @param type Timezones $timezone * @param type Timezones $timezone
* @param type Groups $group * @param type Groups $group
* @param type Department $department * @param type Department $department
* @param type Teams $team * @param type Teams $team
* @return type Response * @return type view
*/ */
public function create(Assign_team_agent $team_assign_agent, Timezones $timezone, Groups $group, Department $department, Teams $team) { public function create(Assign_team_agent $team_assign_agent, Timezones $timezone, Groups $group, Department $department, Teams $team) {
try { try {
@@ -68,19 +81,19 @@ class AgentController extends Controller {
$teams = $team->lists('id', 'name'); $teams = $team->lists('id', 'name');
return view('themes.default1.admin.helpdesk.agent.agents.create', compact('assign', 'teams', 'agents', 'timezones', 'groups', 'departments', 'team')); return view('themes.default1.admin.helpdesk.agent.agents.create', compact('assign', 'teams', 'agents', 'timezones', 'groups', 'departments', 'team'));
} catch (Exception $e) { } catch (Exception $e) {
return view('404'); return redirect()->back()->with('fails',$e->errorInfo[2]);
} }
} }
/** /**
* Store a newly created resource in storage. * store a new agent
* @param type User $user * @param type User $user
* @param type AgentRequest $request * @param type AgentRequest $request
* @param type Assign_team_agent $team_assign_agent * @param type Assign_team_agent $team_assign_agent
* @return type Response * @return type Response
*/ */
public function store(User $user, AgentRequest $request, Assign_team_agent $team_assign_agent) { public function store(User $user, AgentRequest $request, Assign_team_agent $team_assign_agent) {
try {
/* Insert to user table */ /* Insert to user table */
$user->role = 'agent'; $user->role = 'agent';
$user->fill($request->input())->save(); $user->fill($request->input())->save();
@@ -88,6 +101,7 @@ class AgentController extends Controller {
$user->password = Hash::make($password); $user->password = Hash::make($password);
$requests = $request->input('team_id'); $requests = $request->input('team_id');
$id = $user->id; $id = $user->id;
// insert team
foreach ($requests as $req) { 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]);
} }
@@ -96,29 +110,22 @@ class AgentController extends Controller {
$name = $user->user_name; $name = $user->user_name;
$email = $user->email; $email = $user->email;
$from = $this->company(); $from = $this->company();
Mail::send('emails.pass', ['name' => $name, 'password' => $password, 'from' => $from, 'emailadd' => $email], function ($message) use ($email, $name) { // send mail on registration
$message->to($email, $name)->subject('[password]'); try{
}); Mail::send('emails.pass', ['name' => $name, 'password' => $password, 'from' => $from, 'emailadd' => $email], function ($message) use ($email, $name) {
$message->to($email, $name)->subject('[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('success', 'Agent Created sucessfully'); return redirect('agents')->with('success', 'Agent Created sucessfully');
} else { } else {
return redirect('agents')->with('fails', 'Agent can not Create'); return redirect('agents')->with('fails', 'Agent can not Create');
} }
} catch (Exception $e) {
return redirect('agents')->with('fails', 'Agent can not Create');
}
} }
/** /**
* Display the specified resource. * Editing a selected agent
* @param int $id
* @return Response
*/
public function show($id) {
//
}
/**
* Show the form for editing the specified resource.
* @param type int $id * @param type int $id
* @param type User $user * @param type User $user
* @param type Assign_team_agent $team_assign_agent * @param type Assign_team_agent $team_assign_agent
@@ -146,7 +153,7 @@ class AgentController extends Controller {
} }
/** /**
* Update the specified resource in storage. * Update the specified agent in storage.
* @param type int $id * @param type int $id
* @param type User $user * @param type User $user
* @param type AgentUpdate $request * @param type AgentUpdate $request
@@ -154,53 +161,53 @@ class AgentController extends Controller {
* @return type Response * @return type Response
*/ */
public function update($id, User $user, AgentUpdate $request, Assign_team_agent $team_assign_agent) { public function update($id, User $user, AgentUpdate $request, Assign_team_agent $team_assign_agent) {
try {
// storing all the details
$user = $user->whereId($id)->first(); $user = $user->whereId($id)->first();
$daylight_save = $request->input('daylight_save'); $daylight_save = $request->input('daylight_save');
$limit_access = $request->input('limit_access'); $limit_access = $request->input('limit_access');
$directory_listing = $request->input('directory_listing'); $directory_listing = $request->input('directory_listing');
$vocation_mode = $request->input('vocation_mode'); $vocation_mode = $request->input('vocation_mode');
//============================================== //==============================================
$user->daylight_save = $daylight_save;
$user->limit_access = $limit_access;
$user->directory_listing = $directory_listing;
$user->vocation_mode = $vocation_mode;
//==============================================
$table = $team_assign_agent->where('agent_id', $id); $table = $team_assign_agent->where('agent_id', $id);
$table->delete(); $table->delete();
$requests = $request->input('team_id'); $requests = $request->input('team_id');
// inserting team details
foreach ($requests as $req) { 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]);
} }
//Todo For success and failure conditions //Todo For success and failure conditions
$user->fill($request->except('daylight_save', 'limit_access', 'directory_listing', 'vocation_mode', 'assign_team'))->save(); try {
return redirect('agents')->with('success', 'Agent Updated sucessfully'); $user->fill($request->except('daylight_save', 'limit_access', 'directory_listing', 'vocation_mode', 'assign_team'))->save();
} catch (Exception $e) { return redirect('agents')->with('success', 'Agent Updated sucessfully');
return redirect('agents')->with('fails', 'Agent did not update'); } catch (Exception $e) {
} return redirect('agents')->with('fails', 'Agent did not update'.'<li>'.$e->errorInfo[2].'</li>');
}
} }
/** /**
* Remove the specified resource from storage. * Remove the specified agent from storage.
* @param type int $id * @param type int $id
* @param type User $user * @param type User $user
* @param type Assign_team_agent $team_assign_agent * @param type Assign_team_agent $team_assign_agent
* @return type Response * @return type Response
*/ */
public function destroy($id, User $user, Assign_team_agent $team_assign_agent) { public function destroy($id, User $user, Assign_team_agent $team_assign_agent) {
try {
/* Becouse of foreign key we delete team_assign_agent first */ /* Becouse of foreign key we delete team_assign_agent first */
error_reporting(E_ALL & ~E_NOTICE);
$team_assign_agent = $team_assign_agent->where('agent_id', $id); $team_assign_agent = $team_assign_agent->where('agent_id', $id);
$team_assign_agent->delete(); $team_assign_agent->delete();
$user = $user->whereId($id)->first(); $user = $user->whereId($id)->first();
if ($user->delete()) { try {
$error = 'This staff is related to some tickets';
$user->id;
$user->delete();
throw new \Exception($error);
return redirect('agents')->with('success', 'Agent Deleted sucessfully'); return redirect('agents')->with('success', 'Agent Deleted sucessfully');
} else { } catch (\Exception $e) {
return redirect('agents')->with('fails', 'Agent can not Delete '); dd($e->errorInfo);
return redirect('agents')->with('fails', $error);
} }
} catch (Exception $e) {
return redirect('agents')->with('fails', 'Agent can not Delete if the team Excist');
}
} }
@@ -220,11 +227,10 @@ class AgentController extends Controller {
} }
/** /**
* company * Fetching comapny name to send mail
* @return type * @return type
*/ */
public function company() public function company() {
{
$company = Company::Where('id','=','1')->first(); $company = Company::Where('id','=','1')->first();
if($company->company_name == null){ if($company->company_name == null){
$company = "Support Center"; $company = "Support Center";
@@ -234,11 +240,9 @@ class AgentController extends Controller {
return $company; return $company;
} }
// public function agent_profile($id) {
// $agent = User::where('id','=',$id)->first();
public function agent_profile($id) { // return \View::make('themes.default1.admin.helpdesk.agent.agents.agent-profile',compact('agent'));
$agent = User::where('id','=',$id)->first(); // }
return \View::make('themes.default1.admin.helpdesk.agent.agents.agent-profile',compact('agent'));
}
} }

View File

@@ -1,27 +1,39 @@
<?php namespace App\Http\Controllers\Admin\helpdesk; <?php namespace App\Http\Controllers\Admin\helpdesk;
// controller // controller
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
// request // request
use App\Http\Requests\helpdesk\BanlistRequest; use App\Http\Requests\helpdesk\BanlistRequest;
use App\Http\Requests\helpdesk\BanRequest; use App\Http\Requests\helpdesk\BanRequest;
// model // model
use App\User; use App\User;
use App\Model\helpdesk\Email\Banlist;
//classes
use Exception;
/** /**
* BanlistController * BanlistController
* * In this controller in the CRUD function for all the banned emails
* @package Controllers * @package Controllers
* @subpackage Controller * @subpackage Controller
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class BanlistController extends Controller { class BanlistController extends Controller {
/** /**
* Create a new controller instance. * Create a new controller instance.
* @return type void * constructor to check
* 1. authentication
* 2. user roles
* 3. roles must be agent
* @return void
*/ */
public function __construct() { public function __construct() {
// checking authentication
$this->middleware('auth'); $this->middleware('auth');
// checking admin roles
$this->middleware('roles'); $this->middleware('roles');
} }
@@ -59,27 +71,28 @@ class BanlistController extends Controller {
* @return type Response * @return type Response
*/ */
public function store(BanRequest $request, User $user) { public function store(BanRequest $request, User $user) {
// try { // dd($request);
try {
//adding field to user whether it is banned or not //adding field to user whether it is banned or not
$adban = $request->input('email'); $adban = $request->input('email');
$use = $user->where('email', $adban)->first(); $use = $user->where('email', $adban)->first();
if ($use != null) { if ($use != null) {
$use->ban = $request->input('ban_status'); $use->ban = $request->input('ban');
$use->internal_note = $request->input('internal_note'); $use->internal_note = $request->input('internal_note');
$use->save(); $use->save();
// $user->create($request->input())->save(); // $user->create($request->input())->save();
return redirect()->back()->with('success', 'Email Banned sucessfully'); return redirect('banlist')->with('success', 'Email Banned sucessfully');
} else { } else {
$user = new User; $user = new User;
$user->email = $adban; $user->email = $adban;
$user->ban = $request->input('ban_status'); $user->ban = $request->input('ban');
$user->internal_note = $request->input('internal_note'); $user->internal_note = $request->input('internal_note');
$user->save(); $user->save();
return redirect()->back()->with('success', 'Email Banned sucessfully'); return redirect('banlist')->with('success', 'Email Banned sucessfully');
} }
// } catch (Exception $e) { } catch (Exception $e) {
// return redirect('banlist')->with('fails', 'Email can not Ban'); return redirect('banlist')->with('fails', 'Email can not Ban');
// } }
} }
/** /**
@@ -136,17 +149,15 @@ class BanlistController extends Controller {
* @param type Banlist $ban * @param type Banlist $ban
* @return type Response * @return type Response
*/ */
public function destroy($id, Banlist $ban) { // public function destroy($id, Banlist $ban) {
try { // $bans = $ban->whereId($id)->first();
$bans = $ban->whereId($id)->first(); // dd($bans);
/* Success and Falure condition */ // /* Success and Falure condition */
if ($bans->delete() == true) { // try{
return redirect('banlist')->with('success', 'Banned Email Deleted sucessfully'); // $bans->delete();
} else { // return redirect('banlist')->with('success', 'Banned Email Deleted sucessfully');
return redirect('banlist')->with('fails', 'Banned Email can not Delete'); // } catch (Exception $e) {
} // return redirect('banlist')->with('fails', 'Banned Email can not Delete'.'<li>'.$e->errorInfo[2].'</li>');
} catch (Exception $e) { // }
return redirect('banlist')->with('fails', 'Banned Email can not Delete'); // }
}
}
} }

View File

@@ -12,9 +12,13 @@ use App\Model\helpdesk\Agent\Teams;
use App\Model\helpdesk\Email\Emails; use App\Model\helpdesk\Email\Emails;
use App\Model\helpdesk\Email\Template; use App\Model\helpdesk\Email\Template;
use App\Model\helpdesk\Manage\Sla_plan; use App\Model\helpdesk\Manage\Sla_plan;
use App\Model\helpdesk\Settings\System;
use App\Model\helpdesk\Ticket\Tickets;
use App\Model\helpdesk\Manage\Help_topic;
use App\User; use App\User;
// classes // classes
use DB; use DB;
use Exception;
/** /**
* DepartmentController * DepartmentController
@@ -81,9 +85,14 @@ class DepartmentController extends Controller {
*/ */
public function store(Department $department, DepartmentRequest $request) { public function store(Department $department, DepartmentRequest $request) {
try { try {
$department->fill($request->except('group_id'))->save(); $department->fill($request->except('group_id','manager'))->save();
$requests = $request->input('group_id'); $requests = $request->input('group_id');
$id = $department->id; $id = $department->id;
if($request->manager) {
$department->manager = $request->input('manager');
} else {
$department->manager = null;
}
// foreach ($requests as $req) { // foreach ($requests as $req) {
// DB::insert('insert into group_assign_department(group_id, department_id) values (?,?)', [$req, $id]); // DB::insert('insert into group_assign_department(group_id, department_id) values (?,?)', [$req, $id]);
// } // }
@@ -99,16 +108,6 @@ class DepartmentController extends Controller {
} }
} }
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($id) {
//
}
/** /**
* Show the form for editing the specified resource. * Show the form for editing the specified resource.
* @param type int $id * @param type int $id
@@ -146,6 +145,7 @@ class DepartmentController extends Controller {
* @return type Response * @return type Response
*/ */
public function update($id, Group_assign_department $group_assign_department, Department $department, DepartmentUpdate $request) { public function update($id, Group_assign_department $group_assign_department, Department $department, DepartmentUpdate $request) {
// dd($id);
try { try {
$table = $group_assign_department->where('department_id', $id); $table = $group_assign_department->where('department_id', $id);
$table->delete(); $table->delete();
@@ -154,7 +154,15 @@ class DepartmentController extends Controller {
// DB::insert('insert into group_assign_department (group_id, department_id) values (?,?)', [$req, $id]); // DB::insert('insert into group_assign_department (group_id, department_id) values (?,?)', [$req, $id]);
// } // }
$departments = $department->whereId($id)->first(); $departments = $department->whereId($id)->first();
if ($departments->fill($request->except('group_access'))->save()) {
if($request->manager) {
$departments->manager = $request->input('manager');
} else {
$departments->manager = null;
}
$departments->save();
if ($departments->fill($request->except('group_access','manager'))->save()) {
return redirect('departments')->with('success', 'Department Updated sucessfully'); return redirect('departments')->with('success', 'Department Updated sucessfully');
} else { } else {
return redirect('departments')->with('fails', 'Department not Updated'); return redirect('departments')->with('fails', 'Department not Updated');
@@ -171,21 +179,64 @@ class DepartmentController extends Controller {
* @param type Group_assign_department $group_assign_department * @param type Group_assign_department $group_assign_department
* @return type Response * @return type Response
*/ */
public function destroy($id, Department $department, Group_assign_department $group_assign_department) { public function destroy($id, Department $department, Group_assign_department $group_assign_department, System $system, Tickets $tickets) {
try { // try {
/* Becouse of foreign key we delete group_assign_department first */ $system = $system->where('id','=','1')->first();
$group_assign_department = $group_assign_department->where('department_id', $id); if($system->department == $id) {
$group_assign_department->delete(); return redirect('departments')->with('fails', 'You cannot delete default department');
$departments = $department->whereId($id)->first();
/* Check the function is Success or Fail */
if ($departments->delete() == true) {
return redirect('departments')->with('success', 'Department Deleted sucessfully');
} else { } else {
return redirect('departments')->with('fails', 'Department can not Delete'); $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>';
} else {
$ticket = "";
}
$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>';
} else {
$user = "";
}
$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>';
} else {
$email = "";
}
$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;
/* Becouse of foreign key we delete group_assign_department first */
$group_assign_department = $group_assign_department->where('department_id', $id);
$group_assign_department->delete();
$departments = $department->whereId($id)->first();
/* Check the function is Success or Fail */
if ($departments->delete() == true) {
return redirect('departments')->with('success', 'Department Deleted sucessfully'.$message);
} else {
return redirect('departments')->with('fails', 'Department can not Delete');
}
} }
} catch (Exception $e) {
return redirect('departments')->with('fails', 'Department can not Delete');
}
} }
} }

View File

@@ -12,6 +12,7 @@ use App\Model\helpdesk\Utility\MailboxProtocol;
use App\Model\helpdesk\Ticket\Ticket_Priority; use App\Model\helpdesk\Ticket\Ticket_Priority;
// classes // classes
use Crypt; use Crypt;
use Exception;
/** /**
* EmailsController * EmailsController

View File

@@ -1,12 +1,29 @@
<?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\Fields;
use App\Model\helpdesk\Form\Forms; use App\Model\helpdesk\Form\Forms;
use Illuminate\Http\Request; use App\Model\helpdesk\Manage\Help_topic;
use Input;
use App\Http\Controllers\Controller;
use Redirect;
// Request
use Illuminate\Http\Request;
// Class
use Input;
use Redirect;
use Exception;
/**
* FormController
* This controller is used to CRUD Custom Forms
*
* @package Controllers
* @subpackage Controller
* @author Ladybird <info@ladybirdweb.com>
*/
class FormController extends Controller { class FormController extends Controller {
private $fields; private $fields;
private $forms; private $forms;
@@ -91,8 +108,13 @@ class FormController extends Controller {
public function delete($id,Forms $forms, Fields $field) { public function delete($id,Forms $forms, Fields $field, Help_topic $help_topic) {
$fields = $field->where('forms_id',$id)->get(); $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(); $field->delete();
} }

View File

@@ -8,9 +8,10 @@ use Illuminate\Http\Request;
use App\Model\helpdesk\Agent\Department; use App\Model\helpdesk\Agent\Department;
use App\Model\helpdesk\Agent\Groups; use App\Model\helpdesk\Agent\Groups;
use App\Model\helpdesk\Agent\Group_assign_department; use App\Model\helpdesk\Agent\Group_assign_department;
use App\User;
// classes // classes
use Illuminate\Support\Facades\Input; use Illuminate\Support\Facades\Input;
use Exception;
/** /**
* GroupController * GroupController
* *
@@ -67,29 +68,14 @@ class GroupController extends Controller {
public function store(Groups $group, GroupRequest $request) { public function store(Groups $group, GroupRequest $request) {
try { try {
/* Check Whether function success or not */ /* Check Whether function success or not */
if ($group->fill($request->input())->save() == true) { $group->fill($request->input())->save();
/* redirect to Index page with Success Message */ return redirect('groups')->with('success', 'Group Created Successfully');
return redirect('groups')->with('success', 'Groups Created Successfully');
} else {
/* redirect to Index page with Fails Message */
return redirect('groups')->with('fails', 'Groups can not Create');
}
} catch (Exception $e) { } catch (Exception $e) {
/* redirect to Index page with Fails Message */ /* redirect to Index page with Fails Message */
return redirect('groups')->with('fails', 'Groups can not Create'); return redirect('groups')->with('fails', 'Groups can not Create'.'<li>'.$e->errorInfo[2].'</li>');
} }
} }
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($id, Groups $group, Request $request) {
//
}
/** /**
* Show the form for editing the specified resource. * Show the form for editing the specified resource.
* @param type int $id * @param type int $id
@@ -101,7 +87,7 @@ class GroupController extends Controller {
$groups = $group->whereId($id)->first(); $groups = $group->whereId($id)->first();
return view('themes.default1.admin.helpdesk.agent.groups.edit', compact('groups')); return view('themes.default1.admin.helpdesk.agent.groups.edit', compact('groups'));
} catch (Exception $e) { } catch (Exception $e) {
return view('404'); return redirect('groups')->with('fails', 'Groups can not Create'.'<li>'.$e->errorInfo[2].'</li>');
} }
} }
@@ -113,7 +99,6 @@ class GroupController extends Controller {
* @return type Response * @return type Response
*/ */
public function update($id, Groups $group, Request $request) { public function update($id, Groups $group, Request $request) {
try {
$var = $group->whereId($id)->first(); $var = $group->whereId($id)->first();
//Updating Status //Updating Status
$status = $request->Input('group_status'); $status = $request->Input('group_status');
@@ -158,17 +143,14 @@ class GroupController extends Controller {
$adminNotes = $request->Input('admin_notes'); $adminNotes = $request->Input('admin_notes');
$var->admin_notes = $adminNotes; $var->admin_notes = $adminNotes;
/* Check whether function success or not */ /* Check whether function success or not */
if ($var->save() == true) { try {
$var->save();
/* redirect to Index page with Success Message */ /* redirect to Index page with Success Message */
return redirect('groups')->with('success', 'Group Updated Successfully'); return redirect('groups')->with('success', 'Group Updated Successfully');
} else { } catch (Exception $e) {
/* redirect to Index page with Fails Message */ /* redirect to Index page with Fails Message */
return redirect('groups')->with('fails', 'Group can not Update'); return redirect('groups')->with('fails', 'Groups can not Create'.'<li>'.$e->errorInfo[2].'</li>');
} }
} catch (Exception $e) {
/* redirect to Index page with Fails Message */
return redirect('groups')->with('fails', 'Groups can not Create');
}
} }
/** /**
@@ -178,21 +160,22 @@ class GroupController extends Controller {
* @param type Group_assign_department $group_assign_department * @param type Group_assign_department $group_assign_department
* @return type Response * @return type Response
*/ */
public function destroy($id, Groups $group, Group_assign_department $group_assign_department) { public function destroy($id, Groups $group, Group_assign_department $group_assign_department) {
try { $users = User::where('assign_group', '=', $id)->first();
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);
}
$group_assign_department->where('group_id', $id)->delete(); $group_assign_department->where('group_id', $id)->delete();
$groups = $group->whereId($id)->first(); $groups = $group->whereId($id)->first();
/* Check whether function success or not */ /* Check whether function success or not */
if ($groups->delete() == true) { try {
$groups->delete();
/* redirect to Index page with Success Message */ /* redirect to Index page with Success Message */
return redirect('groups')->with('success', 'Group Deleted Successfully'); return redirect('groups')->with('success', 'Group Deleted Successfully');
} else { } catch (Exception $e) {
/* redirect to Index page with Fails Message */ /* redirect to Index page with Fails Message */
return redirect('groups')->with('fails', 'Group can not Delete'); return redirect('groups')->with('fails', 'Groups cannot Create'.'<li>'.$e->errorInfo[2].'</li>');
} }
} catch (Exception $e) {
/* redirect to Index page with Fails Message */
return redirect('groups')->with('fails', 'Groups can not Create');
}
} }
} }

View File

@@ -11,7 +11,11 @@ use App\Model\helpdesk\Form\Forms;
use App\Model\helpdesk\Manage\Help_topic; use App\Model\helpdesk\Manage\Help_topic;
use App\Model\helpdesk\Manage\Sla_plan; use App\Model\helpdesk\Manage\Sla_plan;
use App\Model\helpdesk\Ticket\Ticket_Priority; use App\Model\helpdesk\Ticket\Ticket_Priority;
use App\Model\helpdesk\Settings\Ticket;
use App\User; use App\User;
// classes
use DB;
use Exception;
/** /**
* HelptopicController * HelptopicController
@@ -88,29 +92,15 @@ class HelptopicController extends Controller {
public function store(Help_topic $topic, HelptopicRequest $request) { public function store(Help_topic $topic, HelptopicRequest $request) {
try { try {
/* Check whether function success or not */ /* Check whether function success or not */
if ($topic->fill($request->input())->save() == true) { $topic->fill($request->input())->save();
/* redirect to Index page with Success Message */ /* redirect to Index page with Success Message */
return redirect('helptopic')->with('success', 'Helptopic Created Successfully'); return redirect('helptopic')->with('success', 'Helptopic Created Successfully');
} else {
/* redirect to Index page with Fails Message */
return redirect('helptopic')->with('fails', 'Helptopic can not Create');
}
} catch (Exception $e) { } catch (Exception $e) {
/* redirect to Index page with Fails Message */ /* redirect to Index page with Fails Message */
return redirect('helptopic')->with('fails', 'Helptopic can not Create'); return redirect('helptopic')->with('fails', 'Helptopic can not Create'.'<li>'.$e->errorInfo[2].'</li>');
} }
} }
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($id) {
//
}
/** /**
* Show the form for editing the specified resource. * Show the form for editing the specified resource.
* @param type $id * @param type $id
@@ -132,7 +122,7 @@ class HelptopicController extends Controller {
$priority = $priority->get(); $priority = $priority->get();
return view('themes.default1.admin.helpdesk.manage.helptopic.edit', compact('priority', 'departments', 'topics', 'forms', 'agents', 'slas')); return view('themes.default1.admin.helpdesk.manage.helptopic.edit', compact('priority', 'departments', 'topics', 'forms', 'agents', 'slas'));
} catch (Exception $e) { } catch (Exception $e) {
return view('404'); return redirect('helptopic')->with('fails', '<li>'.$e->errorInfo[2].'</li>');
} }
} }
@@ -144,19 +134,29 @@ class HelptopicController extends Controller {
* @return type Response * @return type Response
*/ */
public function update($id, Help_topic $topic, HelptopicUpdate $request) { public function update($id, Help_topic $topic, HelptopicUpdate $request) {
// dd($request);
try { try {
$topics = $topic->whereId($id)->first(); $topics = $topic->whereId($id)->first();
if($request->custom_form){
$custom_form = $request->custom_form;
} else {
$custom_form = null;
}
if($request->auto_assign){
$auto_assign = $request->auto_assign;
} else {
$auto_assign = null;
}
/* Check whether function success or not */ /* Check whether function success or not */
if ($topics->fill($request->input())->save() == true) { $topics->fill($request->except('custom_form','auto_assign'))->save();
$topics->custom_form = $custom_form;
$topics->auto_assign = $auto_assign;
$topics->save();
/* redirect to Index page with Success Message */ /* redirect to Index page with Success Message */
return redirect('helptopic')->with('success', 'Helptopic Updated Successfully'); return redirect('helptopic')->with('success', 'Helptopic Updated Successfully');
} else {
/* redirect to Index page with Fails Message */
return redirect('helptopic')->with('fails', 'Helptopic can not Updated');
}
} catch (Exception $e) { } catch (Exception $e) {
/* redirect to Index page with Fails Message */ /* redirect to Index page with Fails Message */
return redirect('helptopic')->with('fails', 'Helptopic can not Create'); return redirect('helptopic')->with('fails', 'Helptopic can not Update'.'<li>'.$e->errorInfo[2].'</li>');
} }
} }
@@ -166,20 +166,50 @@ class HelptopicController extends Controller {
* @param type Help_topic $topic * @param type Help_topic $topic
* @return type Response * @return type Response
*/ */
public function destroy($id, Help_topic $topic) { public function destroy($id, Help_topic $topic, Ticket $ticket_setting) {
try { $ticket_settings = $ticket_setting->where('id','=','1')->first();
$topics = $topic->whereId($id)->first(); if($ticket_settings->help_topic == $id) {
/* Check whether function success or not */ return redirect('departments')->with('fails', 'You cannot delete default department');
if ($topics->delete() == true) {
/* redirect to Index page with Success Message */
return redirect('helptopic')->with('success', 'Helptopic Deleted Successfully');
} else { } else {
/* redirect to Index page with Fails Message */
return redirect('helptopic')->with('fails', 'Helptopic can not Delete'); $tickets = DB::table('tickets')->where('help_topic_id','=',$id)->update(['help_topic_id' => $ticket_settings->help_topic]);
if($tickets > 0){
if($tickets > 1){
$text_tickets = "Tickets";
} else {
$text_tickets = "Ticket";
}
$ticket = '<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]);
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>';
} else {
$email = "";
}
$message = $ticket.$email;
$topics = $topic->whereId($id)->first();
/* Check whether function success or not */
try{
$topics->delete();
/* redirect to Index page with Success Message */
return redirect('helptopic')->with('success', 'Helptopic Deleted Successfully'.$message);
} catch (Exception $e) {
/* redirect to Index page with Fails Message */
return redirect('helptopic')->with('fails', 'Helptopic can not Delete'.'<li>'.$e->errorInfo[2].'</li>');
}
} }
} catch (Exception $e) {
/* redirect to Index page with Fails Message */
return redirect('helptopic')->with('fails', 'Helptopic can not Create');
}
} }
} }

View File

@@ -17,6 +17,7 @@ use App;
use Lang; use Lang;
use Cache; use Cache;
use File; use File;
use Exception;
/** /**
* SlaController * SlaController

View File

@@ -10,6 +10,7 @@ use App\User;
use Auth; use Auth;
use Hash; use Hash;
use Input; use Input;
use Exception;
/** /**
* ProfileController * ProfileController

View File

@@ -20,13 +20,13 @@ use App\Model\helpdesk\Settings\System;
use App\Model\helpdesk\Settings\Ticket; use App\Model\helpdesk\Settings\Ticket;
use App\Model\helpdesk\Utility\Date_format; use App\Model\helpdesk\Utility\Date_format;
use App\Model\helpdesk\Utility\Date_time_format; use App\Model\helpdesk\Utility\Date_time_format;
use App\Model\helpdesk\Utility\Logs;
use App\Model\helpdesk\Ticket\Ticket_Priority; use App\Model\helpdesk\Ticket\Ticket_Priority;
use App\Model\helpdesk\Utility\Timezones; use App\Model\helpdesk\Utility\Timezones;
use App\Model\helpdesk\Utility\Time_format; use App\Model\helpdesk\Utility\Time_format;
// classes // classes
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Input; use Input;
use Exception;
/** /**
* SettingsController * SettingsController
@@ -69,7 +69,7 @@ class SettingsController extends Controller {
/* Direct to Company Settings Page */ /* Direct to Company Settings Page */
return view('themes.default1.admin.helpdesk.settings.company', compact('companys')); return view('themes.default1.admin.helpdesk.settings.company', compact('companys'));
} catch (Exception $e) { } catch (Exception $e) {
return view('404'); return redirect()->back()->with('fails',$e->errorInfo[2]);
} }
} }
@@ -81,7 +81,7 @@ class SettingsController extends Controller {
* @return Response * @return Response
*/ */
public function postcompany($id, Company $company, CompanyRequest $request) { public function postcompany($id, Company $company, CompanyRequest $request) {
try {
/* fetch the values of company request */ /* fetch the values of company request */
$companys = $company->whereId('1')->first(); $companys = $company->whereId('1')->first();
if (Input::file('logo')) { if (Input::file('logo')) {
@@ -96,17 +96,14 @@ class SettingsController extends Controller {
$companys->use_logo = '0'; $companys->use_logo = '0';
} }
/* Check whether function success or not */ /* Check whether function success or not */
if ($companys->fill($request->except('logo'))->save() == true) { try {
$companys->fill($request->except('logo'))->save();
/* redirect to Index page with Success Message */ /* redirect to Index page with Success Message */
return redirect('getcompany')->with('success', 'Company Updated Successfully'); return redirect('getcompany')->with('success', 'Company Updated Successfully');
} else { } catch (Exception $e) {
/* redirect to Index page with Fails Message */ /* redirect to Index page with Fails Message */
return redirect('getcompany')->with('fails', 'Company can not Updated'); return redirect('getcompany')->with('fails', 'Company can not Updated'.'<li>'.$e->errorInfo[2].'</li>');
} }
} catch (Exception $e) {
/* redirect to Index page with Fails Message */
return redirect('getcompany')->with('fails', 'Company can not Updated');
}
} }
/** /**
@@ -117,10 +114,9 @@ class SettingsController extends Controller {
* @param type Date_format $date * @param type Date_format $date
* @param type Date_time_format $date_time * @param type Date_time_format $date_time
* @param type Time_format $time * @param type Time_format $time
* @param type Logs $log
* @return type Response * @return type Response
*/ */
public function getsystem(System $system, Department $department, Timezones $timezone, Date_format $date, Date_time_format $date_time, Time_format $time, Logs $log) { public function getsystem(System $system, Department $department, Timezones $timezone, Date_format $date, Date_time_format $date_time, Time_format $time) {
try { try {
/* fetch the values of system from system table */ /* fetch the values of system from system table */
$systems = $system->whereId('1')->first(); $systems = $system->whereId('1')->first();
@@ -129,9 +125,9 @@ class SettingsController extends Controller {
/* Fetch the values from Timezones table */ /* Fetch the values from Timezones table */
$timezones = $timezone->get(); $timezones = $timezone->get();
/* Direct to System Settings Page */ /* Direct to System Settings Page */
return view('themes.default1.admin.helpdesk.settings.system', compact('systems', 'departments', 'timezones', 'time', 'date', 'date_time', 'log')); return view('themes.default1.admin.helpdesk.settings.system', compact('systems', 'departments', 'timezones', 'time', 'date', 'date_time'));
} catch (Exception $e) { } catch (Exception $e) {
return view('404'); return redirect()->back()->with('fails',$e->errorInfo[2]);
} }
} }
@@ -144,20 +140,17 @@ class SettingsController extends Controller {
*/ */
public function postsystem($id, System $system, SystemRequest $request) { public function postsystem($id, System $system, SystemRequest $request) {
try { try {
// dd($request);
/* fetch the values of system request */ /* fetch the values of system request */
$systems = $system->whereId('1')->first(); $systems = $system->whereId('1')->first();
/* fill the values to coompany table */ /* fill the values to coompany table */
/* Check whether function success or not */ /* Check whether function success or not */
if ($systems->fill($request->input())->save() == true) { $systems->fill($request->input())->save();
/* redirect to Index page with Success Message */ /* redirect to Index page with Success Message */
return redirect('getsystem')->with('success', 'System Updated Successfully'); return redirect('getsystem')->with('success', 'System Updated Successfully');
} else {
/* redirect to Index page with Fails Message */
return redirect('getsystem')->with('fails', 'System can not Updated');
}
} catch (Exception $e) { } catch (Exception $e) {
/* redirect to Index page with Fails Message */ /* redirect to Index page with Fails Message */
return redirect('getsystem')->with('fails', 'System can not Updated'); return redirect('getsystem')->with('fails', 'System can not Updated'.'<li>'.$e->errorInfo[2].'</li>');
} }
} }
@@ -180,7 +173,7 @@ class SettingsController extends Controller {
/* Direct to Ticket Settings Page */ /* Direct to Ticket Settings Page */
return view('themes.default1.admin.helpdesk.settings.ticket', compact('tickets', 'slas', 'topics', 'priority')); return view('themes.default1.admin.helpdesk.settings.ticket', compact('tickets', 'slas', 'topics', 'priority'));
} catch (Exception $e) { } catch (Exception $e) {
return view('404'); return redirect()->back()->with('fails',$e->errorInfo[2]);
} }
} }
@@ -206,16 +199,12 @@ class SettingsController extends Controller {
$tickets->html = $request->input('html'); $tickets->html = $request->input('html');
$tickets->client_update = $request->input('client_update'); $tickets->client_update = $request->input('client_update');
/* Check whether function success or not */ /* Check whether function success or not */
if ($tickets->save() == true) { $tickets->save();
/* redirect to Index page with Success Message */ /* redirect to Index page with Success Message */
return redirect('getticket')->with('success', 'Ticket Updated Successfully'); return redirect('getticket')->with('success', 'Ticket Updated Successfully');
} else {
/* redirect to Index page with Fails Message */
return redirect('getticket')->with('fails', 'Ticket can not Updated');
}
} catch (Exception $e) { } catch (Exception $e) {
/* redirect to Index page with Fails Message */ /* redirect to Index page with Fails Message */
return redirect('getticket')->with('fails', 'Ticket can not Updated'); return redirect('getticket')->with('fails', 'Ticket can not Updated'.'<li>'.$e->errorInfo[2].'</li>');
} }
} }
@@ -237,7 +226,7 @@ class SettingsController extends Controller {
/* Direct to Email Settings Page */ /* Direct to Email Settings Page */
return view('themes.default1.admin.helpdesk.settings.email', compact('emails', 'templates', 'emails1')); return view('themes.default1.admin.helpdesk.settings.email', compact('emails', 'templates', 'emails1'));
} catch (Exception $e) { } catch (Exception $e) {
return view('404'); return redirect()->back()->with('fails',$e->errorInfo[2]);
} }
} }
@@ -262,16 +251,12 @@ class SettingsController extends Controller {
$emails->strip = $request->input('strip'); $emails->strip = $request->input('strip');
$emails->attachment = $request->input('attachment'); $emails->attachment = $request->input('attachment');
/* Check whether function success or not */ /* Check whether function success or not */
if ($emails->save() == true) { $emails->save();
/* redirect to Index page with Success Message */ /* redirect to Index page with Success Message */
return redirect('getemail')->with('success', 'Email Updated Successfully'); return redirect('getemail')->with('success', 'Email Updated Successfully');
} else {
/* redirect to Index page with Fails Message */
return redirect('getemail')->with('fails', 'Email can not Updated');
}
} catch (Exception $e) { } catch (Exception $e) {
/* redirect to Index page with Fails Message */ /* redirect to Index page with Fails Message */
return redirect('getemail')->with('fails', 'Email can not Updated'); return redirect('getemail')->with('fails', 'Email can not Updated'.'<li>'.$e->errorInfo[2].'</li>');
} }
} }
@@ -334,7 +319,7 @@ class SettingsController extends Controller {
/* Direct to Responder Settings Page */ /* Direct to Responder Settings Page */
return view('themes.default1.admin.helpdesk.settings.responder', compact('responders')); return view('themes.default1.admin.helpdesk.settings.responder', compact('responders'));
} catch (Exception $e) { } catch (Exception $e) {
return view('404'); return redirect()->back()->with('fails',$e->errorInfo[2]);
} }
} }
@@ -356,16 +341,12 @@ class SettingsController extends Controller {
$responders->overlimit = $request->input('overlimit'); $responders->overlimit = $request->input('overlimit');
/* fill the values to coompany table */ /* fill the values to coompany table */
/* Check whether function success or not */ /* Check whether function success or not */
if ($responders->save() == true) { $responders->save();
/* redirect to Index page with Success Message */ /* redirect to Index page with Success Message */
return redirect('getresponder')->with('success', 'Responder Updated Successfully'); return redirect('getresponder')->with('success', 'Responder Updated Successfully');
} else {
/* redirect to Index page with Fails Message */
return redirect('getresponder')->with('fails', 'Responder can not Updated');
}
} catch (Exception $e) { } catch (Exception $e) {
/* redirect to Index page with Fails Message */ /* redirect to Index page with Fails Message */
return redirect('getresponder')->with('fails', 'Responder can not Updated'); return redirect('getresponder')->with('fails', 'Responder can not Updated'.'<li>'.$e->errorInfo[2].'</li>');
} }
} }
@@ -381,7 +362,7 @@ class SettingsController extends Controller {
/* Direct to Alert Settings Page */ /* Direct to Alert Settings Page */
return view('themes.default1.admin.helpdesk.settings.alert', compact('alerts')); return view('themes.default1.admin.helpdesk.settings.alert', compact('alerts'));
} catch (Exception $e) { } catch (Exception $e) {
return view('404'); return redirect()->back()->with('fails',$e->errorInfo[2]);
} }
} }
@@ -442,16 +423,12 @@ class SettingsController extends Controller {
} }
/* fill the values to coompany table */ /* fill the values to coompany table */
/* Check whether function success or not */ /* Check whether function success or not */
if ($alerts->save() == true) { $alerts->save();
/* redirect to Index page with Success Message */ /* redirect to Index page with Success Message */
return redirect('getalert')->with('success', 'Alert Updated Successfully'); return redirect('getalert')->with('success', 'Alert Updated Successfully');
} else {
/* redirect to Index page with Fails Message */
return redirect('getalert')->with('fails', 'Alert can not Updated');
}
} catch (Exception $e) { } catch (Exception $e) {
/* redirect to Index page with Fails Message */ /* redirect to Index page with Fails Message */
return redirect('getalert')->with('fails', 'Alert can not Updated'); return redirect('getalert')->with('fails', 'Alert can not Updated'.'<li>'.$e->errorInfo[2].'</li>');
} }
} }

View File

@@ -1,11 +1,19 @@
<?php namespace App\Http\Controllers\Admin\helpdesk; <?php namespace App\Http\Controllers\Admin\helpdesk;
// controllers // controllers
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
// requests // requests
use App\Http\Requests\helpdesk\SlaRequest; use App\Http\Requests\helpdesk\SlaRequest;
use App\Http\Requests\helpdesk\SlaUpdate; use App\Http\Requests\helpdesk\SlaUpdate;
// models // models
use App\Model\helpdesk\Manage\Sla_plan; use App\Model\helpdesk\Manage\Sla_plan;
use App\Model\helpdesk\Settings\Ticket;
//classes
use DB;
use Exception;
/** /**
* SlaController * SlaController
@@ -37,7 +45,7 @@ class SlaController extends Controller {
/* Listing the values From Sla_plan Table */ /* Listing the values From Sla_plan Table */
return view('themes.default1.admin.helpdesk.manage.sla.index', compact('slas')); return view('themes.default1.admin.helpdesk.manage.sla.index', compact('slas'));
} catch (Exception $e) { } catch (Exception $e) {
return view('404'); return redirect()->back()->with('fails',$e->errorInfo[2]);
} }
} }
@@ -50,7 +58,7 @@ class SlaController extends Controller {
/* Direct to Create Page */ /* Direct to Create Page */
return view('themes.default1.admin.helpdesk.manage.sla.create'); return view('themes.default1.admin.helpdesk.manage.sla.create');
} catch (Exception $e) { } catch (Exception $e) {
return view('404'); return redirect()->back()->with('fails',$e->errorInfo[2]);
} }
} }
@@ -64,29 +72,15 @@ class SlaController extends Controller {
try { try {
/* Fill the request values to Sla_plan Table */ /* Fill the request values to Sla_plan Table */
/* Check whether function success or not */ /* Check whether function success or not */
if ($sla->fill($request->input())->save() == true) { $sla->fill($request->input())->save();
/* redirect to Index page with Success Message */ /* redirect to Index page with Success Message */
return redirect('sla')->with('success', 'SLA Plan Created Successfully'); return redirect('sla')->with('success', 'SLA Plan Created Successfully');
} else {
/* redirect to Index page with Fails Message */
return redirect('sla')->with('fails', 'SLA Plan can not Create');
}
} catch (Exception $e) { } catch (Exception $e) {
/* redirect to Index page with Fails Message */ /* redirect to Index page with Fails Message */
return redirect('sla')->with('fails', 'SLA Plan can not Create'); return redirect('sla')->with('fails', 'SLA Plan can not Create'.'<li>'.$e->errorInfo[2].'</li>');
} }
} }
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($id) {
//
}
/** /**
* Show the form for editing the specified resource. * Show the form for editing the specified resource.
* @param type int $id * @param type int $id
@@ -100,7 +94,7 @@ class SlaController extends Controller {
$slas->get(); $slas->get();
return view('themes.default1.admin.helpdesk.manage.sla.edit', compact('slas')); return view('themes.default1.admin.helpdesk.manage.sla.edit', compact('slas'));
} catch (Exception $e) { } catch (Exception $e) {
return view('404'); return redirect()->back()->with('fails',$e->errorInfo[2]);
} }
} }
@@ -121,16 +115,12 @@ class SlaController extends Controller {
/* Update ticket_overdue checkox field */ /* Update ticket_overdue checkox field */
$slas->ticket_overdue = $request->input('ticket_overdue'); $slas->ticket_overdue = $request->input('ticket_overdue');
/* Check whether function success or not */ /* Check whether function success or not */
if ($slas->save() == true) { $slas->save();
/* redirect to Index page with Success Message */ /* redirect to Index page with Success Message */
return redirect('sla')->with('success', 'SLA Plan Updated Successfully'); return redirect('sla')->with('success', 'SLA Plan Updated Successfully');
} else {
/* redirect to Index page with Fails Message */
return redirect('sla')->with('fails', 'SLA Plan can not Update');
}
} catch (Exception $e) { } catch (Exception $e) {
/* redirect to Index page with Fails Message */ /* redirect to Index page with Fails Message */
return redirect('sla')->with('fails', 'SLA Plan can not Update'); return redirect('sla')->with('fails', 'SLA Plan can not Update'.'<li>'.$e->errorInfo[2].'</li>');
} }
} }
@@ -141,20 +131,55 @@ class SlaController extends Controller {
* @return type Response * @return type Response
*/ */
public function destroy($id, Sla_plan $sla) { public function destroy($id, Sla_plan $sla) {
try { $default_sla = Ticket::where('id','=','1')->first();
if($default_sla->sla == $id) {
return redirect('departments')->with('fails', 'You cannot delete default department');
} else {
$tickets = DB::table('tickets')->where('sla','=',$id)->update(['sla' => $default_sla->sla]);
if($tickets > 0) {
if($tickets > 1) {
$text_tickets = "Tickets";
} else {
$text_tickets = "Ticket";
}
$ticket = '<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){
$text_dept = "Emails";
} else {
$text_dept = "Email";
}
$dept = '<li>Associated department have been moved to default SLA</li>';
} else {
$dept = "";
}
$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";
}
$topic = '<li>Associated Help Topic have been moved to default SLA</li>';
} else {
$topic = "";
}
$message = $ticket.$dept.$topic;
/* Delete a perticular field from the database by delete() using Id */ /* Delete a perticular field from the database by delete() using Id */
$slas = $sla->whereId($id)->first(); $slas = $sla->whereId($id)->first();
/* Check whether function success or not */ /* Check whether function success or not */
if ($slas->delete() == true) { try{
$slas->delete();
/* redirect to Index page with Success Message */ /* redirect to Index page with Success Message */
return redirect('sla')->with('success', 'SLA Plan Deleted Successfully'); return redirect('sla')->with('success', 'SLA Plan Deleted Successfully'.$message);
} else { } catch (Exception $e) {
/* redirect to Index page with Fails Message */ /* redirect to Index page with Fails Message */
return redirect('sla')->with('fails', 'SLA Plan can not Delete'); return redirect('sla')->with('fails', 'SLA Plan can not Delete'.'<li>'.$e->errorInfo[2].'</li>');
} }
} catch (Exception $e) {
/* redirect to Index page with Fails Message */
return redirect('sla')->with('fails', 'SLA Plan can not Delete');
} }
} }

View File

@@ -1,14 +1,21 @@
<?php namespace App\Http\Controllers\Admin\helpdesk; <?php namespace App\Http\Controllers\Admin\helpdesk;
// controllers // controllers
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
// requests // requests
use App\Http\Requests\helpdesk\TeamRequest; use App\Http\Requests\helpdesk\TeamRequest;
use App\Http\Requests\helpdesk\TeamUpdate; use App\Http\Requests\helpdesk\TeamUpdate;
// models // models
use App\Model\helpdesk\Agent\Assign_team_agent; use App\Model\helpdesk\Agent\Assign_team_agent;
use App\Model\helpdesk\Agent\Teams; use App\Model\helpdesk\Agent\Teams;
use App\User; use App\User;
// classes
use DB;
use Exception;
/** /**
* TeamController * TeamController
* *
@@ -41,7 +48,7 @@ class TeamController extends Controller {
$assign_team_agent = $assign_team_agent->get(); $assign_team_agent = $assign_team_agent->get();
return view('themes.default1.admin.helpdesk.agent.teams.index', compact('assign_team_agent', 'teams')); return view('themes.default1.admin.helpdesk.agent.teams.index', compact('assign_team_agent', 'teams'));
} catch (Exception $e) { } catch (Exception $e) {
return view('404'); return redirect()->back()->with('fails',$e->errorInfo[2]);
} }
} }
@@ -55,7 +62,7 @@ class TeamController extends Controller {
$user = $user->get(); $user = $user->get();
return view('themes.default1.admin.helpdesk.agent.teams.create', compact('user')); return view('themes.default1.admin.helpdesk.agent.teams.create', compact('user'));
} catch (Exception $e) { } catch (Exception $e) {
return view('404'); return redirect()->back()->with('fails',$e->errorInfo[2]);
} }
} }
@@ -66,31 +73,24 @@ class TeamController extends Controller {
* @return type Response * @return type Response
*/ */
public function store(Teams $team, TeamRequest $request) { public function store(Teams $team, TeamRequest $request) {
if($request->team_lead){
$team_lead = $request->team_lead;
} else {
$team_lead = null;
}
$team->team_lead = $team_lead;
try { try {
/* Check whether function success or not */ /* Check whether function success or not */
if ($team->fill($request->input())->save() == true) { $team->fill($request->except('team_lead'))->save();
/* redirect to Index page with Success Message */ /* redirect to Index page with Success Message */
return redirect('teams')->with('success', 'Teams Created Successfully'); return redirect('teams')->with('success', 'Teams Created Successfully');
} else {
/* redirect to Index page with Fails Message */
return redirect('teams')->with('fails', 'Teams can not Create');
}
} catch (Exception $e) { } catch (Exception $e) {
/* redirect to Index page with Fails Message */ /* redirect to Index page with Fails Message */
return redirect('teams')->with('fails', 'Teams can not Create'); return redirect('teams')->with('fails', 'Teams can not Create'.'<li>'.$e->errorInfo[2].'</li>');
} }
} }
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($id) {
//
}
/** /**
* Show the form for editing the specified resource. * Show the form for editing the specified resource.
* @param type $id * @param type $id
@@ -107,7 +107,7 @@ class TeamController extends Controller {
$agent_id = $agent_team->lists('agent_id', 'agent_id'); $agent_id = $agent_team->lists('agent_id', 'agent_id');
return view('themes.default1.admin.helpdesk.agent.teams.edit', compact('agent_id', 'user', 'teams', 'allagents')); return view('themes.default1.admin.helpdesk.agent.teams.edit', compact('agent_id', 'user', 'teams', 'allagents'));
} catch (Exception $e) { } catch (Exception $e) {
return view('404'); return redirect()->back()->with('fails',$e->errorInfo[2]);
} }
} }
@@ -119,24 +119,29 @@ class TeamController extends Controller {
* @return type Response * @return type Response
*/ */
public function update($id, Teams $team, TeamUpdate $request) { public function update($id, Teams $team, TeamUpdate $request) {
try {
$teams = $team->whereId($id)->first(); $teams = $team->whereId($id)->first();
//updating check box //updating check box
if($request->team_lead){
$team_lead = $request->team_lead;
} else {
$team_lead = null;
}
$teams->team_lead = $team_lead;
$teams->save();
$alert = $request->input('assign_alert'); $alert = $request->input('assign_alert');
$teams->assign_alert = $alert; $teams->assign_alert = $alert;
$teams->save(); //saving check box $teams->save(); //saving check box
//updating whole field //updating whole field
/* Check whether function success or not */ /* Check whether function success or not */
if ($teams->fill($request->input())->save() == true) { try {
/* redirect to Index page with Success Message */ $teams->fill($request->except('team_lead'))->save();
return redirect('teams')->with('success', 'Teams Updated Successfully'); /* redirect to Index page with Success Message */
} else { return redirect('teams')->with('success', 'Teams Updated Successfully');
/* redirect to Index page with Fails Message */
return redirect('teams')->with('fails', 'Teams can not Update');
}
} catch (Exception $e) { } catch (Exception $e) {
/* redirect to Index page with Fails Message */ /* redirect to Index page with Fails Message */
return redirect('teams')->with('fails', 'Teams can not Update'); return redirect('teams')->with('fails', 'Teams can not Update'.'<li>'.$e->errorInfo[2].'</li>');
} }
} }
@@ -151,17 +156,14 @@ class TeamController extends Controller {
try { try {
$assign_team_agent->where('team_id', $id)->delete(); $assign_team_agent->where('team_id', $id)->delete();
$teams = $team->whereId($id)->first(); $teams = $team->whereId($id)->first();
$tickets = DB::table('tickets')->where('team_id','=',$id)->update(['team_id' => null]);
/* Check whether function success or not */ /* Check whether function success or not */
if ($teams->delete() == true) { $teams->delete();
/* redirect to Index page with Success Message */ /* redirect to Index page with Success Message */
return redirect('teams')->with('success', 'Teams Deleted Successfully'); return redirect('teams')->with('success', 'Teams Deleted Successfully');
} else {
/* redirect to Index page with Fails Message */
return redirect('teams')->with('fails', 'Teams can not Delete');
}
} catch (Exception $e) { } catch (Exception $e) {
/* redirect to Index page with Fails Message */ /* redirect to Index page with Fails Message */
return redirect('teams')->with('fails', 'Teams can not Delete'); return redirect('teams')->with('fails', 'Teams can not Delete'.'<li>'.$e->errorInfo[2].'</li>');
} }
} }
} }

View File

@@ -12,6 +12,7 @@ use App\Model\helpdesk\Utility\Languages;
// classes // classes
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Mail; use Mail;
use Exception;
/** /**
* TemplateController * TemplateController

View File

@@ -1,10 +1,14 @@
<?php namespace App\Http\Controllers\Admin\helpdesk; <?php namespace App\Http\Controllers\Admin\helpdesk;
// controllers // controllers
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
// models // models
use App\Model\helpdesk\Priority; use App\Model\helpdesk\Priority;
use App\Model\helpdesk\Ticket_thread; use App\Model\helpdesk\Ticket_thread;
// classes
use Exception;
/** /**
* ThreadController * ThreadController
* *

View File

@@ -1,17 +1,25 @@
<?php namespace App\Http\Controllers\Agent\helpdesk; <?php namespace App\Http\Controllers\Agent\helpdesk;
// controllers // controllers
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
// requests // requests
use App\Http\Requests\helpdesk\CannedRequest; use App\Http\Requests\helpdesk\CannedRequest;
use App\Http\Requests\helpdesk\CannedUpdateRequest; use App\Http\Requests\helpdesk\CannedUpdateRequest;
// model // model
use App\Model\helpdesk\Agent_panel\Canned; use App\Model\helpdesk\Agent_panel\Canned;
use App\User; use App\User;
// classes
use Exception;
/** /**
* UserController * CannedController
*
* This controller is for all the functionalities of Canned response for Agents in the Agent Panel
* *
* @package Controllers * @package Controllers
* @subpackage Controller * @subpackage Controller
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
@@ -23,108 +31,122 @@ class CannedController extends Controller {
* 1. authentication * 1. authentication
* 2. user roles * 2. user roles
* 3. roles must be agent * 3. roles must be agent
*
* @return void * @return void
*/ */
public function __construct() { public function __construct() {
// checking authentication
$this->middleware('auth'); $this->middleware('auth');
// checking if role is agent
$this->middleware('role.agent'); $this->middleware('role.agent');
// $this->middleware('roles');
} }
/** /**
* Display a listing of the resource. * Display a listing of the Canned Responses.
* @param type User $user * @return type View
* @return type Response
*/ */
public function index() { public function index() {
return view('themes.default1.agent.helpdesk.canned.index'); return view('themes.default1.agent.helpdesk.canned.index');
} }
/** /**
* Show the form for creating a new resource. * Show the form for creating a new Canned Response
* @return type Response * @return type View
*/ */
public function create() { public function create() {
return view('themes.default1.agent.helpdesk.canned.create'); return view('themes.default1.agent.helpdesk.canned.create');
} }
/** /**
* Store a newly created resource in storage. * Store a newly created Canned Response.
* @param type User $user * @param type CannedRequest $request
* @param type Sys_userRequest $request * @param type Canned $canned
* @return type Response * @return type Redirect
*/ */
public function store(CannedRequest $request, Canned $canned) { public function store(CannedRequest $request, Canned $canned) {
// fetching all the requested inputs
$canned->user_id = \Auth::user()->id; $canned->user_id = \Auth::user()->id;
$canned->title = $request->input('title'); $canned->title = $request->input('title');
$canned->message = $request->input('message'); $canned->message = $request->input('message');
$canned->save(); try {
return redirect()->route('canned.list')->with('success','Added Successfully'); // saving inputs
$canned->save();
return redirect()->route('canned.list')->with('success','Added Successfully');
} catch (Exception $e) {
return redirect()->route('canned.list')->with('fails',$e->errorInfo[2]);
}
} }
/** /**
* Show the form for editing the specified resource. * Show the form for editing the Canned Response.
* @param type int $id * @param type $id
* @param type User $user * @param type Canned $canned
* @return type Response * @return type View
*/ */
public function edit($id, Canned $canned) { public function edit($id, Canned $canned) {
// fetching requested canned response
$canned = $canned->where('user_id', '=', \Auth::user()->id)->where('id','=',$id)->first(); $canned = $canned->where('user_id', '=', \Auth::user()->id)->where('id','=',$id)->first();
return view('themes.default1.agent.helpdesk.canned.edit',compact('canned')); return view('themes.default1.agent.helpdesk.canned.edit',compact('canned'));
} }
/** /**
* Update the specified resource in storage. * Update the Canned Response in database.
* @param type int $id * @param type $id
* @param type User $user * @param type CannedUpdateRequest $request
* @param type Sys_userUpdate $request * @param type Canned $canned
* @return type Response * @return type Redirect
*/ */
public function update($id, CannedUpdateRequest $request, Canned $canned) { 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->user_id = \Auth::user()->id;
$canned->title = $request->input('title'); $canned->title = $request->input('title');
$canned->message = $request->input('message'); $canned->message = $request->input('message');
$canned->save(); try {
// saving inputs
return redirect()->route('canned.list')->with('success','Updated Successfully'); $canned->save();
return redirect()->route('canned.list')->with('success','Updated Successfully');
} catch (Exception $e) {
return redirect()->route('canned.list')->with('fails',$e->errorInfo[2]);
}
} }
/** /**
* Remove the specified resource from storage. * Delete the Canned Response from storage.
* @param type int $id * @param type $id
* @param type User $user * @param type Canned $canned
* @return type Response * @return type Redirect
*/ */
public function destroy($id, Canned $canned) { public function destroy($id, Canned $canned) {
/* select the field where id = $id(request Id) */ /* select the field where id = $id(request Id) */
$canned = $canned->whereId($id)->first(); $canned = $canned->whereId($id)->first();
/* delete the selected field */ /* delete the selected field */
/* Check whether function success or not */ /* Check whether function success or not */
if ($canned->delete() == true) { try {
/* redirect to Index page with Success Message */ $canned->delete();
return redirect()->route('canned.list')->with('success', 'User Deleted Successfully'); /* redirect to Index page with Success Message */
} else { return redirect()->route('canned.list')->with('success', 'User Deleted Successfully');
/* redirect to Index page with Fails Message */ } catch (Exception $e) {
return redirect()->route('canned.list')->with('fails', 'User can not Delete'); /* redirect to Index page with Fails Message */
} return redirect()->route('canned.list')->with('fails', $e->errorInfo[2]);
return view('themes.default1.agent.helpdesk.canned.destroy'); }
} }
/** /**
* get canned * Fetch Canned Response in the ticket detail page.
* @param type $id * @param type $id
* @return type json * @return type json
*/ */
public function get_canned($id) { 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; $msg = $canned->message;
} else { } else {
$msg = ""; $msg = "";
} }
// returning the canned response in JSON format
return \Response::json($msg); return \Response::json($msg);
} }

View File

@@ -1,19 +1,24 @@
<?php namespace App\Http\Controllers\Agent\helpdesk; <?php namespace App\Http\Controllers\Agent\helpdesk;
// controllers // controllers
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
// models // models
use App\Model\helpdesk\Settings\Company; use App\Model\helpdesk\Settings\Company;
use App\Model\helpdesk\Ticket\Ticket_Collaborator; use App\Model\helpdesk\Ticket\Ticket_Collaborator;
use App\Model\helpdesk\Email\Emails; use App\Model\helpdesk\Email\Emails;
use App\User; use App\User;
// classes // classes
use DB; use DB;
use View; use View;
use Auth; use Auth;
use Exception;
/** /**
* DashboardController * DashboardController
* * This controlleris used to fetch dashboard in the agent panel
*
* @package Controllers * @package Controllers
* @subpackage Controller * @subpackage Controller
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
@@ -29,61 +34,76 @@ class DashboardController extends Controller {
* @return void * @return void
*/ */
public function __construct() { public function __construct() {
// checking for authentication
$this->middleware('auth'); $this->middleware('auth');
// checking if the role is agent
$this->middleware('role.agent'); $this->middleware('role.agent');
} }
/** /**
* Show the form for creating a new resource. * Get the dashboard page
* @return type Response * @return type view
*/ */
public function index() { public function index() {
try { // if(Auth::user()->role == "user"){
if(Auth::user()->role == "user"){ // return \Redirect::route('home');
return \Redirect::route('home'); // }
} try {
return View::make('themes.default1.agent.helpdesk.dashboard.dashboard'); return View::make('themes.default1.agent.helpdesk.dashboard.dashboard');
} catch (Exception $e) { } catch (Exception $e) {
return view('404'); return View::make('themes.default1.agent.helpdesk.dashboard.dashboard');
} }
} }
/** /**
* ChartData * Fetching dashboard graph data to implement graph
* @return type * @return type Json
*/ */
public function ChartData() 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.']'; // $date11 = strtotime(\Input::get('start_date'));
// $date12 = strtotime(\Input::get('end_date'));
// if($date11 && $date12){
// $date2 = $date12;
// $date1 = $date11;
// } else {
// generating current date
$date2 = strtotime(Date('Y-m-d'));
$date3 = Date('Y-m-d');
$format = 'Y-m-d';
// generating a date range of 1 month
$date1 = strtotime(Date($format,strtotime('-1 month'. $date3)));
// }
$return = "";
$last = "";
// fetching dashboard data for each day on a 1 month fixed range
// this range can also be fetched on a requested rannge of date
for ( $i = $date1; $i <= $date2; $i = $i + 86400 ) {
$thisDate = date( 'Y-m-d', $i );
// created tickets
$created = \DB::table('tickets')->select('created_at')->where('created_at','LIKE','%'.$thisDate.'%')->count();
// closed tickets
$closed = \DB::table('tickets')->select('closed_at')->where('closed_at','LIKE','%'.$thisDate.'%')->count();
// reopened tickets
$reopened = \DB::table('tickets')->select('reopened_at')->where('reopened_at','LIKE','%'.$thisDate.'%')->count();
// storing in array format
$value = ['date' => $thisDate, 'open' => $created, 'closed' => $closed, 'reopened' => $reopened];
$array = array_map('htmlentities',$value);
// encoding the values in jsom format
$json = html_entity_decode(json_encode($array));
$return .= $json.',';
}
// combining all the values in a single variable and returning that variable in Json.
$last = rtrim($return,',');
return '['.$last.']';
// $ticketlist = DB::table('tickets') // $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'), // ->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'),
// DB::raw('count(*) as totaltickets')) // DB::raw('count(*) as totaltickets'))
// ->groupBy('month') // ->groupBy('month')
// ->orderBy('month', 'asc') // ->orderBy('month', 'asc')
// ->get(); // ->get();
// return $ticketlist; // return $ticketlist;
} }

View File

@@ -2,6 +2,7 @@
// controllers // controllers
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Http\Controllers\Agent\helpdesk\TicketController; use App\Http\Controllers\Agent\helpdesk\TicketController;
// models // models
use App\User; use App\User;
use App\Model\helpdesk\Email\Emails; use App\Model\helpdesk\Email\Emails;
@@ -9,6 +10,12 @@ use App\Model\helpdesk\Settings\Email;
use App\Model\helpdesk\Ticket\Ticket_attachments; use App\Model\helpdesk\Ticket\Ticket_attachments;
use App\Model\helpdesk\Ticket\Ticket_Thread; use App\Model\helpdesk\Ticket\Ticket_Thread;
use App\Model\helpdesk\Settings\System; use App\Model\helpdesk\Settings\System;
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 // classes
use PhpImap\Mailbox as ImapMailbox; use PhpImap\Mailbox as ImapMailbox;
use PhpImap\IncomingMail; use PhpImap\IncomingMail;
@@ -20,6 +27,7 @@ use Crypt;
use Schedule; use Schedule;
use File; use File;
use Artisan; use Artisan;
use Exception;
/** /**
* MailController * MailController
@@ -45,53 +53,55 @@ class MailController extends Controller {
*/ */
public function readmails(Emails $emails, Email $settings_email, System $system) public function readmails(Emails $emails, Email $settings_email, System $system)
{ {
$path_url = $system->first()->url; // $path_url = $system->first()->url;
if($settings_email->first()->email_fetching == 1) if($settings_email->first()->email_fetching == 1)
{ {
if($settings_email->first()->all_emails == 1) if($settings_email->first()->all_emails == 1)
{ {
$helptopic = $this->TicketController->default_helptopic(); // $helptopic = $this->TicketController->default_helptopic();
$sla = $this->TicketController->default_sla(); // $sla = $this->TicketController->default_sla();
$email = $emails->get(); $email = $emails->get();
foreach($email as $e_mail) foreach($email as $e_mail)
{ {
$helptopic = $e_mail->help_topic;
$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; $host = $e_mail->fetching_host;
$port = $e_mail->fetching_port; $port = $e_mail->fetching_port;
$protocol = $e_mail->mailbox_protocol; $protocol = $e_mail->mailbox_protocol;
$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); $password = Crypt::decrypt($e_mail->password);
$mailbox = new ImapMailbox($imap_config, $e_mail->user_name, $password, __DIR__); $mailbox = new ImapMailbox($imap_config, $e_mail->email_address, $password, __DIR__);
$mails = array(); $mails = array();
$mailsIds = $mailbox->searchMailBox('SINCE '. date('d-M-Y', strtotime("-1 day"))); $mailsIds = $mailbox->searchMailBox('SINCE '. date('d-M-Y', strtotime("-1 day")));
if(!$mailsIds) { if(!$mailsIds) {
die('Mailbox is empty'); die('Mailbox is empty');
} }
// dd($mailsIds);
foreach($mailsIds as $mailId) { foreach($mailsIds as $mailId) {
$overview = $mailbox->get_overview($mailId); $overview = $mailbox->get_overview($mailId);
$var = $overview[0]->seen ? 'read' : 'unread'; $var = $overview[0]->seen ? 'read' : 'unread';
if ($var == 'unread') { if ($var == 'unread') {
$mail = $mailbox->getMail($mailId); $mail = $mailbox->getMail($mailId);
if($settings_email->email_collaborator == 1) { if($settings_email->first()->email_collaborator == 1) {
$collaborator = $mail->cc; $collaborator = $mail->cc;
} else { } else {
$collaborator = null; $collaborator = null;
} }
$body = $mail->textHtml; $body = $mail->textHtml;
// dd($mailId);
if($body == null) { if($body == null) {
$body = $mailbox->backup_getmail($mailId); $body = $mailbox->backup_getmail($mailId);
$body = str_replace('\r\n', '<br/>', $body); $body = str_replace('\r\n', '<br/>', $body);
// var_dump($body); // var_dump($body);
} }
// dd($body);
$date = $mail->date; $date = $mail->date;
$datetime = $overview[0]->date; $datetime = $overview[0]->date;
$date_time = explode(" ", $datetime); $date_time = explode(" ", $datetime);
$date = $date_time[1] . "-" . $date_time[2] . "-" . $date_time[3] . " " . $date_time[4]; $date = $date_time[1] . "-" . $date_time[2] . "-" . $date_time[3] . " " . $date_time[4];
$date = date('Y-m-d H:i:s', strtotime($date)); $date = date('Y-m-d H:i:s', strtotime($date));
// dd($date);
if(isset($mail->subject)){ if(isset($mail->subject)){
$subject = $mail->subject; $subject = $mail->subject;
@@ -99,27 +109,36 @@ class MailController extends Controller {
$subject = "No Subject"; $subject = "No Subject";
} }
// dd($subject);
$fromname = $mail->fromName; $fromname = $mail->fromName;
$fromaddress = $mail->fromAddress; $fromaddress = $mail->fromAddress;
$source = "2"; $ticket_source = Ticket_source::where('name','=','email')->first();
$source = $ticket_source->id;
$phone = ""; $phone = "";
$priority = '1'; $priority = $get_helptopic->priority;
$assign = ""; // Ticket_Priority::where('')
$assign = $get_helptopic->auto_assign;
$form_data = null; $form_data = null;
if ($this->TicketController->create_user($fromaddress, $fromname, $subject, $body, $phone, $helptopic, $sla, $priority, $source, $collaborator, $dept, $assign, $form_data) == true) { $result = $this->TicketController->create_user($fromaddress, $fromname, $subject, $body, $phone, $helptopic, $sla, $priority, $source, $collaborator, $dept, $assign, $form_data);
$thread_id = Ticket_Thread::whereRaw('id = (select max(`id`) from ticket_thread)')->first(); // dd($result);
$thread_id = $thread_id->id; 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');
// $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) {
// dd($attachment);
$support = "support"; $support = "support";
// echo $_SERVER['DOCUMENT_ROOT']; // echo $_SERVER['DOCUMENT_ROOT'];
$dir_img_paths = __DIR__; $dir_img_paths = __DIR__;
$dir_img_path = explode('/code', $dir_img_paths); $dir_img_path = explode('/code', $dir_img_paths);
$filepath = explode('../../../../../../public',$attachment->filePath); // dd($attachment->filePath);
$filepath = explode('../../../../../public',$attachment->filePath);
// var_dump($attachment->filePath);
// dd($filepath); // dd($filepath);
// $path = $dir_img_path[0]."/public/".$filepath[1]; // $path = $dir_img_path[0]."/code/public/".$filepath[1];
$path = public_path().'/'.$filepath[1]; $path = public_path().$filepath[1];
// dd($path); // dd($path);
$filesize = filesize($path); $filesize = filesize($path);
$file_data = file_get_contents($path); $file_data = file_get_contents($path);

View File

@@ -2,6 +2,7 @@
// controllers // controllers
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
// Model // Model
use App\User; use App\User;
use App\Model\helpdesk\Settings\Company; use App\Model\helpdesk\Settings\Company;
@@ -10,8 +11,12 @@ use App\Model\helpdesk\Agent\Department;
use App\Model\helpdesk\Utility\Log_notification; use App\Model\helpdesk\Utility\Log_notification;
use App\Model\helpdesk\settings\Email; use App\Model\helpdesk\settings\Email;
// classes
use Exception;
/** /**
* UserController * NotificationController
* This controller is used to send daily notifications
* *
* @package Controllers * @package Controllers
* @subpackage Controller * @subpackage Controller
@@ -21,20 +26,27 @@ class NotificationController extends Controller {
/** /**
* This function is for sending daily report/notification about the system * This function is for sending daily report/notification about the system
* @return mail
**/ **/
public function send_notification() { 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(); $notification = Log_notification::where('log','=','NOT-1')->orderBy('id','DESC')->first();
$date = explode(" " , $notification->created_at); $date = explode(" " , $notification->created_at);
if(Date('Y-m-d') == $date[0]){ if(Date('Y-m-d') == $date[0]){
} else { } else {
// creating a daily notification log
Log_notification::create(['log'=>'NOT-1']); Log_notification::create(['log'=>'NOT-1']);
$company = $this->company(); $company = $this->company();
// Send notification details to admin
$this->send_notification_to_admin($company); $this->send_notification_to_admin($company);
// Send notification details to team lead
$this->send_notification_to_team_lead($company); $this->send_notification_to_team_lead($company);
// Send notification details to manager of a department
$this->send_notification_to_manager($company); $this->send_notification_to_manager($company);
// Send notification details to all the agents
$this->send_notification_to_agent($company); $this->send_notification_to_agent($company);
} }
} }
@@ -49,6 +61,7 @@ class NotificationController extends Controller {
// get all admin users // get all admin users
$users = User::where('role','=','admin')->get(); $users = User::where('role','=','admin')->get();
foreach ($users as $user) { foreach ($users as $user) {
// Send notification details to admin
$email = $user->email; $email = $user->email;
$user_name = $user->first_name . " " . $user->last_name; $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) {
@@ -62,12 +75,14 @@ class NotificationController extends Controller {
* @return mail * @return mail
**/ **/
public function send_notification_to_manager($company) { public function send_notification_to_manager($company) {
// get all department managers
$depts = Department::all(); $depts = Department::all();
foreach ($depts as $dept) { foreach ($depts as $dept) {
if(isset($dept->manager)) { if(isset($dept->manager)) {
$dept_name = $dept->name; $dept_name = $dept->name;
$users = User::where('id','=',$dept->manager)->get(); $users = User::where('id','=',$dept->manager)->get();
foreach ($users as $user) { foreach ($users as $user) {
// Send notification details to manager of a department
$email = $user->email; $email = $user->email;
$user_name = $user->first_name . " " . $user->last_name; $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) { \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) {
@@ -83,12 +98,14 @@ class NotificationController extends Controller {
* @return mail * @return mail
**/ **/
public function send_notification_to_team_lead($company) { public function send_notification_to_team_lead($company) {
// get all Team leads
$teams = Teams::all(); $teams = Teams::all();
foreach ($teams as $team) { foreach ($teams as $team) {
if(isset($team->team_lead)) { if(isset($team->team_lead)) {
$team_name = $team->name; $team_name = $team->name;
$users = User::where('id','=',$team->team_lead)->get(); $users = User::where('id','=',$team->team_lead)->get();
foreach ($users as $user) { foreach ($users as $user) {
// Send notification details to team lead
$email = $user->email; $email = $user->email;
$user_name = $user->first_name . " " . $user->last_name; $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) { \Mail::send('emails.notifications.lead', ['company' => $company, 'name'=>$user_name,'team_id' => $team->id], function ($message)use ($email, $user_name, $company, $team_name) {
@@ -107,6 +124,7 @@ class NotificationController extends Controller {
// get all agents users // get all agents users
$users = User::where('role','=','agent')->get(); $users = User::where('role','=','agent')->get();
foreach ($users as $user) { foreach ($users as $user) {
// Send notification details to all the agents
$email = $user->email; $email = $user->email;
$user_name = $user->first_name . " " . $user->last_name; $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) {
@@ -116,12 +134,13 @@ class NotificationController extends Controller {
} }
/** /**
* company * Fetching company name
* @return type * @return type variable
*/ */
public function company() 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"; $company = "Support Center";
}else{ }else{
@@ -130,12 +149,13 @@ class NotificationController extends Controller {
return $company; return $company;
} }
public function test(){ // // testing
$email = "sujit.prasad@ladybirdweb.com"; // public function test(){
$user_name = "sujit prasad"; // $email = "sujit.prasad@ladybirdweb.com";
\Mail::send('emails.notifications.test', ['user_id' => 1], function ($message) use($email, $user_name) { // $user_name = "sujit prasad";
$message->to($email, $user_name)->subject('testing reporting'); // \Mail::send('emails.notifications.test', ['user_id' => 1], function ($message) use($email, $user_name) {
}); // $message->to($email, $user_name)->subject('testing reporting');
} // });
// }
} }

View File

@@ -1,18 +1,25 @@
<?php namespace App\Http\Controllers\Agent\helpdesk; <?php namespace App\Http\Controllers\Agent\helpdesk;
// controllers // controllers
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
// requests // requests
use App\Http\Requests\helpdesk\OrganizationRequest; use App\Http\Requests\helpdesk\OrganizationRequest;
/* include organization model */ /* include organization model */
use App\Http\Requests\helpdesk\OrganizationUpdate; use App\Http\Requests\helpdesk\OrganizationUpdate;
// models // models
/* Define OrganizationRequest to validate the create form */ /* Define OrganizationRequest to validate the create form */
use App\Model\helpdesk\Agent_panel\Organization; use App\Model\helpdesk\Agent_panel\Organization;
/* Define OrganizationUpdate to validate the create form */ /* Define OrganizationUpdate to validate the create form */
use App\Model\helpdesk\Agent_panel\User_org_head; use App\Model\helpdesk\Agent_panel\User_org;
// classes
use Exception;
/** /**
* OrganizationController * OrganizationController
* This controller is used to CRUD organization detail.
* *
* @package Controllers * @package Controllers
* @subpackage Controller * @subpackage Controller
@@ -26,13 +33,13 @@ class OrganizationController extends Controller {
* 1. authentication * 1. authentication
* 2. user roles * 2. user roles
* 3. roles must be agent * 3. roles must be agent
*
* @return void * @return void
*/ */
public function __construct() { public function __construct() {
// checking for authentication
$this->middleware('auth'); $this->middleware('auth');
// checking if the role is agent
$this->middleware('role.agent'); $this->middleware('role.agent');
// $this->middleware('roles');
} }
/** /**
@@ -54,47 +61,54 @@ class OrganizationController extends Controller {
* @return datatable * @return datatable
*/ */
public function org_list() { public function org_list() {
// chumper datable package call to display Advance datatable
return \Datatable::collection(Organization::all()) return \Datatable::collection(Organization::all())
/* searchable name */
->searchColumns('name') ->searchColumns('name')
/* order by name and website */
->orderColumns('name', 'website') ->orderColumns('name', 'website')
/* column name */
->addColumn('name', function ($model) { ->addColumn('name', function ($model) {
return $model->name; return $model->name;
}) })
/* column website */
->addColumn('website', function ($model) { ->addColumn('website', function ($model) {
$website = $model->website; $website = $model->website;
return $website; return $website;
}) })
/* column phone number */
->addColumn('phone', function ($model) { ->addColumn('phone', function ($model) {
$phone = $model->phone; $phone = $model->phone;
return $phone; return $phone;
}) })
/* column action buttons */
->addColumn('Actions', function ($model) { ->addColumn('Actions', function ($model) {
//return '<a href=article/delete/ ' . $model->id . ' class="btn btn-danger btn-flat" onclick="myFunction()">Delete</a>&nbsp;<a href=article/' . $model->id . '/edit class="btn btn-warning btn-flat">Edit</a>&nbsp;<a href=show/' . $model->id . ' class="btn btn-warning btn-flat">View</a>'; // displaying action buttons
//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>&nbsp;<a href=show/' . $model->id . ' class="btn btn-warning btn-flat">View</a>'; // 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>&nbsp;<a href="'.route('organizations.edit', $model->id).'" class="btn btn-warning btn-xs">' . \Lang::get('lang.edit') . '</a>&nbsp;<a href="'.route('organizations.show', $model->id).'" class="btn btn-primary btn-xs">' . \Lang::get('lang.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>&nbsp;<a href="'.route('organizations.edit', $model->id).'" class="btn btn-warning btn-xs">' . \Lang::get('lang.edit') . '</a>&nbsp;<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 fade" id="deletearticle'.$model->id .'">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">Are You Sure ?</h4> <h4 class="modal-title">Are You Sure ?</h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
'.$model->user_name.' '.$model->user_name.'
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">Close</button> <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>
</div><!-- /.modal-content --> </div><!-- /.modal-content -->
</div><!-- /.modal-dialog --> </div><!-- /.modal-dialog -->
</div>'; </div>';
}) })
->make(); ->make();
} }
/** /**
* Show the form for creating a new resource. * Show the form for creating a new organization.
* @return type Response * @return type Response
*/ */
public function create() { public function create() {
@@ -106,10 +120,10 @@ class OrganizationController extends Controller {
} }
/** /**
* Store a newly created resource in storage. * Store a newly created organization in storage.
* @param type Organization $org * @param type Organization $org
* @param type OrganizationRequest $request * @param type OrganizationRequest $request
* @return type Response * @return type Redirect
*/ */
public function store(Organization $org, OrganizationRequest $request) { public function store(Organization $org, OrganizationRequest $request) {
try { try {
@@ -129,11 +143,10 @@ class OrganizationController extends Controller {
} }
/** /**
* Display the specified resource. * Display the specified organization.
*
* @param type $id * @param type $id
* @param type Organization $org * @param type Organization $org
* @return type Response * @return type view
*/ */
public function show($id, Organization $org) { public function show($id, Organization $org) {
try { try {
@@ -142,16 +155,15 @@ class OrganizationController extends Controller {
/* To view page */ /* To view page */
return view('themes.default1.agent.helpdesk.organization.show', compact('orgs')); return view('themes.default1.agent.helpdesk.organization.show', compact('orgs'));
} catch (Exception $e) { } catch (Exception $e) {
return view('404'); return redirect()->back()->with('fails', $e->errorInfo[2]);
} }
} }
/** /**
* Show the form for editing the specified resource. * Show the form for editing the specified organization.
*
* @param type $id * @param type $id
* @param type Organization $org * @param type Organization $org
* @return type Response * @return type view
*/ */
public function edit($id, Organization $org) { public function edit($id, Organization $org) {
try { try {
@@ -165,63 +177,69 @@ class OrganizationController extends Controller {
} }
/** /**
* Update the specified resource in storage. * Update the specified organization in storage.
*
* @param type $id * @param type $id
* @param type Organization $org * @param type Organization $org
* @param type OrganizationUpdate $request * @param type OrganizationUpdate $request
* @return type Response * @return type Redirect
*/ */
public function update($id, Organization $org, OrganizationUpdate $request) { public function update($id, Organization $org, OrganizationUpdate $request) {
try {
/* select the field by id */ /* select the field by id */
$orgs = $org->whereId($id)->first(); $orgs = $org->whereId($id)->first();
/* update the organization table */ /* update the organization table */
/* Check whether function success or not */ /* Check whether function success or not */
if ($orgs->fill($request->input())->save() == true) { try {
/* redirect to Index page with Success Message */ if ($orgs->fill($request->input())->save() == true) {
return redirect('organizations')->with('success', 'Organization Updated Successfully'); /* redirect to Index page with Success Message */
} else { return redirect('organizations')->with('success', 'Organization Updated Successfully');
} else {
/* redirect to Index page with Fails Message */
return redirect('organizations')->with('fails', 'Organization can not Update');
}
} catch (Exception $e) {
/* redirect to Index page with Fails Message */ /* redirect to Index page with Fails Message */
return redirect('organizations')->with('fails', 'Organization can not Update'); return redirect('organizations')->with('fails', $e->errorInfo[2]);
} }
} catch (Exception $e) {
/* redirect to Index page with Fails Message */
return redirect('organizations')->with('fails', 'Organization can not Update');
}
} }
/** /**
* Remove the specified resource from storage. * Delete a specified organization from storage.
* @param type int $id * @param type int $id
* @return type Response * @return type Redirect
*/ */
public function destroy($id, Organization $org) { public function destroy($id, Organization $org, User_org $user_org) {
try {
// User_org
/* select the field by id */ /* select the field by id */
$orgs = $org->whereId($id)->first(); $orgs = $org->whereId($id)->first();
$user_orgs = $user_org->where('org_id','=',$id)->get();
foreach ($user_orgs as $user_org) {
$user_org->delete();
}
/* Delete the field selected from the table */ /* Delete the field selected from the table */
/* Check whether function success or not */ /* Check whether function success or not */
if ($orgs->delete() == true) { try {
$orgs->delete();
/* redirect to Index page with Success Message */ /* redirect to Index page with Success Message */
return redirect('organizations')->with('success', 'Organization Deleted Successfully'); return redirect('organizations')->with('success', 'Organization Deleted Successfully');
} else { } catch (Exception $e) {
/* redirect to Index page with Fails Message */ /* redirect to Index page with Fails Message */
return redirect('organizations')->with('fails', 'Organization can not Delete'); return redirect('organizations')->with('fails', $e->errorInfo[2]);
} }
} catch (Exception $e) {
/* redirect to Index page with Fails Message */
return redirect('organizations')->with('fails', 'Organization can not Delete');
}
} }
/**
* Soring an organization head
* @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'); $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; $org_head->head = $head_user;
// save the user to organization head
$org_head->save(); $org_head->save();
return 1; return 1;
} }

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,7 @@
<?php namespace App\Http\Controllers\Agent\helpdesk; <?php namespace App\Http\Controllers\Agent\helpdesk;
// controllers // controllers
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
// requests // requests
/* Include Sys_user Model */ /* Include Sys_user Model */
use App\Http\Requests\helpdesk\ProfilePassword; use App\Http\Requests\helpdesk\ProfilePassword;
@@ -10,26 +11,22 @@ use App\Http\Requests\helpdesk\ProfileRequest;
use App\Http\Requests\helpdesk\Sys_userRequest; use App\Http\Requests\helpdesk\Sys_userRequest;
/* include guest_note model */ /* include guest_note model */
use App\Http\Requests\helpdesk\Sys_userUpdate; use App\Http\Requests\helpdesk\Sys_userUpdate;
// models // models
use App\Model\helpdesk\Agent_panel\Organization; use App\Model\helpdesk\Agent_panel\Organization;
use App\Model\helpdesk\Agent_panel\User_org; use App\Model\helpdesk\Agent_panel\User_org;
/* include User Model */
/* include Help_topic Model */
/* Profile validator */
/* Profile Password validator */
use App\User; use App\User;
// classes // classes
/* include ticket_thred model */
use Auth; use Auth;
/* include tickets model */
use Hash; use Hash;
/* TicketRequest to validate the ticket response */
/* Validate post check ticket */
use Input; use Input;
use Redirect; use Redirect;
use Exception;
/** /**
* UserController * UserController
* This controller is used to CRUD an User details, and proile management of an agent
* *
* @package Controllers * @package Controllers
* @subpackage Controller * @subpackage Controller
@@ -43,45 +40,50 @@ class UserController extends Controller {
* 1. authentication * 1. authentication
* 2. user roles * 2. user roles
* 3. roles must be agent * 3. roles must be agent
*
* @return void * @return void
*/ */
public function __construct() { public function __construct() {
// checking authentication
$this->middleware('auth'); $this->middleware('auth');
// checking if role is agent
$this->middleware('role.agent'); $this->middleware('role.agent');
// $this->middleware('roles');
} }
/** /**
* Display a listing of the resource. * Display all list of the users.
* @param type User $user * @param type User $user
* @return type Response * @return type view
*/ */
public function index() { public function index() {
try { try {
/* get all values in Sys_user */ /* get all values in Sys_user */
return view('themes.default1.agent.helpdesk.user.index'); return view('themes.default1.agent.helpdesk.user.index');
} catch (Exception $e) { } catch (Exception $e) {
return view('404'); return redirect()->back()->with('fails',$e->errorInfo[2]);
} }
} }
/** /**
* This function is used to display the list of users * This function is used to display the list of users using chumper datatables
* @return datatable * @return datatable
*/ */
public function user_list() { 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') ->searchColumns('user_name')
/* order column username and email */
->orderColumns('user_name', 'email') ->orderColumns('user_name', 'email')
/* column username */
->addColumn('user_name', function ($model) { ->addColumn('user_name', function ($model) {
return $model->user_name; return $model->user_name;
}) })
/* column email */
->addColumn('email', function ($model) { ->addColumn('email', function ($model) {
$email = $model->email; $email = $model->email;
return $email; return $email;
}) })
/* column phone */
->addColumn('phone', function ($model) { ->addColumn('phone', function ($model) {
$phone = ""; $phone = "";
if($model->phone_number) { if($model->phone_number) {
@@ -94,6 +96,7 @@ class UserController extends Controller {
$phone = $phone ."&nbsp;&nbsp;&nbsp;". $mobile; $phone = $phone ."&nbsp;&nbsp;&nbsp;". $mobile;
return $phone; return $phone;
}) })
/* column status */
->addColumn('status', function ($model) { ->addColumn('status', function ($model) {
$status = $model->active; $status = $model->active;
if($status == 1) { if($status == 1) {
@@ -103,55 +106,37 @@ class UserController extends Controller {
} }
return $stat; return $stat;
}) })
/* column last login date */
->addColumn('lastlogin', function ($model) { ->addColumn('lastlogin', function ($model) {
$t = $model->updated_at; $t = $model->updated_at;
return TicketController::usertimezone($t); return TicketController::usertimezone($t);
}) })
/* column actions */
->addColumn('Actions', function ($model) { ->addColumn('Actions', function ($model) {
//return '<a href=article/delete/ ' . $model->id . ' class="btn btn-danger btn-flat" onclick="myFunction()">Delete</a>&nbsp;<a href=article/' . $model->id . '/edit class="btn btn-warning btn-flat">Edit</a>&nbsp;<a href=show/' . $model->id . ' class="btn btn-warning btn-flat">View</a>'; return '<a href="'.route('user.edit', $model->id).'" class="btn btn-warning btn-xs">' . \Lang::get('lang.edit') . '</a>&nbsp; <a href="'.route('user.show', $model->id).'" class="btn btn-primary btn-xs">' . \Lang::get('lang.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>&nbsp;<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>&nbsp;<a href="'.route('user.edit', $model->id).'" class="btn btn-warning btn-xs">' . \Lang::get('lang.edit') . '</a>&nbsp;<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">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">Are You Sure ?</h4>
</div>
<div class="modal-body">
'.$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>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div>';
}) })
->make(); ->make();
} }
/** /**
* Show the form for creating a new resource. * Show the form for creating a new users.
* @return type Response * @return type view
*/ */
public function create() { public function create() {
try { try {
return view('themes.default1.agent.helpdesk.user.create'); return view('themes.default1.agent.helpdesk.user.create');
} catch (Exception $e) { } catch (Exception $e) {
return view('404'); return redirect()->back()->with('fails',$e->errorInfo[2]);
} }
} }
/** /**
* Store a newly created resource in storage. * Store a newly created users in storage.
* @param type User $user * @param type User $user
* @param type Sys_userRequest $request * @param type Sys_userRequest $request
* @return type Response * @return type redirect
*/ */
public function store(User $user, Sys_userRequest $request) { public function store(User $user, Sys_userRequest $request) {
try {
/* insert the input request to sys_user table */ /* insert the input request to sys_user table */
/* Check whether function success or not */ /* Check whether function success or not */
$user->email = $request->input('email'); $user->email = $request->input('email');
@@ -162,24 +147,21 @@ class UserController extends Controller {
$user->active = $request->input('active'); $user->active = $request->input('active');
$user->internal_note = $request->input('internal_note'); $user->internal_note = $request->input('internal_note');
$user->role = 'user'; $user->role = 'user';
if ($user->save() == true) { try {
$user->save();
/* redirect to Index page with Success Message */ /* redirect to Index page with Success Message */
return redirect('user')->with('success', 'User Created Successfully'); return redirect('user')->with('success', 'User Created Successfully');
} else { } catch (Exception $e) {
/* redirect to Index page with Fails Message */ /* redirect to Index page with Fails Message */
return redirect('user')->with('fails', 'User can not Create'); return redirect('user')->with('fails', $e->errorInfo[2]);
} }
} catch (Exception $e) {
/* redirect to Index page with Fails Message */
return redirect('user')->with('fails', 'User can not Create');
}
} }
/** /**
* Display the specified resource. * Display the specified users.
* @param type int $id * @param type int $id
* @param type User $user * @param type User $user
* @return type Response * @return type view
*/ */
public function show($id, User $user) { public function show($id, User $user) {
try { try {
@@ -203,89 +185,71 @@ class UserController extends Controller {
$users = $user->whereId($id)->first(); $users = $user->whereId($id)->first();
return view('themes.default1.agent.helpdesk.user.edit', compact('users')); return view('themes.default1.agent.helpdesk.user.edit', compact('users'));
} catch (Exception $e) { } catch (Exception $e) {
return view('404'); return redirect()->back()->with('fails', $e->errorInfo[2]);
} }
} }
/** /**
* Update the specified resource in storage. * Update the specified user in storage.
* @param type int $id * @param type int $id
* @param type User $user * @param type User $user
* @param type Sys_userUpdate $request * @param type Sys_userUpdate $request
* @return type Response * @return type Response
*/ */
public function update($id, User $user, Sys_userUpdate $request) { public function update($id, User $user, Sys_userUpdate $request) {
try {
/* select the field where id = $id(request Id) */ /* select the field where id = $id(request Id) */
$users = $user->whereId($id)->first(); $users = $user->whereId($id)->first();
/* Update the value by selected field */ /* Update the value by selected field */
/* Check whether function success or not */ /* Check whether function success or not */
if ($users->fill($request->input())->save() == true) { try{
$users->fill($request->input())->save();
/* redirect to Index page with Success Message */ /* redirect to Index page with Success Message */
return redirect('user')->with('success', 'User Updated Successfully'); return redirect('user')->with('success', 'User Updated Successfully');
} else { } catch (Exception $e) {
/* redirect to Index page with Fails Message */ /* redirect to Index page with Fails Message */
return redirect('user')->with('fails', 'User can not Update'); return redirect()->back()->with('fails', $e->errorInfo[2]);
} }
} catch (Exception $e) {
/* redirect to Index page with Fails Message */
return redirect('user')->with('fails', 'User can not Update');
}
} }
/** /**
* Remove the specified resource from storage. * get agent profile page
* @param type int $id * @return type view
* @param type User $user
* @return type Response
*/
public function destroy($id, User $user) {
try {
/* select the field where id = $id(request Id) */
$users = $user->whereId($id)->first();
/* delete the selected field */
/* Check whether function success or not */
if ($users->delete() == true) {
/* redirect to Index page with Success Message */
return redirect('user')->with('success', 'User Deleted Successfully');
} else {
/* redirect to Index page with Fails Message */
return redirect('user')->with('fails', 'User can not Delete');
}
} catch (Exception $e) {
/* redirect to Index page with Fails Message */
return redirect('user')->with('fails', 'User can not Delete');
}
}
/**
* get profile page
* @return type Response
*/ */
public function getProfile() { public function getProfile() {
$user = Auth::user(); $user = Auth::user();
return view('themes.default1.agent.helpdesk.user.profile', compact('user')); try {
} return view('themes.default1.agent.helpdesk.user.profile', compact('user'));
} catch(Exception $e) {
return redirect()->back()->with('fails',$e->errorInfo[2]);
}
}
/** /**
* get profile edit page * get profile edit page
* @return type Response * @return type view
*/ */
public function getProfileedit() { public function getProfileedit() {
$user = Auth::user(); $user = Auth::user();
return view('themes.default1.agent.helpdesk.user.profile-edit', compact('user')); try {
return view('themes.default1.agent.helpdesk.user.profile-edit', compact('user'));
} catch (Exception $e) {
return redirect()->back()->with('fails',$e->errorInfo[2]);
}
} }
/** /**
* post profile page * post profile edit
* @param type int $id * @param type int $id
* @param type ProfileRequest $request * @param type ProfileRequest $request
* @return type Response * @return type Redirect
*/ */
public function postProfileedit(ProfileRequest $request) { public function postProfileedit(ProfileRequest $request) {
// geet authenticated user details
$user = Auth::user(); $user = Auth::user();
$user->gender = $request->input('gender'); $user->gender = $request->input('gender');
$user->save(); $user->save();
// checking availability of agent profile ppicture
if ($user->profile_pic == 'avatar5.png' || $user->profile_pic == 'avatar2.png') { if ($user->profile_pic == 'avatar5.png' || $user->profile_pic == 'avatar2.png') {
if ($request->input('gender') == 1) { if ($request->input('gender') == 1) {
$name = 'avatar5.png'; $name = 'avatar5.png';
@@ -297,17 +261,26 @@ class UserController extends Controller {
$user->profile_pic = $name; $user->profile_pic = $name;
} }
} }
// checking if the post system includes agent profile picture upload
if (Input::file('profile_pic')) { if (Input::file('profile_pic')) {
//$extension = Input::file('profile_pic')->getClientOriginalExtension(); // fetching picture name
$name = Input::file('profile_pic')->getClientOriginalName(); $name = Input::file('profile_pic')->getClientOriginalName();
// fetching upload destination path
$destinationPath = 'lb-faveo/profilepic'; $destinationPath = 'lb-faveo/profilepic';
// adding a random value to profile picture filename
$fileName = rand(0000, 9999) . '.' . $name; $fileName = rand(0000, 9999) . '.' . $name;
//echo $fileName; // moving the picture to a destination folder
Input::file('profile_pic')->move($destinationPath, $fileName); Input::file('profile_pic')->move($destinationPath, $fileName);
// saving filename to database
$user->profile_pic = $fileName; $user->profile_pic = $fileName;
} else { } else {
$user->fill($request->except('profile_pic', 'gender'))->save(); try{
return Redirect::route('profile')->with('success', 'Profile Updated sucessfully'); $user->fill($request->except('profile_pic', 'gender'))->save();
return Redirect::route('profile')->with('success', 'Profile Updated sucessfully');
} catch (Exception $e){
return Redirect::route('profile')->with('success', $e->errorInfo[2]);
}
} }
if ($user->fill($request->except('profile_pic'))->save()) { if ($user->fill($request->except('profile_pic'))->save()) {
return Redirect::route('profile')->with('success', 'Profile Updated sucessfully'); return Redirect::route('profile')->with('success', 'Profile Updated sucessfully');
@@ -318,22 +291,27 @@ class UserController extends Controller {
* Post profile password * Post profile password
* @param type int $id * @param type int $id
* @param type ProfilePassword $request * @param type ProfilePassword $request
* @return type Response * @return type Redirect
*/ */
public function postProfilePassword($id, ProfilePassword $request) { public function postProfilePassword($id, ProfilePassword $request) {
// get authenticated user
$user = Auth::user(); $user = Auth::user();
//echo $user->password; // checking if the old password matches the new password
if (Hash::check($request->input('old_password'), $user->getAuthPassword())) { if (Hash::check($request->input('old_password'), $user->getAuthPassword())) {
$user->password = Hash::make($request->input('new_password')); $user->password = Hash::make($request->input('new_password'));
$user->save(); try{
return redirect('profile-edit')->with('success1', 'Password Updated sucessfully'); $user->save();
return redirect('profile-edit')->with('success1', 'Password Updated sucessfully');
} catch (Exception $e) {
return redirect('profile-edit')->with('fails', $e->errorInfo[2]);
}
} else { } else {
return redirect('profile-edit')->with('fails1', 'Password was not Updated. Incorrect old password'); return redirect('profile-edit')->with('fails1', 'Password was not Updated. Incorrect old password');
} }
} }
/** /**
* User Assign Org * Assigning an user to an organization
* @param type $id * @param type $id
* @return type boolean * @return type boolean
*/ */
@@ -347,21 +325,21 @@ class UserController extends Controller {
} }
/** /**
* user create organisation * creating an organization in user profile page via modal popup
* @return type value * @param type $id
* @return type
*/ */
public function User_Create_Org($id) { 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 // checking website
$check = Organization::where('website','=',Input::get('website'))->first(); $check = Organization::where('website','=',Input::get('website'))->first();
} else { } else {
$check = null; $check = null;
} }
// checking if the name is unique
// checking name
$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) { if (\Input::get('name') == null) {
return "Name is required"; return "Name is required";
} elseif($check2 != null) { } elseif($check2 != null) {
@@ -369,6 +347,7 @@ class UserController extends Controller {
} elseif($check != null) { } elseif($check != null) {
return "Website should be Unique"; return "Website should be Unique";
} else { } else {
// storing organization details and assigning the current user to that organization
$org = new Organization; $org = new Organization;
$org->name = Input::get('name'); $org->name = Input::get('name');
$org->phone = Input::get('phone'); $org->phone = Input::get('phone');
@@ -381,7 +360,7 @@ class UserController extends Controller {
$user_org->org_id = $org->id; $user_org->org_id = $org->id;
$user_org->user_id = $id; $user_org->user_id = $id;
$user_org->save(); $user_org->save();
// for success return 0
return 0; return 0;
} }
} }

View File

@@ -1,159 +1,171 @@
<?php namespace App\Http\Controllers\Agent\kb; <?php namespace App\Http\Controllers\Agent\kb;
// Controllers
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Http\Controllers\Agent\kb\SettingsController; use App\Http\Controllers\Agent\kb\SettingsController;
use App\Http\Controllers\Client\kb\UserController; use App\Http\Controllers\Client\kb\UserController;
use App\Http\Controllers\Agent\helpdesk\TicketController; use App\Http\Controllers\Agent\helpdesk\TicketController;
// Requests
use App\Http\Requests\kb\ArticleRequest; use App\Http\Requests\kb\ArticleRequest;
use App\Http\Requests\kb\ArticleUpdate; use App\Http\Requests\kb\ArticleUpdate;
// Models
use App\Model\kb\Article; use App\Model\kb\Article;
use App\Model\kb\Category; use App\Model\kb\Category;
use App\Model\kb\Relationship; use App\Model\kb\Relationship;
use App\Model\kb\Settings; use App\Model\kb\Settings;
use App\Model\kb\Comment;
// Classes
use Auth; use Auth;
use Chumper\Datatable\Table; use Chumper\Datatable\Table;
use Datatable; use Datatable;
use DB; use DB;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use App\Model\kb\Comment;
/* include the article model to access the article table */
use Redirect; use Redirect;
use Exception; use Exception;
/** /**
* ArticleController * ArticleController
* This controller is used to CRUD Articles
* *
* @package Controllers * @package Controllers
* @subpackage Controller * @subpackage Controller
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class ArticleController extends Controller { class ArticleController extends Controller {
/** /**
* Display a listing of the resource. * Create a new controller instance.
* * constructor to check
* @return Response * 1. authentication
* 2. user roles
* 3. roles must be agent
* @return void
*/ */
public function __construct() { public function __construct() {
// checking authentication
$this->middleware('auth'); $this->middleware('auth');
// checking roles
$this->middleware('roles'); $this->middleware('roles');
SettingsController::language(); SettingsController::language();
} }
public function test() { public function test() {
//$table = $this->setDatatable(); //$table = $this->setDatatable();
return view('themes.default1.agent.kb.article.test'); return view('themes.default1.agent.kb.article.test');
} }
/**
* Fetching all the list of articles in a chumper datatable format
* @return type void
*/
public function getData() { public function getData() {
// returns chumper datatable
//return 'kfjhje';
return Datatable::collection(Article::All()) return Datatable::collection(Article::All())
/* searcable column name */
->searchColumns('name') ->searchColumns('name')
/* order column name and description */
->orderColumns('name', 'description') ->orderColumns('name', 'description')
/* add column name */
->addColumn('name', function ($model) { ->addColumn('name', function ($model) {
return $model->name; return $model->name;
}) })
/* add column Created */
->addColumn('Created', function ($model) { ->addColumn('Created', function ($model) {
$t = $model->created_at; $t = $model->created_at;
return TicketController::usertimezone($t); return TicketController::usertimezone($t);
}) })
/* add column action */
->addColumn('Actions', function ($model) { ->addColumn('Actions', function ($model) {
//return '<a href=article/delete/ ' . $model->id . ' class="btn btn-danger btn-flat" onclick="myFunction()">Delete</a>&nbsp;<a href=article/' . $model->id . '/edit class="btn btn-warning btn-flat">Edit</a>&nbsp;<a href=show/' . $model->id . ' class="btn btn-warning btn-flat">View</a>'; /* here are all the action buttons and modal popup to delete articles with confirmations */
//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>&nbsp;<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>&nbsp;<a href=article/' . $model->id . '/edit class="btn btn-warning btn-xs">' . \Lang::get('lang.edit') . '</a>&nbsp;<a href=show/'.$model->slug .' class="btn btn-primary btn-xs">' . \Lang::get('lang.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>&nbsp;<a href=article/' . $model->id . '/edit class="btn btn-warning btn-xs">' . \Lang::get('lang.edit') . '</a>&nbsp;<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 fade" id="deletearticle'.$model->id .'">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">Are You Sure ?</h4> <h4 class="modal-title">Are You Sure ?</h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
'.$model->name.' '.$model->name.'
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">Close</button> <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>
</div><!-- /.modal-content --> </div><!-- /.modal-content -->
</div><!-- /.modal-dialog --> </div><!-- /.modal-dialog -->
</div>'; </div>';
}) })
->make(); ->make();
} }
/** /**
* Index for Articles * List of Articles
* @param type Article $article * @return type view
* @return type Response
*/ */
public function index() { public function index() {
/* show the index page with article list */ /* show article list */
return view('themes.default1.agent.kb.article.index'); try{
return view('themes.default1.agent.kb.article.index');
} catch(Exception $e) {
return redirect()->back()->with('fails',$e->errorInfo[2]);
}
} }
/** /**
* Creating a Article * Creating a Article
* @param type Category $category * @param type Category $category
* @return type Response * @return type view
*/ */
public function create(Category $category) { public function create(Category $category) {
//$cat = $category->whereId(33)->first(); /* get the attributes of the category */
//$tm = $cat->created_at;
//$this->usertimezone($tm);
// // /* get the attributes of the category */
$category = $category->lists('id', 'name'); $category = $category->lists('id', 'name');
/* get the create page */ /* get the create page */
return view('themes.default1.agent.kb.article.create', compact('category')); try{
return view('themes.default1.agent.kb.article.create', compact('category'));
} catch(Exception $e) {
return redirect()->back()->with('fails',$e->errorInfo[2]);
}
} }
/** /**
* Insert the values to the article table * Insert the values to the article
* @param type Article $article * @param type Article $article
* @param type ArticleRequest $request * @param type ArticleRequest $request
* @return type * @return type redirect
*/ */
public function store(Article $article, ArticleRequest $request) { public function store(Article $article, ArticleRequest $request) {
// requesting the values to store article data
$sl = $request->input('slug'); $sl = $request->input('slug');
$slug = str_slug($sl, "-"); $slug = str_slug($sl, "-");
$article->slug = $slug; $article->slug = $slug;
$article->fill($request->except('created_at','slug'))->save(); $article->fill($request->except('created_at','slug'))->save();
// creating article category relationship
$requests = $request->input('category_id'); $requests = $request->input('category_id');
$id = $article->id; $id = $article->id;
foreach ($requests as $req) { 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]);
} }
/* insert the values to the article table */ /* insert the values to the article table */
if ($article->fill($request->except('slug'))->save()) //true: redirect to index page with success message try{
{ $article->fill($request->except('slug'))->save();
return redirect('article')->with('success', 'Article Inserted Successfully'); return redirect('article')->with('success', 'Article Inserted Successfully');
} else //redirect to index page with fail message } catch (Exception $e) {
{ return redirect('article')->with('fails', 'Article Not Inserted'. '<li>'.$e->errorInfo[2].'</li>');
return redirect('article')->with('fails', 'Article Not Inserted');
} }
} }
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($id) {
//
}
/** /**
* Edit an Article by id * Edit an Article by id
* @param type Integer $id * @param type Integer $id
* @param type Article $article * @param type Article $article
* @param type Relationship $relation * @param type Relationship $relation
* @param type Category $category * @param type Category $category
* @return Response * @return view
*/ */
public function edit($slug, Article $article, Relationship $relation, Category $category) { public function edit($slug, Article $article, Relationship $relation, Category $category) {
@@ -168,7 +180,12 @@ class ArticleController extends Controller {
/* Get the selected article with id */ /* Get the selected article with id */
$article = $article->whereId($id)->first(); $article = $article->whereId($id)->first();
/* send to the edit page */ /* send to the edit page */
return view('themes.default1.agent.kb.article.edit', compact('assign', 'article', 'category')); try {
return view('themes.default1.agent.kb.article.edit', compact('assign', 'article', 'category'));
} catch(Exception $e){
return redirect()->back()->with('fails',$e->errorInfo[2]);
}
} }
/** /**
@@ -197,14 +214,13 @@ class ArticleController extends Controller {
DB::insert('insert into article_relationship (category_id, article_id) values (?,?)', [$req, $id]); DB::insert('insert into article_relationship (category_id, article_id) values (?,?)', [$req, $id]);
} }
/* update the value to the table */ /* update the value to the table */
if ($article->fill($request->all())->save()) //true: redirect to index page with success message try{
{ $article->fill($request->all())->save();
$article->slug = $slug; $article->slug = $slug;
$article->save(); $article->save();
return redirect('article')->with('success', 'Article Updated Successfully'); return redirect('article')->with('success', 'Article Updated Successfully');
} else // redirect to index page with fails message } catch(Exception $e){
{ return redirect('article')->with('fails', 'Article Not Updated'.'<li>'.$e->errorInfo[2].'</li>');
return redirect('article')->with('fails', 'Article Not Updated');
} }
} }
@@ -215,59 +231,46 @@ class ArticleController extends Controller {
* @return Response * @return Response
*/ */
public function destroy($slug, Article $article, Relationship $relation, Comment $comment) { public function destroy($slug, Article $article, Relationship $relation, Comment $comment) {
/* delete the selected article from the table */ /* 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
//dd($article);
$id = $article->id; $id = $article->id;
$comments = $comment->where('article_id',$id)->get(); $comments = $comment->where('article_id',$id)->get();
if($comments) {
if($comments)
{
foreach($comments as $comment) foreach($comments as $comment)
$comment->delete(); $comment->delete();
} }
// deleting relationship
$relation = $relation->where('article_id', $id)->first(); $relation = $relation->where('article_id', $id)->first();
if($relation) if($relation) {
{
$relation->delete(); $relation->delete();
} }
if($article) if($article) {
{ if ($article->delete()) {//true:redirect to index page with success message
if ($article->delete()) //true:redirect to index page with success message
{
return Redirect::back()->with('success', 'Article Deleted Successfully'); return Redirect::back()->with('success', 'Article Deleted Successfully');
} else //redirect to index page with fails message } else { //redirect to index page with fails message
{
return Redirect::back()->with('fails', 'Article Not Deleted'); return Redirect::back()->with('fails', 'Article Not Deleted');
} }
} else {
}
else
{
return Redirect::back()->with('fails', 'Article can Not Deleted'); return Redirect::back()->with('fails', 'Article can Not Deleted');
} }
} }
/**
* user time zone
* fetching timezone
* @param type $utc
* @return type
*/
static function usertimezone($utc) { static function usertimezone($utc) {
$user = Auth::user(); $user = Auth::user();
$tz = $user->timezone; $tz = $user->timezone;
$set = Settings::whereId('1')->first(); $set = Settings::whereId('1')->first();
$format = $set->dateformat; $format = $set->dateformat;
//$utc = date('M d Y h:i:s A'); //$utc = date('M d Y h:i:s A');
//echo 'UTC : ' . $utc;
date_default_timezone_set($tz); date_default_timezone_set($tz);
$offset = date('Z', strtotime($utc)); $offset = date('Z', strtotime($utc));
//print "offset: $offset \n";
$date = date($format, strtotime($utc) + $offset); $date = date($format, strtotime($utc) + $offset);
echo $date; echo $date;
//return substr($date, 0, -6);
} }
} }

View File

@@ -1,33 +1,47 @@
<?php namespace App\Http\Controllers\Agent\kb; <?php namespace App\Http\Controllers\Agent\kb;
// Controllers
use App\Http\Controllers\client\kb\UserController; use App\Http\Controllers\client\kb\UserController;
use App\Http\Controllers\admin\kb\ArticleController; use App\Http\Controllers\admin\kb\ArticleController;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Http\Controllers\Agent\kb\SettingsController; 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\CategoryRequest;
use App\Http\Requests\kb\CategoryUpdate; use App\Http\Requests\kb\CategoryUpdate;
use App\Http\Controllers\Agent\helpdesk\TicketController;
// Model
use App\Model\kb\Category; use App\Model\kb\Category;
use App\Model\kb\Relationship; use App\Model\kb\Relationship;
// Classes
use Datatable; use Datatable;
use Redirect; use Redirect;
use Exception;
/** /**
* CategoryController * CategoryController
* This controller is used to CRUD category
* *
* @package Controllers * @package Controllers
* @subpackage Controller * @subpackage Controller
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class CategoryController extends Controller { class CategoryController extends Controller {
/** /**
* Display a listing of the resource. * Create a new controller instance.
* * constructor to check
* @return Response * 1. authentication
* 2. user roles
* 3. roles must be agent
* @return void
*/ */
public function __construct() { public function __construct() {
// checking authentication
$this->middleware('auth'); $this->middleware('auth');
// checking roles
$this->middleware('roles'); $this->middleware('roles');
SettingsController::language(); SettingsController::language();
} }
@@ -38,48 +52,56 @@ class CategoryController extends Controller {
* @return Response * @return Response
*/ */
public function index() { public function index() {
/* get the view of index of the catogorys with all attributes /* get the view of index of the catogorys with all attributes
of category model */ of category model */
return view('themes.default1.agent.kb.category.index'); try{
return view('themes.default1.agent.kb.category.index');
} catch (Exception $e) {
return redirect()->back()->with('fails', $e->errorInfo[2]);
}
} }
/**
* fetching category list in chumper datatables
* @return type chumper datatable
*/
public function getData() { public function getData() {
/* fetching chumper datatables */
//return 'kfjhje';
return Datatable::collection(Category::All()) return Datatable::collection(Category::All())
/* search column name */
->searchColumns('name') ->searchColumns('name')
/* order column name and description */
->orderColumns('name', 'description') ->orderColumns('name', 'description')
/* add column name */
->addColumn('name', function ($model) { ->addColumn('name', function ($model) {
return $model->name; return $model->name;
}) })
/* add column Created */
->addColumn('Created', function ($model) { ->addColumn('Created', function ($model) {
$t = $model->created_at; $t = $model->created_at;
return TicketController::usertimezone($t); return TicketController::usertimezone($t);
}) })
/* add column Actions */
/* there are action buttons and modal popup to delete a data column */
->addColumn('Actions', function ($model) { ->addColumn('Actions', function ($model) {
//return '<a href=category/delete/' . $model->id . ' class="btn btn-danger btn-flat">Delete</a>&nbsp;<a href=category/' . $model->id . '/edit class="btn btn-warning btn-flat">Edit</a>&nbsp;<a href=article-list class="btn btn-warning btn-flat">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>&nbsp;<a href=category/' . $model->id . '/edit class="btn btn-warning btn-xs">'. \Lang::get("lang.edit") .'</a>&nbsp;<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>&nbsp;<a href=category/' . $model->id . '/edit class="btn btn-warning btn-xs">'. \Lang::get("lang.edit") .'</a>&nbsp;<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 fade" id="deletecategory' . $model->slug . '">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">Are You Sure ?</h4> <h4 class="modal-title">Are You Sure ?</h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
'.$model->name.' '.$model->name.'
</div> </div>
<div class="modal-footer">
<div class="modal-footer"> <button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">Close</button>
<button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">Close</button> <a href="category/delete/' . $model->id . '"><button class="btn btn-danger">delete</button></a>
<a href="category/delete/' . $model->id . '"><button class="btn btn-danger">delete</button></a> </div>
</div> </div>
</div><!-- /.modal-content --> </div>
</div><!-- /.modal-dialog --> </div>';
</div>';
}) })
->make(); ->make();
@@ -88,71 +110,62 @@ class CategoryController extends Controller {
/** /**
* Create a Category * Create a Category
* @param type Category $category * @param type Category $category
* @return Response * @return type view
*/ */
public function create(Category $category) { public function create(Category $category) {
/* Get the all attributes in the category model */ /* Get the all attributes in the category model */
$category = $category->get(); $category = $category->get();
/* get the view page to create new category with all attributes /* get the view page to create new category with all attributes
of category model*/ of category model*/
return view('themes.default1.agent.kb.category.create', compact('category')); try {
} return view('themes.default1.agent.kb.category.create', compact('category'));
} catch(Exception $e) {
/** return redirect()->back()->with('fails',$e->errorInfo[2]);
* Store a newly created resource in storage.
*
* @return Response
*/
public function store(Category $category, CategoryRequest $request) {
/* Get the whole request from the form and insert into table via model */
$sl = $request->input('slug');
$slug = str_slug($sl, "-");
$category->slug = $slug;
//$category->save();
if ($category->fill($request->except('slug'))->save()) //True: send success message to index page
{
return Redirect::back()->with('success', 'Category Inserted Successfully');
} else //send fail to index page
{
return Redirect::back()->with('fails', 'Category Not Inserted');
} }
} }
/** /**
* Display the specified resource. * To store the selected category
* * @param type Category $category
* @param int $id * @param type CategoryRequest $request
* @return Response * @return type Redirect
*/ */
public function show($id) { public function store(Category $category, CategoryRequest $request) {
// /* Get the whole request from the form and insert into table via model */
$sl = $request->input('slug');
$slug = str_slug($sl, "-");
$category->slug = $slug;
// send success message to index page
try{
$category->fill($request->except('slug'))->save();
return Redirect::back()->with('success', 'Category Inserted Successfully');
} catch(Exception $e) {
return Redirect::back()->with('fails', 'Category Not Inserted'.'<li>'.$e->errorInfo[2].'</li>');
}
} }
/** /**
* Show the form for editing the specified resource. * Show the form for editing the specified category.
* * @param type $slug
* @param int $id * @param type Category $category
* @return Response * @return type view
*/ */
public function edit($slug, Category $category) { public function edit($slug, Category $category) {
// fetch the category
$cid = $category->where('id', $slug)->first(); $cid = $category->where('id', $slug)->first();
$id = $cid->id; $id = $cid->id;
/* get the atributes of the category model whose id == $id */ /* get the atributes of the category model whose id == $id */
$category = $category->whereId($id)->first(); $category = $category->whereId($id)->first();
/* get the Edit page the selected category via id */ /* get the Edit page the selected category via id */
return view('themes.default1.agent.kb.category.edit', compact('category')); return view('themes.default1.agent.kb.category.edit', compact('category'));
} }
/** /**
* Update the specified resource in storage. * Update the specified Category in storage.
* * @param type $slug
* @param int $id * @param type Category $category
* @return Response * @param type CategoryUpdate $request
* @return type redirect
*/ */
public function update($slug, Category $category, CategoryUpdate $request) { public function update($slug, Category $category, CategoryUpdate $request) {
@@ -163,42 +176,41 @@ class CategoryController extends Controller {
// dd($slug); // dd($slug);
$category->slug = $slug; $category->slug = $slug;
/* update the values at the table via model according with the request */ /* update the values at the table via model according with the request */
if ($category->fill($request->all())->save()) //True: redirct to index page with success message //redirct to index page with success message
{ try{
$category->fill($request->all())->save();
$category->slug = $slug; $category->slug = $slug;
$category->save(); $category->save();
return redirect('category')->with('success', 'Category Updated Successfully'); return redirect('category')->with('success', 'Category Updated Successfully');
} else //redirect to index with fails message } catch(Exception $e) {
{ //redirect to index with fails message
return redirect('category')->with('fails', 'Category Not Updated'); return redirect('category')->with('fails', 'Category Not Updated'.'<li>'.$e->errorInfo[2].'</li>');
} }
} }
/** /**
* Remove the specified resource from storage. * Remove the specified category from storage.
* * @param type $id
* @param int $id * @param type Category $category
* @return Response * @param type Relationship $relation
* @return type Redirect
*/ */
public function destroy($id, Category $category, Relationship $relation) { public function destroy($id, Category $category, Relationship $relation) {
$relation = $relation->where('category_id', $id)->first(); $relation = $relation->where('category_id', $id)->first();
// dd($relation);
if($relation != null){ if($relation != null){
return Redirect::back()->with('fails', 'Category Not Deleted'); return Redirect::back()->with('fails', 'Category Not Deleted');
} }
else { else {
/* delete the category selected, id == $id */ /* delete the category selected, id == $id */
$category = $category->whereId($id)->first(); $category = $category->whereId($id)->first();
if ($category->delete()) //True: redirect to index with success message // redirect to index with success message
{ try{
$category->delete();
return Redirect::back()->with('success', 'Category Deleted Successfully'); return Redirect::back()->with('success', 'Category Deleted Successfully');
} else //redirect to index page fails message } catch(Exception $e){
{ return Redirect::back()->with('fails', 'Category Not Deleted'.'<li>'.$e->errorInfo[2].'</li>');
return Redirect::back()->with('fails', 'Category Not Deleted'); }
}
} }
} }

View File

@@ -1,89 +1,113 @@
<?php namespace App\Http\Controllers\Agent\kb; <?php namespace App\Http\Controllers\Agent\kb;
// controllers
use App\Http\Controllers\client\kb\UserController; use App\Http\Controllers\client\kb\UserController;
use App\Http\Controllers\Agent\kb\ArticleController; use App\Http\Controllers\Agent\kb\ArticleController;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Http\Controllers\Agent\kb\SettingsController; use App\Http\Controllers\Agent\kb\SettingsController;
use App\Http\Controllers\Agent\helpdesk\TicketController; use App\Http\Controllers\Agent\helpdesk\TicketController;
// request
use App\Http\Requests\kb\PageRequest; use App\Http\Requests\kb\PageRequest;
use App\Http\Requests\kb\PageUpdate; use App\Http\Requests\kb\PageUpdate;
use App\Model\kb\Page;
use Datatable;
use Illuminate\Http\Request; use Illuminate\Http\Request;
// Model
use App\Model\kb\Page;
// classes
use Datatable;
use Exception;
/**
* PageController
* This controller is used to CRUD Pages
*
* @package Controllers
* @subpackage Controller
* @author Ladybird <info@ladybirdweb.com>
*/
class PageController extends Controller { class PageController extends Controller {
/** /**
* Contructor for both Authentication and Model Injecting * Create a new controller instance.
* @param type Page $page * constructor to check
* @return type * 1. authentication
* 2. user roles
* 3. roles must be agent
* @return void
*/ */
public function __construct(Page $page) { public function __construct(Page $page) {
// checking authentication
$this->middleware('auth'); $this->middleware('auth');
// checking roles
$this->middleware('roles'); $this->middleware('roles');
$this->page = $page; $this->page = $page;
SettingsController::language(); SettingsController::language();
} }
/** /**
* Display a listing of the resource. * Display the list of pages
* * @return type
* @return Response
*/ */
public function index() { public function index() {
$pages = $this->page->paginate(3); $pages = $this->page->paginate(3);
$pages->setPath('page'); $pages->setPath('page');
return view('themes.default1.agent.kb.pages.index', compact('pages')); try{
return view('themes.default1.agent.kb.pages.index', compact('pages'));
} catch(Exception $e) {
return redirect()->back()->with('fails',$e->errorInfo[2]);
}
} }
/**
* fetching pages list in chumper datatables
* @return type
*/
public function getData() { public function getData() {
/* fetching chumper datatables */
//return 'kfjhje';
return Datatable::collection(Page::All()) return Datatable::collection(Page::All())
/* search column name */
->searchColumns('name') ->searchColumns('name')
/* order column name, description and created */
->orderColumns('name', 'description', 'created') ->orderColumns('name', 'description', 'created')
/* add column name */
->addColumn('name', function ($model) { ->addColumn('name', function ($model) {
return $model->name; return $model->name;
}) })
/* add column Created */
->addColumn('Created', function ($model) { ->addColumn('Created', function ($model) {
$t = $model->created_at; $t = $model->created_at;
return TicketController::usertimezone($t); return TicketController::usertimezone($t);
}) })
/* add column Actions */
/* there are action buttons and modal popup to delete a data column */
->addColumn('Actions', function ($model) { ->addColumn('Actions', function ($model) {
//return '<a href=page/delete/' . $model->id . ' class="btn btn-danger btn-flat">Delete</a>&nbsp;<a href=page/' . $model->id . '/edit class="btn btn-warning btn-flat">Edit</a>&nbsp;<a href=article-list class="btn btn-warning btn-flat">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>&nbsp;<a href=page/' . $model->slug . '/edit class="btn btn-warning btn-xs">'. \Lang::get('lang.edit') .'</a>&nbsp;<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>&nbsp;<a href=page/' . $model->slug . '/edit class="btn btn-warning btn-xs">'. \Lang::get('lang.edit') .'</a>&nbsp;<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 fade" id="deletepage' . $model->id . '">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">Are You Sure ?</h4> <h4 class="modal-title">Are You Sure ?</h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
'.$model->name.' '.$model->name.'
</div> </div>
<div class="modal-footer">
<div class="modal-footer"> <button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">Close</button>
<button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">Close</button> <a href="page/delete/' . $model->id . '"><button class="btn btn-danger">delete</button></a>
<a href="page/delete/' . $model->id . '"><button class="btn btn-danger">delete</button></a> </div>
</div> </div>
</div><!-- /.modal-content --> </div>
</div><!-- /.modal-dialog --> </div>';
</div>';
}) })
->make(); ->make();
} }
/** /**
* Show the form for creating a new resource. * Show the form for creating a new resource.
* * @return type view
* @return Response
*/ */
public function create() { public function create() {
return view('themes.default1.agent.kb.pages.create'); return view('themes.default1.agent.kb.pages.create');
@@ -97,61 +121,65 @@ class PageController extends Controller {
public function store(PageRequest $request) { public function store(PageRequest $request) {
$sl = $request->input('slug'); $sl = $request->input('slug');
$slug = str_slug($sl, "-"); $slug = str_slug($sl, "-");
$this->page->slug = $slug; $this->page->slug = $slug;
try{
$this->page->fill($request->except('slug'))->save(); $this->page->fill($request->except('slug'))->save();
return redirect('page'); return redirect('page')->with('success','Page created successfully');
} } catch(Exception $e) {
return redirect('page')->with('fails',$e->errorInfo[2]);
/** }
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($id) {
//
} }
/** /**
* To edit a page * To edit a page
* @param type $id * @param type $slug
* @return type * @return type view
*/ */
public function edit($slug) { public function edit($slug) {
$page = $this->page->where('slug', $slug)->first(); try{
return view('themes.default1.agent.kb.pages.edit', compact('page')); $page = $this->page->where('slug', $slug)->first();
return view('themes.default1.agent.kb.pages.edit', compact('page'));
} catch (Exception $e) {
return redirect('page')->with('fails',$e->errorInfo[2]);
}
} }
/** /**
* To update a page * To update a page
* @param type $id * @param type $slug
* @param type Request $request * @param type PageUpdate $request
* @return type * @return type redirect
*/ */
public function update($slug, PageUpdate $request) { public function update($slug, PageUpdate $request) {
// get pages with respect to slug
$pages = $this->page->where('slug', $slug)->first(); $pages = $this->page->where('slug', $slug)->first();
$sl = $request->input('slug'); $sl = $request->input('slug');
$slug = str_slug($sl, "-"); $slug = str_slug($sl, "-");
$this->page->slug = $slug;
$this->page->slug = $slug; try{
//$id = $page->id; $pages->fill($request->all())->save();
$pages->fill($request->all())->save(); $pages->slug = $slug;
$pages->slug = $slug; $pages->save();
$pages->save(); return redirect('page')->with('success', 'Your Page Updated Successfully');
return redirect('page')->with('success', 'Your Page Updated Successfully'); } catch(Exception $e) {
return redirect('page')->with('fails', $e->errorInfo[2]);
}
} }
/** /**
* To Delete one Page * To Delete a Page
* @param type $id * @param type $id
* @return type * @return type redirect
*/ */
public function destroy($id) { public function destroy($id) {
$page = $this->page->whereId($id)->first(); try{
$page->delete(); // get the page to be deleted
return redirect('page')->with('success', 'Page Deleted Successfully'); $page = $this->page->whereId($id)->first();
$page->delete();
return redirect('page')->with('success', 'Page Deleted Successfully');
} catch (Exception $e) {
return redirect('page')->with('fails', $e->errorInfo[2]);
}
} }
} }

View File

@@ -1,38 +1,59 @@
<?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\kb\ArticleController;
use App\Http\Controllers\Agent\helpdesk\TicketController; use App\Http\Controllers\Agent\helpdesk\TicketController;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
// Request
use App\Http\Requests\kb\FooterRequest; use App\Http\Requests\kb\FooterRequest;
use App\Http\Requests\kb\ProfilePassword; use App\Http\Requests\kb\ProfilePassword;
use App\Http\Requests\kb\ProfileRequest; use App\Http\Requests\kb\ProfileRequest;
use App\Http\Requests\kb\SettingsRequests; use App\Http\Requests\kb\SettingsRequests;
use App\Http\Requests\kb\SocialRequest; use App\Http\Requests\kb\SocialRequest;
use Illuminate\Http\Request;
// Model
use App\Model\kb\Comment; use App\Model\kb\Comment;
use App\Model\kb\DateFormat;
use App\Model\kb\Faq; use App\Model\kb\Faq;
use App\Model\kb\Settings; use App\Model\kb\Settings;
use App\Model\kb\Side1; use App\Model\kb\Side1;
use App\Model\kb\Side2; use App\Model\kb\Side2;
use App\Model\kb\Social; use App\Model\kb\Social;
use App\Model\helpdesk\Utility\Timezones; use App\Model\helpdesk\Utility\Timezones;
use App\Model\helpdesk\Utility\Date_format;
// Classes
use Auth; use Auth;
use Config; use Config;
use Datatable; use Datatable;
use Hash; use Hash;
use Illuminate\Http\Request;
use Image; use Image;
use Input; use Input;
use Exception;
/**
* SettingsController
* This controller is used to perform settings in the setting page of knowledgebase
*
* @package Controllers
* @subpackage Controller
* @author Ladybird <info@ladybirdweb.com>
*/
class SettingsController extends Controller { class SettingsController extends Controller {
/** /**
* Display a listing of the resource. * Create a new controller instance.
* * constructor to check
* @return Response * 1. authentication
* 2. user roles
* 3. roles must be agent
* @return void
*/ */
public function __construct() { public function __construct() {
// checking authentication
$this->middleware('auth'); $this->middleware('auth');
// checking roles
$this->middleware('roles'); $this->middleware('roles');
$this->language(); $this->language();
} }
@@ -42,8 +63,7 @@ class SettingsController extends Controller {
* @return response * @return response
* @package default * @package default
*/ */
public function settings(Settings $settings, Timezones $time, DateFormat $date) { public function settings(Settings $settings, Timezones $time, Date_format $date) {
/* get the setting where the id == 1 */ /* get the setting where the id == 1 */
$settings = $settings->whereId('1')->first(); $settings = $settings->whereId('1')->first();
$time = $time->get(); $time = $time->get();
@@ -62,19 +82,14 @@ class SettingsController extends Controller {
{ {
/* fetch the values of company request */ /* fetch the values of company request */
$settings = $settings->whereId('1')->first(); $settings = $settings->whereId('1')->first();
if (Input::file('logo')) { if (Input::file('logo')) {
$name = Input::file('logo')->getClientOriginalName(); $name = Input::file('logo')->getClientOriginalName();
$destinationPath = 'lb-faveo/dist/image'; $destinationPath = 'lb-faveo/dist/image';
$fileName = rand(0000, 9999) . '.' . $name; $fileName = rand(0000, 9999) . '.' . $name;
//echo $fileName; //echo $fileName;
Input::file('logo')->move($destinationPath, $fileName); Input::file('logo')->move($destinationPath, $fileName);
$settings->logo = $fileName; $settings->logo = $fileName;
//$thDestinationPath = 'dist/th'; //$thDestinationPath = 'dist/th';
Image::make($destinationPath . '/' . $fileName, array( Image::make($destinationPath . '/' . $fileName, array(
'width' => 300, 'width' => 300,
'height' => 300, 'height' => 300,
@@ -83,28 +98,21 @@ class SettingsController extends Controller {
} }
if (Input::file('background')) { if (Input::file('background')) {
$name = Input::file('background')->getClientOriginalName(); $name = Input::file('background')->getClientOriginalName();
$destinationPath = 'lb-faveo/dist/image'; $destinationPath = 'lb-faveo/dist/image';
$fileName = rand(0000, 9999) . '.' . $name; $fileName = rand(0000, 9999) . '.' . $name;
echo $fileName; echo $fileName;
Input::file('background')->move($destinationPath, $fileName); Input::file('background')->move($destinationPath, $fileName);
$settings->background = $fileName; $settings->background = $fileName;
//$thDestinationPath = 'dist/th'; //$thDestinationPath = 'dist/th';
Image::make($destinationPath . '/' . $fileName, array( Image::make($destinationPath . '/' . $fileName, array(
'width' => 300, 'width' => 300,
'height' => 300, 'height' => 300,
'grayscale' => false, 'grayscale' => false,
))->save('lb-faveo/dist/image/' . $fileName); ))->save('lb-faveo/dist/image/' . $fileName);
} }
/* Check whether function success or not */ /* Check whether function success or not */
if ($settings->fill($request->except('logo', 'background'))->save() == true) { if ($settings->fill($request->except('logo', 'background'))->save() == true) {
/* redirect to Index page with Success Message */ /* redirect to Index page with Success Message */
return redirect('settings')->with('success', 'Settings Updated Successfully'); return redirect('settings')->with('success', 'Settings Updated Successfully');
} else { } else {
/* redirect to Index page with Fails Message */ /* redirect to Index page with Fails Message */
@@ -117,49 +125,6 @@ class SettingsController extends Controller {
} }
/**
* to get the faq view page
* @return response
*/
public function Faq(Faq $faq) {
/* fetch the values of faq */
$faq = $faq->whereId('1')->first();
return view('themes.default1.agent.settings.faq', compact('faq'));
}
public function postfaq($id, Faq $faq, Request $request) {
$faq = $faq->whereId('1')->first();
if ($faq->fill($request->input())->save()) {
return redirect('create-faq')->with('success', 'Faq updated Successfully');
} else {
return redirect('craete-faq')->with('fails', 'Faq not updated');
}
}
/**
* get the create page to insert the values to database
* @return type response
*/
public function CreateSocialLink(Social $social) {
$social = $social->whereId('1')->first();
return view('themes.default1.agent.kb.settings.social', compact('social'));
}
/**
*
* @param type Social $social
* @param type Request $request
* @return type resonse
*/
public function PostSocial(Social $social, SocialRequest $request) {
$social = $social->whereId('1')->first();
if ($social->fill($request->input())->save()) {
return redirect('social')->with('success', 'Your Social Links Stored');
} else {
return redirect('social')->with('fails', 'Sorry Can not Performe');
}
}
/** /**
* To Moderate the commenting * To Moderate the commenting
* @param type Comment $comment * @param type Comment $comment
@@ -237,56 +202,61 @@ class SettingsController extends Controller {
} }
} }
/**
* get profile page
* @return type view
*/
public function getProfile() { public function getProfile() {
$time = Timezone::all(); $time = Timezone::all();
$user = Auth::user(); $user = Auth::user();
return view('themes.default1.agent.kb.settings.profile', compact('user', 'time')); return view('themes.default1.agent.kb.settings.profile', compact('user', 'time'));
} }
/**
* Post profile page
* @param type ProfileRequest $request
* @return type redirect
*/
public function postProfile(ProfileRequest $request) { public function postProfile(ProfileRequest $request) {
$user = Auth::user(); $user = Auth::user();
$user->gender = $request->input('gender'); $user->gender = $request->input('gender');
$user->save(); $user->save();
if (is_null($user->profile_pic)) { if (is_null($user->profile_pic)) {
if ($request->input('gender') == 1) { if ($request->input('gender') == 1) {
$name = 'avatar5.png'; $name = 'avatar5.png';
$destinationPath = 'lb-faveo/dist/img'; $destinationPath = 'lb-faveo/dist/img';
$user->profile_pic = $name; $user->profile_pic = $name;
} elseif ($request->input('gender') == 0) { } elseif ($request->input('gender') == 0) {
$name = 'avatar2.png'; $name = 'avatar2.png';
$destinationPath = 'lb-faveo/dist/img'; $destinationPath = 'lb-faveo/dist/img';
$user->profile_pic = $name; $user->profile_pic = $name;
} }
} }
if (Input::file('profile_pic')) { if (Input::file('profile_pic')) {
//$extension = Input::file('profile_pic')->getClientOriginalExtension(); //$extension = Input::file('profile_pic')->getClientOriginalExtension();
$name = Input::file('profile_pic')->getClientOriginalName(); $name = Input::file('profile_pic')->getClientOriginalName();
$destinationPath = 'lb-faveo/dist/img'; $destinationPath = 'lb-faveo/dist/img';
$fileName = rand(0000, 9999) . '.' . $name; $fileName = rand(0000, 9999) . '.' . $name;
//echo $fileName; //echo $fileName;
Input::file('profile_pic')->move($destinationPath, $fileName); Input::file('profile_pic')->move($destinationPath, $fileName);
$user->profile_pic = $fileName; $user->profile_pic = $fileName;
} else { } else {
$user->fill($request->except('profile_pic', 'gender'))->save(); $user->fill($request->except('profile_pic', 'gender'))->save();
return redirect()->back()->with('success1', 'Profile Updated sucessfully'); return redirect()->back()->with('success1', 'Profile Updated sucessfully');
} }
if ($user->fill($request->except('profile_pic'))->save()) { if ($user->fill($request->except('profile_pic'))->save()) {
return redirect('profile')->with('success1', 'Profile Updated sucessfully'); return redirect('profile')->with('success1', 'Profile Updated sucessfully');
} else { } else {
return redirect('profile')->with('fails1', 'Profile Not Updated sucessfully'); return redirect('profile')->with('fails1', 'Profile Not Updated sucessfully');
} }
} }
/**
* post profile password
* @param type $id
* @param type ProfilePassword $request
* @return type redirect
*/
public function postProfilePassword($id, ProfilePassword $request) { public function postProfilePassword($id, ProfilePassword $request) {
$user = Auth::user(); $user = Auth::user();
//echo $user->password; //echo $user->password;
@@ -299,81 +269,12 @@ class SettingsController extends Controller {
return redirect('profile')->with('fails2', 'Old password Wrong'); return redirect('profile')->with('fails2', 'Old password Wrong');
} }
}
/**
* To delete the logo
* @param type $id
* @param type Settings $setting
* @return type
*/
public function deleteLogo($id, Settings $setting) {
$setting = $setting->whereId($id)->first();
$setting->logo = '';
$setting->save();
return redirect('settings')->with('success', 'Settings Updated Successfully');
}
public function deleteBackground($id, Settings $setting) {
$setting = $setting->whereId($id)->first();
$setting->background = '';
$setting->save();
return redirect('settings')->with('success', 'Settings Updated Successfully');
} }
/** /**
* Get the View of create Side widget page * het locale for language
* @param type Side1 $side * @return type config set
* @return View
*/ */
public function side1(Side1 $side) {
$side = $side->where('id', '1')->first();
return view('themes.default1.agent.kb.settings.side1', compact('side'));
}
/**
* Post function of Side1 Page
* @param type $id
* @param type Side1 $side
* @param type Request $request
* @return view
*/
public function postside1($id, Side1 $side, Request $request) {
$side = $side->whereId($id)->first();
if ($side->fill($request->input())->save()) {
return redirect('side1')->with('success', 'Side Widget 1 Created !');
} else {
return redirect('side1')->with('fails', 'Whoops ! Something went Wrong ! ');
}
}
/**
* Get the View for side widget creat
* @param type Side2 $side
* @return type
*/
public function side2(Side2 $side) {
$side = $side->where('id', '1')->first();
return view('themes.default1.agent.kb.settings.side2', compact('side'));
}
/**
* Post functio for side
* @param type $id
* @param type Side2 $side
* @param type Request $request
* @return response
*/
public function postside2($id, Side2 $side, Request $request) {
$side = $side->whereId($id)->first();
if ($side->fill($request->input())->save()) {
return redirect('side2')->with('success', 'Side Widget 2 Created !');
} else {
return redirect('side2')->with('fails', 'Whoops ! Something went Wrong ! ');
}
}
static function language() { static function language() {
// $set = Settings::whereId(1)->first(); // $set = Settings::whereId(1)->first();
// $lang = $set->language; // $lang = $set->language;

View File

@@ -1,24 +1,22 @@
<?php namespace App\Http\Controllers\Auth; <?php namespace App\Http\Controllers\Auth;
// controllers // controllers
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Http\Controllers\Common\SettingsController; use App\Http\Controllers\Common\SettingsController;
// requests // requests
use App\Http\Requests\helpdesk\LoginRequest; use App\Http\Requests\helpdesk\LoginRequest;
use App\Http\Requests\helpdesk\RegisterRequest; use App\Http\Requests\helpdesk\RegisterRequest;
use App\User; use App\User;
// classes // classes
/* include User Model */
use Hash; use Hash;
/* Include RegisterRequest */
use Illuminate\Contracts\Auth\Guard; use Illuminate\Contracts\Auth\Guard;
/* Register validation */
use Illuminate\Contracts\Auth\Registrar; use Illuminate\Contracts\Auth\Registrar;
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers; use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;
/* Include login validator */
use Mail; use Mail;
use Auth; use Auth;
// Model use Exception;
// use App\Model\helpdesk\Utility\Limit_Login;
/** /**
* --------------------------------------------------- * ---------------------------------------------------
@@ -58,8 +56,6 @@ class AuthController extends Controller {
$this->middleware('guest', ['except' => 'getLogout']); $this->middleware('guest', ['except' => 'getLogout']);
} }
/** /**
* Get the form for registration * Get the form for registration
* @return type Response * @return type Response
@@ -78,7 +74,6 @@ class AuthController extends Controller {
} }
} }
/** /**
* Post registration form * Post registration form
* @param type User $user * @param type User $user
@@ -148,26 +143,19 @@ class AuthController extends Controller {
* @return type Response * @return type Response
*/ */
public function postLogin(LoginRequest $request) { public function postLogin(LoginRequest $request) {
// Set login attempts and login time // Set login attempts and login time
$loginAttempts = 1; $loginAttempts = 1;
$credentials = $request->only('email', 'password'); $usernameinput = $request->input('email');
$password = $request->input('password');
$email = $request->email; $field = filter_var($usernameinput, FILTER_VALIDATE_EMAIL) ? 'email' : 'user_name';
// $ip_address = $_SERVER['REMOTE_ADDR'];
// $limit_login = Limit_Login::where('email' , '=' , $email)->where('ip_address', '=', $ip_address)->first();
// if(isset($limit_login)) {
// }
// If session has login attempts, retrieve attempts counter and attempts time // If session has login attempts, retrieve attempts counter and attempts time
if (\Session::has('loginAttempts')) { if (\Session::has('loginAttempts')) {
$loginAttempts = \Session::get('loginAttempts'); $loginAttempts = \Session::get('loginAttempts');
$loginAttemptTime = \Session::get('loginAttemptTime'); $loginAttemptTime = \Session::get('loginAttemptTime');
$credentials = $request->only('email', 'password'); // $credentials = $request->only('email', 'password');
$usernameinput = $request->input('email');
$password = $request->input('password');
$field = filter_var($usernameinput, FILTER_VALIDATE_EMAIL) ? 'email' : 'user_name';
// If attempts > 3 and time < 10 minutes // If attempts > 3 and time < 10 minutes
if ($loginAttempts > 4 && (time() - $loginAttemptTime <= 600)) { if ($loginAttempts > 4 && (time() - $loginAttemptTime <= 600)) {
return redirect()->back()->with('error', 'Maximum login attempts reached. Try again in a while'); return redirect()->back()->with('error', 'Maximum login attempts reached. Try again in a while');
@@ -177,14 +165,13 @@ class AuthController extends Controller {
\Session::put('loginAttempts', 1); \Session::put('loginAttempts', 1);
\Session::put('loginAttemptTime', time()); \Session::put('loginAttemptTime', time());
} }
} else // If no login attempts stored, init login attempts and time } else { // If no login attempts stored, init login attempts and time
{
\Session::put('loginAttempts', $loginAttempts); \Session::put('loginAttempts', $loginAttempts);
\Session::put('loginAttemptTime', time()); \Session::put('loginAttemptTime', time());
} }
// If auth ok, redirect to restricted area // If auth ok, redirect to restricted area
\Session::put('loginAttempts', $loginAttempts + 1); \Session::put('loginAttempts', $loginAttempts + 1);
if ($this->auth->attempt($credentials, $request->has('remember'))) { if ($this->auth->attempt([$field => $usernameinput, 'password' => $password], $request->has('remember'))) {
if(Auth::user()->role == 'user') { if(Auth::user()->role == 'user') {
return \Redirect::route('/'); return \Redirect::route('/');
} else { } else {
@@ -208,100 +195,4 @@ class AuthController extends Controller {
return 'This Field do not match our records.'; return 'This Field do not match our records.';
} }
// public function postLogin(LoginRequest $request) {
// $email = $request->input('email');
// $counter = 0;
// $user = User::where('email','=',$email)->first();
// if($user) {
// if($user->active == 1) {
// $credentials = $request->only('email', 'password');
// while($counter < 10) {
// if($this->auth->attempt($credentials) === false) {
// $counter++;
// }
// }
// if ($this->auth->attempt($credentials, $request->has('remember'))) {
// if(Auth::user()) {
// if(Auth::user()->role == 'vendor') {
// return \Redirect::route('vendors.index');
// } elseif(Auth::user()->role == 'admin') {
// return \Redirect::route('admin.dashboard');
// } elseif(Auth::user()->role == 'sadmin') {
// return \Redirect::route('sadmin.dashboard');
// } else {
// return redirect()->intended($this->redirectPath());
// }
// } else {
// return redirect()->back()->with('message','Account Inactive, Please wait for Admin to approve.');
// }
// }
// } else {
// return redirect()->back()->with('message','Account Inactive, Please wait for Admin to approve.');
// }
// }
// return redirect($this->loginPath())
// ->withInput($request->only('email', 'remember'))
// ->withErrors(['email' => $this->getFailedLoginMessage(), 'password' => $this->getFailedLoginMessage(), ]);
// }
// public function authenticate() {
// // Set login attempts and login time
// $loginAttempts = 1;
// // If session has login attempts, retrieve attempts counter and attempts time
// if (Session::has('loginAttempts')) {
// $loginAttempts = Session::get('loginAttempts');
// $loginAttemptTime = Session::get('loginAttemptTime');
// // If attempts > 3 and time < 10 minutes
// if ($loginAttempts > 3 && (time() - $loginAttemptTime <= 600)) {
// return redirect()-back()->with('error', 'maximum login attempts reached. Try again in a while');
// }
// // If time > 10 minutes, reset attempts counter and time in session
// if (time() - $loginAttemptTime > 600) {
// Session::put('loginAttempts', 1);
// Session::put('loginAttemptTime', time());
// }
// } else // If no login attempts stored, init login attempts and time
// {
// Session::put('loginAttempts', $loginAttempts);
// Session::put('loginAttemptTime', time());
// }
// // If auth ok, redirect to restricted area
// if (Auth::attempt(['email' => 'someone@example.com'])) {
// return redirect()->intended('dashboard');
// }
// // Increment login attempts
// Session::put('loginAttempts', $loginAttempts + 1);
// }
// public function postLogin(LoginRequest $request) {
// // $email = $request->input('email');
// // $password = Hash::make($request->input('password'));
// // $remember = $request->input('remember');
// // dd([$email,$password,$remember]);
// $credentials = $request->only('email', 'password');
// if ($this->auth->attempt($credentials, $request->has('remember'))) {
// if(Auth::user()->role == 'user') {
// return \Redirect::route('home');
// } else {
// return redirect()->intended($this->redirectPath());
// }
// }
// return redirect($this->loginPath())
// ->withInput($request->only('email', 'remember'))
// ->withErrors([
// 'email' => $this->getFailedLoginMessage(),
// 'password' => $this->getFailedLoginMessage(),
// ]);
// }
} }

View File

@@ -1,17 +1,20 @@
<?php namespace App\Http\Controllers\Auth; <?php namespace App\Http\Controllers\Auth;
// classes // controllers
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Http\Controllers\Common\SettingsController;
// request
use Illuminate\Http\Request; use Illuminate\Http\Request;
// model
use App\User;
// classes
use Illuminate\Contracts\Auth\Guard; use Illuminate\Contracts\Auth\Guard;
use Illuminate\Contracts\Auth\PasswordBroker; use Illuminate\Contracts\Auth\PasswordBroker;
use Illuminate\Foundation\Auth\ResetsPasswords; use Illuminate\Foundation\Auth\ResetsPasswords;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Exception;
use App\User;
use App\Http\Controllers\Common\SettingsController;
/** /**
* PasswordController * PasswordController
@@ -44,8 +47,7 @@ class PasswordController extends Controller {
* *
* @return Response * @return Response
*/ */
public function getEmail() public function getEmail() {
{
return view('auth.password'); return view('auth.password');
} }

View File

@@ -1,8 +1,10 @@
<?php namespace App\Http\Controllers\Client\helpdesk; <?php namespace App\Http\Controllers\Client\helpdesk;
// controllers // controllers
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Http\Controllers\Agent\helpdesk\TicketController; use App\Http\Controllers\Agent\helpdesk\TicketController;
use App\Http\Controllers\Common\SettingsController; use App\Http\Controllers\Common\SettingsController;
// requests // requests
use Illuminate\Http\Request; use Illuminate\Http\Request;
use App\Http\Requests\helpdesk\CreateTicketRequest; use App\Http\Requests\helpdesk\CreateTicketRequest;
@@ -22,12 +24,14 @@ use App\Model\helpdesk\Ticket\Ticket_Status;
use App\Model\helpdesk\Email\Emails; use App\Model\helpdesk\Email\Emails;
use App\Model\helpdesk\Agent\Department; use App\Model\helpdesk\Agent\Department;
use App\User; use App\User;
// classes // classes
use Auth; use Auth;
use Hash; use Hash;
use Input; use Input;
use Mail; use Mail;
use PDF; use PDF;
use Exception;
/** /**
* TicketController2 * TicketController2
@@ -67,18 +71,25 @@ class ClientTicketController extends Controller {
$comment = $request->input('comment'); $comment = $request->input('comment');
if($comment != null) { if($comment != null) {
$tickets = Tickets::where('id','=',$id)->first(); $tickets = Tickets::where('id','=',$id)->first();
$tickets->closed_at = null;
$tickets->closed = 0;
$tickets->reopened_at = date('Y-m-d H:i:s');
$tickets->reopened = 1;
$threads = new Ticket_Thread; $threads = new Ticket_Thread;
$threads->user_id = Auth::user()->id; $threads->user_id = Auth::user()->id;
$threads->ticket_id = $tickets->id; $threads->ticket_id = $tickets->id;
$threads->poster = "client"; $threads->poster = "client";
$threads->body = $comment; $threads->body = $comment;
$threads->save(); try {
return \Redirect::back()->with('success1','Successfully replied'); $threads->save();
$tickets->save();
return \Redirect::back()->with('success1','Successfully replied');
} catch(Exception $e) {
return \Redirect::back()->with('fails1',$e->errorInfo[2]);
}
} else { } else {
return \Redirect::back()->with('fails1','Please fill some data!'); return \Redirect::back()->with('fails1','Please fill some data!');
} }
} }
} }

View File

@@ -1,9 +1,13 @@
<?php namespace App\Http\Controllers\Client\helpdesk; <?php namespace App\Http\Controllers\Client\helpdesk;
// controllers // controllers
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
// models // models
use App\Model\helpdesk\Email\Emails; use App\Model\helpdesk\Email\Emails;
// classes
use Exception;
/** /**
* EmailController * EmailController
@@ -23,7 +27,6 @@ class OuthouseController extends Controller {
{ {
$port = Emails::where('id','=','1')->first(); $port = Emails::where('id','=','1')->first();
$portvalue = $port->option_value; $portvalue = $port->option_value;
return $portvalue; return $portvalue;
} }
@@ -36,7 +39,6 @@ class OuthouseController extends Controller {
{ {
$host=Option::where('option_name','=','host')->first(); $host=Option::where('option_name','=','host')->first();
$hostvalue=$host->option_value; $hostvalue=$host->option_value;
return $hostvalue; return $hostvalue;
} }

View File

@@ -1,21 +1,18 @@
<?php namespace App\Http\Controllers\Client\helpdesk; <?php namespace App\Http\Controllers\Client\helpdesk;
// controllers // controllers
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Http\Controllers\Agent\helpdesk\TicketController; use App\Http\Controllers\Agent\helpdesk\TicketController;
use App\Http\Controllers\Common\SettingsController; use App\Http\Controllers\Common\SettingsController;
// requests // requests
use Illuminate\Http\Request; use Illuminate\Http\Request;
use App\Http\Requests\helpdesk\ClientRequest; use App\Http\Requests\helpdesk\ClientRequest;
// models // models
/* include help topic model */ use App\Model\helpdesk\Form\Forms;
use App\Model\helpdesk\Form\Form_details;
/* Include form_name model */
use App\Model\helpdesk\Form\Form_name;
/* include form_detals model */
/* Include form_value model */
use App\Model\helpdesk\Manage\Help_topic; use App\Model\helpdesk\Manage\Help_topic;
use App\Model\helpdesk\Settings\Company; use App\Model\helpdesk\Settings\Company;
/* Validate form TicketForm using */
use App\Model\helpdesk\Ticket\Tickets; use App\Model\helpdesk\Ticket\Tickets;
use App\Model\helpdesk\Ticket\Ticket_Thread; use App\Model\helpdesk\Ticket\Ticket_Thread;
use App\Model\helpdesk\Settings\System; use App\Model\helpdesk\Settings\System;
@@ -23,6 +20,9 @@ use App\Model\helpdesk\Settings\Ticket;
use App\Model\helpdesk\Agent\Department; use App\Model\helpdesk\Agent\Department;
use App\Model\helpdesk\Ticket\Ticket_source; use App\Model\helpdesk\Ticket\Ticket_source;
use App\User; use App\User;
use App\Model\helpdesk\Form\Fields;
use App\Model\helpdesk\Form\Form_value;
// classes // classes
use Form; use Form;
use Input; use Input;
@@ -30,12 +30,9 @@ use Mail;
use Hash; use Hash;
use Redirect; use Redirect;
use Config; use Config;
use DateTime; use DateTime;
use DateTimeZone; use DateTimeZone;
use App\Model\helpdesk\Form\Fields; use Exception;
use App\Model\helpdesk\Form\Form_value;
/** /**
* FormController * FormController
@@ -46,29 +43,18 @@ use App\Model\helpdesk\Form\Form_value;
*/ */
class FormController extends Controller { class FormController extends Controller {
/**
* Create a new controller instance.
* Constructor to check
* @return void
*/
public function __construct(TicketController $TicketController) { public function __construct(TicketController $TicketController) {
// mail smtp settings
SettingsController::smtp(); SettingsController::smtp();
// creating a TicketController instance
$this->TicketController = $TicketController; $this->TicketController = $TicketController;
} }
// /**
// * This Function to get the form for the ticket
// * @param type Form_name $name
// * @param type Form_details $details
// * @param type Help_topic $topics
// * @return type Response
// */
// public function getForm() {
// if(Config::get('database.install') == '%0%') {
// return Redirect::route('license');
// }
// if(System::first()->status == 1) {
// return view('themes.default1.client.helpdesk.guest-user.form');
// } else {
// return "hello";
// }
// }
/** /**
* getform * getform
* @param type Help_topic $topic * @param type Help_topic $topic
@@ -92,7 +78,7 @@ class FormController extends Controller {
* @param type Form_details $details * @param type Form_details $details
* @return type string * @return type string
*/ */
public function postForm($id,Form_name $name, Form_details $details, Help_topic $topic) { public function postForm($id, Help_topic $topic) {
// dd($id); // dd($id);
if($id != 0 ){ if($id != 0 ){
$helptopic = $topic->where('id', '=', $id)->first(); $helptopic = $topic->where('id', '=', $id)->first();
@@ -163,8 +149,9 @@ class FormController extends Controller {
$source = $ticket_source->where('name','=','web')->first(); $source = $ticket_source->where('name','=','web')->first();
$collaborator = null; $collaborator = null;
$assignto = null;
if($this->TicketController->create_user($email, $name, $subject, $details, $phone, $helptopic, $sla, $priority, $source->id, $collaborator, $department,$assignto = "", $form_extras)) { 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'); return Redirect::route('guest.getform')->with('success','Ticket Created Successfully');
} }
} }
@@ -181,12 +168,21 @@ class FormController extends Controller {
if($comment != null) { if($comment != null) {
$tickets = Tickets::where('id','=',$id)->first(); $tickets = Tickets::where('id','=',$id)->first();
$threads = new Ticket_Thread; $threads = new Ticket_Thread;
$tickets->closed_at = null;
$tickets->closed = 0;
$tickets->reopened_at = date('Y-m-d H:i:s');
$tickets->reopened = 1;
$threads->user_id = $tickets->user_id; $threads->user_id = $tickets->user_id;
$threads->ticket_id = $tickets->id; $threads->ticket_id = $tickets->id;
$threads->poster = "client"; $threads->poster = "client";
$threads->body = $comment; $threads->body = $comment;
$threads->save(); try {
return \Redirect::back()->with('success1','Successfully replied'); $threads->save();
$tickets->save();
return \Redirect::back()->with('success1','Successfully replied');
} catch(Exception $e) {
return \Redirect::back()->with('fails1',$e->errorInfo[2]);
}
} else { } else {
return \Redirect::back()->with('fails1','Please fill some data!'); return \Redirect::back()->with('fails1','Please fill some data!');
} }

View File

@@ -1,12 +1,15 @@
<?php namespace App\Http\Controllers\Client\helpdesk; <?php namespace App\Http\Controllers\Client\helpdesk;
// controllers // controllers
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Http\Controllers\Common\SettingsController; use App\Http\Controllers\Common\SettingsController;
// requests // requests
use App\Http\Requests\helpdesk\CheckTicket; use App\Http\Requests\helpdesk\CheckTicket;
use App\Http\Requests\helpdesk\ProfilePassword; use App\Http\Requests\helpdesk\ProfilePassword;
use App\Http\Requests\helpdesk\ProfileRequest; use App\Http\Requests\helpdesk\ProfileRequest;
use App\Http\Requests\helpdesk\TicketRequest; use App\Http\Requests\helpdesk\TicketRequest;
// models // models
use App\Model\helpdesk\Manage\Help_topic; use App\Model\helpdesk\Manage\Help_topic;
use App\Model\helpdesk\Ticket\Tickets; use App\Model\helpdesk\Ticket\Tickets;
@@ -14,10 +17,12 @@ use App\Model\helpdesk\Ticket\Ticket_Thread;
use App\Model\helpdesk\Settings\Company; use App\Model\helpdesk\Settings\Company;
use App\Model\helpdesk\Settings\System; use App\Model\helpdesk\Settings\System;
use App\User; use App\User;
// classes // classes
use Auth; use Auth;
use Hash; use Hash;
use Input; use Input;
use Exception;
/** /**
* GuestController * GuestController
@@ -32,10 +37,11 @@ class GuestController extends Controller {
* Create a new controller instance. * Create a new controller instance.
* @return type void * @return type void
*/ */
public function __construct() { public function __construct() {
SettingsController::smtp(); SettingsController::smtp();
// checking authentication
$this->middleware('auth'); $this->middleware('auth');
// $this->middleware('role.user');
} }
/** /**
@@ -160,8 +166,12 @@ class GuestController extends Controller {
//echo $user->password; //echo $user->password;
if (Hash::check($request->input('old_password'), $user->getAuthPassword())) { if (Hash::check($request->input('old_password'), $user->getAuthPassword())) {
$user->password = Hash::make($request->input('new_password')); $user->password = Hash::make($request->input('new_password'));
$user->save(); try{
return redirect()->back()->with('success2', 'Password Updated sucessfully'); $user->save();
return redirect()->back()->with('success2', 'Password Updated sucessfully');
} catch (Exception $e) {
return redirect()->back()->with('fails2', $e->errorInfo[2]);
}
} else { } else {
return redirect()->back()->with('fails2', 'Password was not Updated. Incorrect old password'); return redirect()->back()->with('fails2', 'Password was not Updated. Incorrect old password');
} }

View File

@@ -6,6 +6,7 @@ use App\Model\helpdesk\Settings\System;
// classes // classes
use Config; use Config;
use Redirect; use Redirect;
use Exception;
/** /**
* OuthouseController * OuthouseController

View File

@@ -20,6 +20,7 @@ use Mail;
use Auth; use Auth;
use Redirect; use Redirect;
use Hash; use Hash;
use Exception;
class UserController extends Controller { class UserController extends Controller {

View File

@@ -6,18 +6,16 @@ use Illuminate\Http\Request;
use App\Http\Requests\helpdesk\SmtpRequest; use App\Http\Requests\helpdesk\SmtpRequest;
use App\Http\Requests; use App\Http\Requests;
// models // models
use App\Model\helpdesk\Theme\Footer2; use App\Model\helpdesk\Theme\Widgets;
use App\Model\helpdesk\Theme\Footer3;
use App\Model\helpdesk\Theme\Footer4;
use App\Model\helpdesk\Theme\Footer;
use App\Model\helpdesk\Email\Smtp; use App\Model\helpdesk\Email\Smtp;
use App\Model\helpdesk\Utility\Version_Check; use App\Model\helpdesk\Utility\Version_Check;
use App\Model\helpdesk\Settings\Plugin;
// classes // classes
use Config; use Config;
use Input; use Input;
use Crypt; use Crypt;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use App\Model\helpdesk\Settings\Plugin; use Exception;
/** /**
* *************************** * ***************************
@@ -45,13 +43,144 @@ class SettingsController extends Controller {
SettingsController::password(); SettingsController::password();
} }
/** /**
* get the page to create the footer * get the page to create the footer
* @return response * @return response
*/ */
public function CreateFooter(Footer $footer) { public function widgets() {
$footer = $footer->whereId('1')->first(); return view('themes.default1.admin.helpdesk.theme.widgets');
return view('themes.default1.admin.helpdesk.theme.footer', compact('footer')); }
/**
* get the page to create the footer
* @return response
*/
public function list_widget() {
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 .'">
<div class="modal-dialog">
<div class="modal-content">
<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">&times;</span></button>
<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%">
</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>
</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').'">
</div>
<script>
$(function () {
$("#Content'. $model->id .'").wysihtml5();
});
</script>
</form>
</div>
</div>
</div>';
})
->make();
}
/**
* Post footer
* @param type Footer $footer
* @param type Request $request
* @return type response
*/
public function edit_widget($id, Widgets $widgets, Request $request) {
$widget = $widgets->where('id','=',$id)->first();
$widget->title = $request->title;
$widget->value = $request->content;
try{
$widget->save();
return redirect()->back()->with('success', $widget->name.' Saved Successfully');
} catch(Exception $e) {
return redirect()->back()->with('fails', $e->errorInfo[2]);
}
}
/**
* get the page to create the footer
* @return response
*/
public function social_buttons() {
return view('themes.default1.admin.helpdesk.theme.social');
}
/**
* get the page to create the footer
* @return response
*/
public function list_social_buttons() {
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 .'">
<div class="modal-dialog">
<div class="modal-content">
<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">&times;</span></button>
<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.'">
</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').'">
</div>
</form>
</div>
</div>
</div>';
})
->make();
} }
/** /**
@@ -60,84 +189,15 @@ class SettingsController extends Controller {
* @param type Request $request * @param type Request $request
* @return type response * @return type response
*/ */
public function PostFooter(Footer $footer, Request $request) { public function edit_social_buttons($id, Widgets $widgets, Request $request) {
$footer = $footer->whereId('1')->first(); $widget = $widgets->where('id','=',$id)->first();
if ($footer->fill($request->input())->save()) { $widget->title = $request->title;
return redirect('create-footer')->with('success', 'Footer Saved Successfully'); $widget->value = $request->content;
} else { try{
return redirect('create-footer')->with('fails', 'Footer was not Saved'); $widget->save();
} return redirect()->back()->with('success', $widget->name.' Saved Successfully');
} } catch (Exception $e) {
return redirect()->back()->with('fails',$e->errorInfo[2]);
/**
* get the page to create the footer
* @return response
*/
public function CreateFooter2(Footer2 $footer2) {
$footer2 = $footer2->whereId('1')->first();
return view('themes.default1.admin.helpdesk.theme.footer2', compact('footer2'));
}
/**
* Post footer 2
* @param type Footer $footer
* @param type Request $request
* @return type response
*/
public function PostFooter2(Footer2 $footer2, Request $request) {
$footer2 = $footer2->whereId('1')->first();
if ($footer2->fill($request->input())->save()) {
return redirect('create-footer2')->with('success', 'Footer Saved Successfully');
} else {
return redirect('create-footer2')->with('fails', 'Footer was not Saved');
}
}
/**
* get the page to create the footer
* @return response
*/
public function CreateFooter3(Footer3 $footer3) {
$footer3 = $footer3->whereId('1')->first();
return view('themes.default1.admin.helpdesk.theme.footer3', compact('footer3'));
}
/**
* Post footer 3
* @param type Footer $footer
* @param type Request $request
* @return type response
*/
public function PostFooter3(Footer3 $footer3, Request $request) {
$footer3 = $footer3->whereId('1')->first();
if ($footer3->fill($request->input())->save()) {
return redirect('create-footer3')->with('success', 'Footer Saved Successfully');
} else {
return redirect('create-footer3')->with('fails', 'Footer was not Saved');
}
}
/**
* get the page to create the footer
* @return response
*/
public function CreateFooter4(Footer4 $footer4) {
$footer4 = $footer4->whereId('1')->first();
return view('themes.default1.admin.helpdesk.theme.footer4', compact('footer4'));
}
/**
* Post footer 4
* @param type Footer $footer
* @param type Request $request
* @return type response
*/
public function PostFooter4(Footer4 $footer4, Request $request) {
$footer4 = $footer4->whereId('1')->first();
if ($footer4->fill($request->input())->save()) {
return redirect('create-footer4')->with('success', 'Footer Saved Successfully');
} else {
return redirect('create-footer4')->with('fails', 'Footer was not Saved');
} }
} }
@@ -236,10 +296,11 @@ class SettingsController extends Controller {
$data->name = $request->input('name'); $data->name = $request->input('name');
$data->email = $request->input('email'); $data->email = $request->input('email');
$data->password = Crypt::encrypt($request->input('password')); $data->password = Crypt::encrypt($request->input('password'));
if ($data->save()) { try{
$data->save();
return \Redirect::route('getsmtp')->with('success', 'success'); return \Redirect::route('getsmtp')->with('success', 'success');
} else { } catch (Exception $e) {
return \Redirect::route('getsmtp')->with('fails', 'fails'); return \Redirect::route('getsmtp')->with('fails', $e->errorInfo[2]);
} }
} }
@@ -282,7 +343,11 @@ class SettingsController extends Controller {
$pass = $request->input('password'); $pass = $request->input('password');
$password = Crypt::encrypt($pass); $password = Crypt::encrypt($pass);
$settings->password = $password; $settings->password = $password;
$settings->save(); try{
$settings->save();
} catch(Exception $e) {
return redirect()->back()->with('fails', $e->errorInfo[2]);
}
if (Input::file('logo')) { if (Input::file('logo')) {
$name = Input::file('logo')->getClientOriginalName(); $name = Input::file('logo')->getClientOriginalName();
$destinationPath = 'dist/logo'; $destinationPath = 'dist/logo';
@@ -291,8 +356,12 @@ class SettingsController extends Controller {
$settings->logo = $fileName; $settings->logo = $fileName;
$settings->save(); $settings->save();
} }
$settings->fill($request->except('logo', 'password'))->save(); try {
return redirect()->back()->with('success', 'Settings updated Successfully'); $settings->fill($request->except('logo', 'password'))->save();
return redirect()->back()->with('success', 'Settings updated Successfully');
} catch (Exception $e) {
return redirect()->back()->with('fails', $e->errorInfo[2]);
}
} }
/** /**
@@ -300,9 +369,7 @@ class SettingsController extends Controller {
* @return type * @return type
*/ */
public function version_check() { public function version_check() {
$response_url = \URL::route('post-version-check'); $response_url = \URL::route('post-version-check');
echo "<form action='http://www.faveohelpdesk.com/bill/version' method='post' name='redirect'>"; echo "<form action='http://www.faveohelpdesk.com/bill/version' method='post' name='redirect'>";
echo "<input type='hidden' name='_token' value='csrf_token()'/>"; echo "<input type='hidden' name='_token' value='csrf_token()'/>";
echo "<input type='hidden' name='title' value='helpdeskcommunityedition'/>"; echo "<input type='hidden' name='title' value='helpdeskcommunityedition'/>";
@@ -317,23 +384,20 @@ class SettingsController extends Controller {
* @return type * @return type
*/ */
public function post_version_check(Request $request) { public function post_version_check(Request $request) {
$current_version = \Config::get('app.version'); $current_version = \Config::get('app.version');
$new_version = $request->value; $new_version = $request->value;
if ($current_version == $new_version) { if ($current_version == $new_version) {
// echo "No, new Updates"; // echo "No, new Updates";
return redirect()->route('checkupdate')->with('info', ' No, new Updates'); return redirect()->route('checkupdate')->with('info', ' No, new Updates');
} elseif ($current_version < $new_version) { } elseif ($current_version < $new_version) {
$version = Version_Check::where('id', '=', '1')->first(); $version = Version_Check::where('id', '=', '1')->first();
$version->current_version = $current_version; $version->current_version = $current_version;
$version->new_version = $new_version; $version->new_version = $new_version;
$version->save(); $version->save();
// echo "Version " . $new_version . " is Available"; // echo "Version " . $new_version . " is Available";
return redirect()->route('checkupdate')->with('info', ' Version ' . $new_version . ' is Available'); return redirect()->route('checkupdate')->with('info', ' Version ' . $new_version . ' is Available');
} else { } else {
// echo "Error Checking Version"; // echo "Error Checking Version";
return redirect()->route('checkupdate')->with('info', ' Error Checking Version'); return redirect()->route('checkupdate')->with('info', ' Error Checking Version');
} }
} }
@@ -348,8 +412,6 @@ class SettingsController extends Controller {
public function GetPlugin() { public function GetPlugin() {
$plugins = $this->fetchConfig(); $plugins = $this->fetchConfig();
//dd($plugins);
return \Datatable::collection(new Collection($plugins)) return \Datatable::collection(new Collection($plugins))
->searchColumns('name') ->searchColumns('name')
@@ -420,14 +482,11 @@ class SettingsController extends Controller {
*/ */
public function PostPlugins(Request $request) { public function PostPlugins(Request $request) {
$v = $this->validate($request, ['plugin' => 'required|mimes:application/zip,zip,Zip']); $v = $this->validate($request, ['plugin' => 'required|mimes:application/zip,zip,Zip']);
$plug = new Plugin(); $plug = new Plugin();
$file = $request->file('plugin'); $file = $request->file('plugin');
//dd($file); //dd($file);
$destination = app_path() . '/Plugins'; $destination = app_path() . '/Plugins';
$zipfile = $file->getRealPath(); $zipfile = $file->getRealPath();
/** /**
* get the file name and remove .zip * get the file name and remove .zip
*/ */
@@ -498,28 +557,23 @@ class SettingsController extends Controller {
if (!file_exists($dir)) { if (!file_exists($dir)) {
return true; return true;
} }
if (!is_dir($dir)) { if (!is_dir($dir)) {
return unlink($dir); return unlink($dir);
} }
foreach (scandir($dir) as $item) { foreach (scandir($dir) as $item) {
if ($item == '.' || $item == '..') { if ($item == '.' || $item == '..') {
continue; continue;
} }
if (!$this->deleteDirectory($dir . DIRECTORY_SEPARATOR . $item)) { if (!$this->deleteDirectory($dir . DIRECTORY_SEPARATOR . $item)) {
return false; return false;
} }
} }
return rmdir($dir); return rmdir($dir);
} }
public function ReadConfigs() { public function ReadConfigs() {
$dir = app_path() . '/Plugins/'; $dir = app_path() . '/Plugins/';
$files = array_diff(scandir($dir), array('.', '..', 'ServiceProvider.php')); $files = array_diff(scandir($dir), array('.', '..', 'ServiceProvider.php'));
$plugins = array(); $plugins = array();
if ($files) { if ($files) {
foreach ($files as $key => $file) { foreach ($files as $key => $file) {
@@ -528,13 +582,10 @@ class SettingsController extends Controller {
$plugins[$key]['file'] = $plugin; $plugins[$key]['file'] = $plugin;
} }
foreach ($plugins as $plugin) { foreach ($plugins as $plugin) {
$dir = $plugin['file']; $dir = $plugin['file'];
//opendir($dir); //opendir($dir);
if ($dh = opendir($dir)) { if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) { while (($file = readdir($dh)) !== false) {
if ($file == 'config.php') { if ($file == 'config.php') {
$config[] = $dir . '/' . $file; $config[] = $dir . '/' . $file;
} }
@@ -542,7 +593,6 @@ class SettingsController extends Controller {
closedir($dh); closedir($dh);
} }
} }
return $config; return $config;
} else { } else {
return 'null'; return 'null';
@@ -562,9 +612,7 @@ class SettingsController extends Controller {
$fields[$key]['path'] = $plug[$key]['path']; $fields[$key]['path'] = $plug[$key]['path'];
$fields[$key]['status'] = $plug[$key]['status']; $fields[$key]['status'] = $plug[$key]['status'];
} }
//dd($fields);
} }
return $fields; return $fields;
} else { } else {
return array(); return array();
@@ -572,21 +620,16 @@ class SettingsController extends Controller {
} }
public function DeletePlugin($slug) { public function DeletePlugin($slug) {
$dir = app_path() . '/Plugins/' . $slug; $dir = app_path() . '/Plugins/' . $slug;
$this->deleteDirectory($dir); $this->deleteDirectory($dir);
/** /**
* remove service provider from app.php * remove service provider from app.php
*/ */
$str = "'App\\Plugins\\$slug" . "\\ServiceProvider',"; $str = "'App\\Plugins\\$slug" . "\\ServiceProvider',";
$path_to_file = base_path() . '/config/app.php'; $path_to_file = base_path() . '/config/app.php';
$file_contents = file_get_contents($path_to_file); $file_contents = file_get_contents($path_to_file);
$file_contents = str_replace($str, "//", $file_contents); $file_contents = str_replace($str, "//", $file_contents);
file_put_contents($path_to_file, $file_contents); file_put_contents($path_to_file, $file_contents);
$plugin = new Plugin(); $plugin = new Plugin();
$plugin = $plugin->where('path', $slug)->first(); $plugin = $plugin->where('path', $slug)->first();
$plugin->delete(); $plugin->delete();

View File

@@ -1,12 +1,16 @@
<?php namespace App\Http\Controllers\Installer\helpdesk; <?php namespace App\Http\Controllers\Installer\helpdesk;
// controllers // controllers
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
// requests // requests
use App\Http\Requests\helpdesk\InstallerRequest; use App\Http\Requests\helpdesk\InstallerRequest;
// models // models
use App\User; use App\User;
use App\Model\helpdesk\Settings\System; use App\Model\helpdesk\Settings\System;
use App\Model\helpdesk\Form\Form_details; use App\Model\helpdesk\Form\Form_details;
// classes // classes
use App; use App;
use Artisan; use Artisan;
@@ -17,6 +21,7 @@ use Input;
use Redirect; use Redirect;
use Session; use Session;
use View; use View;
use Exception;
/** /**
* |======================================================================= * |=======================================================================
@@ -38,9 +43,11 @@ class InstallController extends Controller {
* @return type view * @return type view
*/ */
public function licence() { public function licence() {
// checking if the installation is running for the first time or not
if (Session::get('step5') == 'step5') { if (Session::get('step5') == 'step5') {
return Redirect::route('account'); return Redirect::route('account');
} }
// checking if the installation is running for the first time or not
if (Config::get('database.install') == '%0%') { if (Config::get('database.install') == '%0%') {
return view('themes/default1/installer/helpdesk/view1'); return view('themes/default1/installer/helpdesk/view1');
} else { } else {
@@ -54,6 +61,7 @@ class InstallController extends Controller {
* @return type view * @return type view
*/ */
public function licencecheck() { public function licencecheck() {
// checking if the user have accepted the licence agreement
$accept = (Input::has('accept1')) ? true : false; $accept = (Input::has('accept1')) ? true : false;
if ($accept == 'accept') { if ($accept == 'accept') {
Session::put('step1', 'step1'); Session::put('step1', 'step1');
@@ -72,9 +80,11 @@ class InstallController extends Controller {
* @return type view * @return type view
*/ */
public function prerequisites() { public function prerequisites() {
// checking if the installation is running for the first time or not
if (Session::get('step5') == 'step5') { if (Session::get('step5') == 'step5') {
return Redirect::route('account'); return Redirect::route('account');
} }
// checking if the installation is running for the first time or not
if (Config::get('database.install') == '%0%') { if (Config::get('database.install') == '%0%') {
if (Session::get('step1') == 'step1') { if (Session::get('step1') == 'step1') {
return View::make('themes/default1/installer/helpdesk/view2'); return View::make('themes/default1/installer/helpdesk/view2');
@@ -102,9 +112,11 @@ class InstallController extends Controller {
* @return type view * @return type view
*/ */
public function localization() { public function localization() {
// checking if the installation is running for the first time or not
if (Session::get('step5') == 'step5') { if (Session::get('step5') == 'step5') {
return Redirect::route('account'); return Redirect::route('account');
} }
// checking if the installation is running for the first time or not
if (Config::get('database.install') == '%0%') { if (Config::get('database.install') == '%0%') {
if (Session::get('step2') == 'step2') { if (Session::get('step2') == 'step2') {
return View::make('themes/default1/installer/helpdesk/view3'); return View::make('themes/default1/installer/helpdesk/view3');
@@ -139,9 +151,11 @@ class InstallController extends Controller {
* @return type view * @return type view
*/ */
public function configuration() { public function configuration() {
// checking if the installation is running for the first time or not
if (Session::get('step5') == 'step5') { if (Session::get('step5') == 'step5') {
return Redirect::route('account'); return Redirect::route('account');
} }
// checking if the installation is running for the first time or not
if (Config::get('database.install') == '%0%') { if (Config::get('database.install') == '%0%') {
if (Session::get('step2') == 'step2') { if (Session::get('step2') == 'step2') {
return View::make('themes/default1/installer/helpdesk/view3'); return View::make('themes/default1/installer/helpdesk/view3');
@@ -211,6 +225,7 @@ class InstallController extends Controller {
* @return type view * @return type view
*/ */
public function database() { public function database() {
// checking if the installation is running for the first time or not
if (Config::get('database.install') == '%0%') { if (Config::get('database.install') == '%0%') {
if (Session::get('step4') == 'step4') { if (Session::get('step4') == 'step4') {
return View::make('themes/default1/installer/helpdesk/view4'); return View::make('themes/default1/installer/helpdesk/view4');
@@ -228,6 +243,7 @@ class InstallController extends Controller {
* @return type view * @return type view
*/ */
public function account() { public function account() {
// checking if the installation is running for the first time or not
if (Config::get('database.install') == '%0%') { if (Config::get('database.install') == '%0%') {
if (Session::get('step4') == 'step4') { if (Session::get('step4') == 'step4') {
Session::put('step5', 'step5'); Session::put('step5', 'step5');
@@ -267,53 +283,24 @@ class InstallController extends Controller {
$date = $request->input('date'); $date = $request->input('date');
$datetime = $request->input('datetime'); $datetime = $request->input('datetime');
$system = System::where('id','=','1')->first(); // $system = System::where('id','=','1')->first();
$system->time_zone = $timezone; // $system->time_zone = $timezone;
$system->date_time_format = $datetime; // $system->date_time_format = $datetime;
$system->save(); // $system->save();
$form1 = new Form_details;
$form1->label = 'Name';
$form1->type = 'text';
$form1->form_name_id = '1';
$form1->save();
$form2 = new Form_details;
$form2->label = 'Phone';
$form2->type = 'number';
$form2->form_name_id = '1';
$form2->save();
$form3 = new Form_details;
$form3->label = 'Email';
$form3->type = 'text';
$form3->form_name_id = '1';
$form3->save();
$form4 = new Form_details;
$form4->label = 'Subject';
$form4->type = 'text';
$form4->form_name_id = '1';
$form4->save();
$form5 = new Form_details;
$form5->label = 'Details';
$form5->type = 'textarea';
$form5->form_name_id = '1';
$form5->save();
// creating an user
$user = User::create(array( $user = User::create(array(
'first_name' => $firstname, 'first_name' => $firstname,
'last_name' => $lastname, 'last_name' => $lastname,
'email' => $email, 'email' => $email,
'user_name' => $username, 'user_name' => $username,
'password' => Hash::make($password), 'password' => Hash::make($password),
'assign_group' => 1,
'primary_dpt' => 1,
'active' => 1, 'active' => 1,
'role' => 'admin', 'role' => 'admin',
'assign_group' => 'group A',
'primary_dpt' => 'support',
)); ));
// checking if the user have been created
if ($user) { if ($user) {
Session::put('step6', 'step6'); Session::put('step6', 'step6');
return Redirect::route('final'); return Redirect::route('final');
@@ -326,19 +313,19 @@ class InstallController extends Controller {
* @return type view * @return type view
*/ */
public function finalize() { public function finalize() {
// checking if the installation have been completed or not
if (Session::get('step6') == 'step6') { if (Session::get('step6') == 'step6') {
$value = '1'; $value = '1';
$install = app_path('../config/database.php'); $install = app_path('../config/database.php');
$datacontent = File::get($install); $datacontent = File::get($install);
$datacontent = str_replace('%0%', $value, $datacontent); $datacontent = str_replace('%0%', $value, $datacontent);
File::put($install, $datacontent); File::put($install, $datacontent);
// setting email settings in route
$smtpfilepath = "\App\Http\Controllers\Common\SettingsController::smtp()"; $smtpfilepath = "\App\Http\Controllers\Common\SettingsController::smtp()";
$path22 = app_path('Http/routes.php'); $path22 = app_path('Http/routes.php');
$content23 = File::get($path22); $content23 = File::get($path22);
$content23 = str_replace('"%smtplink%"', $smtpfilepath, $content23); $content23 = str_replace('"%smtplink%"', $smtpfilepath, $content23);
File::put($path22, $content23); File::put($path22, $content23);
try { try {
return View::make('themes/default1/installer/helpdesk/view6'); return View::make('themes/default1/installer/helpdesk/view6');
} catch (Exception $e) { } catch (Exception $e) {

View File

@@ -1,5 +1,4 @@
<?php <?php namespace App\Http\Middleware;
namespace App\Http\Middleware;
use Closure; use Closure;
/** /**

View File

@@ -29,7 +29,7 @@ class AgentRequest extends Request {
'first_name' => 'required', 'first_name' => 'required',
'last_name' => 'required', 'last_name' => 'required',
'email' => 'required', 'email' => 'required',
'account_type' => 'required', 'active' => 'required',
// 'account_status' => 'required', // 'account_status' => 'required',
'assign_group' => 'required', 'assign_group' => 'required',
'primary_dpt' => 'required', 'primary_dpt' => 'required',

View File

@@ -28,7 +28,7 @@ class AgentUpdate extends Request {
'first_name' => 'required', 'first_name' => 'required',
'last_name' => 'required', 'last_name' => 'required',
'email' => 'required|email', 'email' => 'required|email',
'account_type' => 'required', 'active' => 'required',
'role' => 'required', 'role' => 'required',
'assign_group' => 'required', 'assign_group' => 'required',
'primary_dpt' => 'required', 'primary_dpt' => 'required',

View File

@@ -25,7 +25,7 @@ class BanRequest extends Request {
*/ */
public function rules() { public function rules() {
return [ return [
'email' => 'required|email|unique:users', 'email' => 'required|email',
'ban' => 'required', 'ban' => 'required',
]; ];
} }

View File

@@ -32,7 +32,7 @@ class EmailsEditRequest extends Request {
'help_topic' => 'required', 'help_topic' => 'required',
// 'imap_config' => 'required', // 'imap_config' => 'required',
'password' => 'required|min:6', 'password' => 'required|min:6',
'user_name' => 'required', // 'user_name' => 'required',
// 'sending_host' => 'required', // 'sending_host' => 'required',
// 'sending_port' => 'required', // 'sending_port' => 'required',
//'mailbox_protocol' => 'required' //'mailbox_protocol' => 'required'

View File

@@ -32,7 +32,7 @@ class EmailsRequest extends Request {
'help_topic' => 'required', 'help_topic' => 'required',
// 'imap_config' => 'required', // 'imap_config' => 'required',
'password' => 'required|min:6', 'password' => 'required|min:6',
'user_name' => 'required', // 'user_name' => 'required',
// 'sending_host' => 'required', // 'sending_host' => 'required',
// 'sending_port' => 'required', // 'sending_port' => 'required',
'fetching_host' => 'required', 'fetching_host' => 'required',

View File

@@ -25,7 +25,7 @@ class LoginRequest extends Request {
*/ */
public function rules() { public function rules() {
return [ return [
'email' => 'required|email', 'email' => 'required',
'password' => 'required|min:6', 'password' => 'required|min:6',
]; ];
} }

View File

@@ -21,7 +21,7 @@ class ArticleRequest extends Request {
public function rules() { public function rules() {
return [ return [
'name' => 'required', 'name' => 'required',
'slug' => 'required|unique:article', 'slug' => 'required|unique:kb_article',
'description' => 'required', 'description' => 'required',
'category_id' => 'required', 'category_id' => 'required',
]; ];

View File

@@ -21,7 +21,7 @@ class CategoryRequest extends Request {
public function rules() { public function rules() {
return [ return [
'name' => 'required', 'name' => 'required',
'slug' => 'required|unique:category', 'slug' => 'required|unique:kb_category',
'description' => 'required', 'description' => 'required',
]; ];

View File

@@ -21,7 +21,7 @@ class PageRequest extends Request {
public function rules() { public function rules() {
return [ return [
'name' => 'required', 'name' => 'required',
'slug' => 'required|unique:pages', 'slug' => 'required|unique:kb_pages',
//'description' => 'required', //'description' => 'required',
]; ];

View File

@@ -111,22 +111,18 @@ Route::group(['middleware' => 'roles', 'middleware' => 'auth'], function () {
Route::patch('admin-profile-password', 'Admin\helpdesk\ProfileController@postProfilePassword');/* Admin Profile Password Post */ Route::patch('admin-profile-password', 'Admin\helpdesk\ProfileController@postProfilePassword');/* Admin Profile Password Post */
Route::get('create-footer', 'Common\SettingsController@CreateFooter');/* get the create footer page for admin */ Route::get('widgets', 'Common\SettingsController@widgets');/* get the create footer page for admin */
Route::get('list-widget', 'Common\SettingsController@list_widget');/* get the list widget page for admin */
Route::post('edit-widget/{id}', 'Common\SettingsController@edit_widget');/* get the create footer page for admin */
Route::get('social-buttons', 'Common\SettingsController@social_buttons');/* get the create footer page for admin */
Route::get('list-social-buttons', 'Common\SettingsController@list_social_buttons');/* get the list widget page for admin */
Route::post('edit-widget/{id}', 'Common\SettingsController@edit_social_buttons');/* get the create footer page for admin */
Route::patch('post-create-footer/{id}', 'Common\SettingsController@PostFooter');/* post footer to insert to database */
Route::get('create-footer2', 'Common\SettingsController@CreateFooter2');/* get the create footer page for admin */
Route::patch('post-create-footer2/{id}', 'Common\SettingsController@PostFooter2'); /* post footer to insert to database */
Route::get('create-footer3', 'Common\SettingsController@CreateFooter3'); /* get the create footer page for admin */
Route::patch('post-create-footer3/{id}', 'Common\SettingsController@PostFooter3'); /* post footer to insert to database */
Route::get('create-footer4', 'Common\SettingsController@CreateFooter4'); /* get the create footer page for admin */
Route::patch('post-create-footer4/{id}', 'Common\SettingsController@PostFooter4'); /* post footer to insert to database */
Route::get('getsmtp',['as'=>'getsmtp','uses'=>'Common\SettingsController@getsmtp']); /* get the create footer page for admin */ Route::get('getsmtp',['as'=>'getsmtp','uses'=>'Common\SettingsController@getsmtp']); /* get the create footer page for admin */
Route::patch('post-smtp',['as'=>'post_smtp','uses'=>'Common\SettingsController@postsmtp']); /* post footer to insert to database */ Route::patch('post-smtp',['as'=>'post_smtp','uses'=>'Common\SettingsController@postsmtp']); /* post footer to insert to database */
@@ -151,9 +147,6 @@ Route::group(['middleware' => 'roles', 'middleware' => 'auth'], function () {
Route::get('plugin/status/{slug}', array('as'=>'status.plugin', 'uses'=>'Common\SettingsController@StatusPlugin')); Route::get('plugin/status/{slug}', array('as'=>'status.plugin', 'uses'=>'Common\SettingsController@StatusPlugin'));
//Routes for showing language table and switching language //Routes for showing language table and switching language
Route::get('languages',['as'=>'LanguageController','uses'=>'Admin\helpdesk\LanguageController@index']); Route::get('languages',['as'=>'LanguageController','uses'=>'Admin\helpdesk\LanguageController@index']);
@@ -183,11 +176,15 @@ Route::group(['middleware' => 'roles', 'middleware' => 'auth'], function () {
*/ */
Route::group(['middleware' => 'role.agent', 'middleware' => 'auth'], function () { Route::group(['middleware' => 'role.agent', 'middleware' => 'auth'], function () {
Route::get('agen1', 'Agent\helpdesk\DashboardController@ChartData');
Route::post('chart-range', ['as' => 'post.chart', 'uses' => 'Agent\helpdesk\DashboardController@ChartData']);
Route::resource('user', 'Agent\helpdesk\UserController'); /* User router is used to control the CRUD of user */ Route::resource('user', 'Agent\helpdesk\UserController'); /* User router is used to control the CRUD of user */
Route::get('user-list', ['as' => 'user.list' , 'uses' => 'Agent\helpdesk\UserController@user_list']); Route::get('user-list', ['as' => 'user.list' , 'uses' => 'Agent\helpdesk\UserController@user_list']);
Route::get('user/delete/{id}', ['as' => 'user.delete' , 'uses' => 'Agent\helpdesk\UserController@destroy']); // Route::get('user/delete/{id}', ['as' => 'user.delete' , 'uses' => 'Agent\helpdesk\UserController@destroy']);
Route::resource('organizations', 'Agent\helpdesk\OrganizationController'); /* organization router used to deal CRUD function of organization */ Route::resource('organizations', 'Agent\helpdesk\OrganizationController'); /* organization router used to deal CRUD function of organization */
@@ -223,18 +220,30 @@ Route::group(['middleware' => 'role.agent', 'middleware' => 'auth'], function ()
Route::get('/ticket/inbox', ['as' => 'inbox.ticket', 'uses' => 'Agent\helpdesk\TicketController@inbox_ticket_list']); /* Get Inbox Ticket */ Route::get('/ticket/inbox', ['as' => 'inbox.ticket', 'uses' => 'Agent\helpdesk\TicketController@inbox_ticket_list']); /* Get Inbox Ticket */
Route::get('/ticket/get-inbox', ['as' => 'get.inbox.ticket', 'uses' => 'Agent\helpdesk\TicketController@get_inbox']); /* Get tickets in datatable */
Route::get('/ticket/open', ['as' => 'open.ticket', 'uses' => 'Agent\helpdesk\TicketController@open_ticket_list']); /* Get Open Ticket */ Route::get('/ticket/open', ['as' => 'open.ticket', 'uses' => 'Agent\helpdesk\TicketController@open_ticket_list']); /* Get Open Ticket */
Route::get('/ticket/get-open', ['as' => 'get.open.ticket', 'uses' => 'Agent\helpdesk\TicketController@get_open']); /* Get tickets in datatable */
Route::get('/ticket/answered', ['as' => 'answered.ticket', 'uses' => 'Agent\helpdesk\TicketController@answered_ticket_list']); /* Get Answered Ticket */ Route::get('/ticket/answered', ['as' => 'answered.ticket', 'uses' => 'Agent\helpdesk\TicketController@answered_ticket_list']); /* Get Answered Ticket */
Route::get('/ticket/get-answered', ['as' => 'get.answered.ticket', 'uses' => 'Agent\helpdesk\TicketController@get_answered']); /* Get tickets in datatable */
Route::get('/ticket/myticket', ['as' => 'myticket.ticket', 'uses' => 'Agent\helpdesk\TicketController@myticket_ticket_list']); /* Get Tickets Assigned to logged user */ Route::get('/ticket/myticket', ['as' => 'myticket.ticket', 'uses' => 'Agent\helpdesk\TicketController@myticket_ticket_list']); /* Get Tickets Assigned to logged user */
Route::get('/ticket/get-myticket', ['as' => 'get.myticket.ticket', 'uses' => 'Agent\helpdesk\TicketController@get_myticket']); /* Get tickets in datatable */
Route::get('/ticket/overdue', ['as' => 'overdue.ticket', 'uses' => 'Agent\helpdesk\TicketController@overdue_ticket_list']); /* Get Overdue Ticket */ Route::get('/ticket/overdue', ['as' => 'overdue.ticket', 'uses' => 'Agent\helpdesk\TicketController@overdue_ticket_list']); /* Get Overdue Ticket */
Route::get('/ticket/closed', ['as' => 'closed.ticket', 'uses' => 'Agent\helpdesk\TicketController@closed_ticket_list']); /* Get Closed Ticket */ Route::get('/ticket/closed', ['as' => 'closed.ticket', 'uses' => 'Agent\helpdesk\TicketController@closed_ticket_list']); /* Get Closed Ticket */
Route::get('/ticket/get-closed', ['as' => 'get.closed.ticket', 'uses' => 'Agent\helpdesk\TicketController@get_closed']); /* Get tickets in datatable */
Route::get('/ticket/assigned', ['as' => 'assigned.ticket', 'uses' => 'Agent\helpdesk\TicketController@assigned_ticket_list']); /* Get Assigned Ticket */ Route::get('/ticket/assigned', ['as' => 'assigned.ticket', 'uses' => 'Agent\helpdesk\TicketController@assigned_ticket_list']); /* Get Assigned Ticket */
Route::get('/ticket/get-assigned', ['as' => 'get.assigned.ticket', 'uses' => 'Agent\helpdesk\TicketController@get_assigned']); /* Get tickets in datatable */
Route::get('/newticket', ['as' => 'newticket', 'uses' => 'Agent\helpdesk\TicketController@newticket']); /* Get Create New Ticket */ Route::get('/newticket', ['as' => 'newticket', 'uses' => 'Agent\helpdesk\TicketController@newticket']); /* Get Create New Ticket */
Route::post('/newticket/post', ['as' => 'post.newticket', 'uses' => 'Agent\helpdesk\TicketController@post_newticket']); /* Post Create New Ticket */ Route::post('/newticket/post', ['as' => 'post.newticket', 'uses' => 'Agent\helpdesk\TicketController@post_newticket']); /* Post Create New Ticket */
@@ -267,8 +276,12 @@ Route::group(['middleware' => 'role.agent', 'middleware' => 'auth'], function ()
Route::get('trash', 'Agent\helpdesk\TicketController@trash'); /* To show Deleted Tickets */ Route::get('trash', 'Agent\helpdesk\TicketController@trash'); /* To show Deleted Tickets */
Route::get('/ticket/trash', ['as' => 'get.trash.ticket', 'uses' => 'Agent\helpdesk\TicketController@get_trash']); /* Get tickets in datatable */
Route::get('unassigned', 'Agent\helpdesk\TicketController@unassigned'); /* To show Unassigned Tickets */ Route::get('unassigned', 'Agent\helpdesk\TicketController@unassigned'); /* To show Unassigned Tickets */
Route::get('/ticket/unassigned', ['as' => 'get.unassigned.ticket', 'uses' => 'Agent\helpdesk\TicketController@get_unassigned']); /* Get tickets in datatable */
Route::get('dashboard', 'Agent\helpdesk\DashboardController@index'); /* To show dashboard pages */ Route::get('dashboard', 'Agent\helpdesk\DashboardController@index'); /* To show dashboard pages */
Route::get('agen', 'Agent\helpdesk\DashboardController@ChartData'); Route::get('agen', 'Agent\helpdesk\DashboardController@ChartData');
@@ -489,14 +502,6 @@ $router->get('article/delete/{id}', 'Agent\kb\ArticleController@destroy');
$router->get('kb/settings', ['as'=>'settings' , 'uses'=> 'Agent\kb\SettingsController@settings']); $router->get('kb/settings', ['as'=>'settings' , 'uses'=> 'Agent\kb\SettingsController@settings']);
/* post settings */ /* post settings */
$router->patch('postsettings/{id}', 'Agent\kb\SettingsController@postSettings'); $router->patch('postsettings/{id}', 'Agent\kb\SettingsController@postSettings');
/* get the create faq page */
$router->get('create-faq',['as'=>'create-faq' , 'uses'=> 'Agent\kb\SettingsController@Faq'] );
/* post faq */
$router->patch('post-create-faq/{id}', 'Agent\kb\SettingsController@postfaq');
/* get the create page for Social- link */
$router->get('social',['as'=>'social' , 'uses'=> 'Agent\kb\SettingsController@CreateSocialLink']);
/* post Social - link for insert to database */
$router->patch('postsocial',['as'=>'post-create-social' , 'uses'=> 'Agent\kb\SettingsController@PostSocial']);
//Route for administrater to access the comment //Route for administrater to access the comment
$router->get('comment',['as'=>'comment' , 'uses'=> 'Agent\kb\SettingsController@comment']); $router->get('comment',['as'=>'comment' , 'uses'=> 'Agent\kb\SettingsController@comment']);
/* Route to define the comment should Published */ /* Route to define the comment should Published */
@@ -522,11 +527,6 @@ $router->get('get-categorys', ['as' => 'api.category', 'uses' => 'Agent\kb\Categ
$router->get('get-comment', ['as' => 'api.comment', 'uses' => 'Agent\kb\SettingsController@getData']); $router->get('get-comment', ['as' => 'api.comment', 'uses' => 'Agent\kb\SettingsController@getData']);
$router->get('test', 'ArticleController@test'); $router->get('test', 'ArticleController@test');
$router->get('side1', 'Agent\kb\SettingsController@side1');
$router->patch('side1/{id}', 'Agent\kb\SettingsController@postside1');
$router->get('side2', 'Agent\kb\SettingsController@side2');
$router->patch('side2/{id}', 'Agent\kb\SettingsController@postside2');
$router->post('image', 'Agent\kb\SettingsController@image'); $router->post('image', 'Agent\kb\SettingsController@image');
$router->get('direct', function () { $router->get('direct', function () {
@@ -556,7 +556,7 @@ $router->get('category-list/{id}',['as'=>'categorylist' , 'uses'=>'Client\kb\Use
/* get the home page */ /* get the home page */
$router->get('knowledgebase',['as'=>'home' , 'uses'=> 'Client\kb\UserController@home']); $router->get('knowledgebase',['as'=>'home' , 'uses'=> 'Client\kb\UserController@home']);
/* get the faq value to user */ /* get the faq value to user */
$router->get('faq',['as'=>'faq' , 'uses'=>'Client\kb\UserController@Faq'] ); // $router->get('faq',['as'=>'faq' , 'uses'=>'Client\kb\UserController@Faq'] );
/* get the cantact page to user */ /* get the cantact page to user */
$router->get('contact',['as'=>'contact' , 'uses'=> 'Client\kb\UserController@contact']); $router->get('contact',['as'=>'contact' , 'uses'=> 'Client\kb\UserController@contact']);
/* post the cantact page to controller */ /* post the cantact page to controller */

View File

@@ -6,6 +6,6 @@ class Group_assign_department extends Model {
protected $table = 'group_assign_department'; protected $table = 'group_assign_department';
protected $fillable = ['group_id','id','department_id']; protected $fillable = ['group_id','department_id'];
} }

View File

@@ -8,7 +8,7 @@ class Groups extends Model
protected $fillable = [ protected $fillable = [
'name', 'group_status', 'can_create_ticket', 'can_edit_ticket', 'name', 'group_status', 'can_create_ticket', 'can_edit_ticket',
'can_post_ticket', 'can_close_ticket', 'can_assign_ticket', 'can_post_ticket', 'can_close_ticket', 'can_assign_ticket',
'can_trasfer_ticket', 'can_delete_ticket', 'can_ban_email', 'can_transfer_ticket', 'can_delete_ticket', 'can_ban_email',
'can_manage_canned', 'can_manage_faq', 'can_view_agent_stats', 'can_manage_canned', 'can_manage_faq', 'can_view_agent_stats',
'department_access', 'admin_notes' 'department_access', 'admin_notes'
]; ];

View File

@@ -4,7 +4,7 @@ use Illuminate\Database\Eloquent\Model;
class Fields extends Model { class Fields extends Model {
protected $table = 'fields'; protected $table = 'custom_form_fields';
/** /**
* The attributes that are mass assignable. * The attributes that are mass assignable.
@@ -12,4 +12,4 @@ class Fields extends Model {
* @var array * @var array
*/ */
protected $fillable = ['forms_id','label','name', 'type', 'value','required']; protected $fillable = ['forms_id','label','name', 'type', 'value','required'];
} }

View File

@@ -5,7 +5,7 @@ use Illuminate\Database\Eloquent\Model;
class Forms extends Model { class Forms extends Model {
protected $table = 'forms'; protected $table = 'custom_forms';
/** /**
* The attributes that are mass assignable. * The attributes that are mass assignable.

View File

@@ -5,7 +5,7 @@ use Illuminate\Database\Eloquent\Model;
class Alert extends Model { class Alert extends Model {
/* Using alert_notice table */ /* Using alert_notice table */
protected $table = 'alert_notice'; protected $table = 'settings_alert_notice';
/* Set fillable fields in table */ /* Set fillable fields in table */
protected $fillable = [ protected $fillable = [

View File

@@ -4,7 +4,7 @@ use Illuminate\Database\Eloquent\Model;
class Company extends Model class Company extends Model
{ {
protected $table = 'company'; protected $table = 'settings_company';
protected $fillable = [ protected $fillable = [
'company_name', 'website', 'phone', 'address', 'landing_page', 'offline_page', 'company_name', 'website', 'phone', 'address', 'landing_page', 'offline_page',
'thank_page', 'logo','use_logo' 'thank_page', 'logo','use_logo'

View File

@@ -5,7 +5,7 @@ use Illuminate\Database\Eloquent\Model;
class Email extends Model { class Email extends Model {
/* Using Email table */ /* Using Email table */
protected $table = 'email'; protected $table = 'settings_email';
/* Set fillable fields in table */ /* Set fillable fields in table */
protected $fillable = [ protected $fillable = [
'id','template','sys_email','alert_email','admin_email','mta','email_fetching','strip', 'id','template','sys_email','alert_email','admin_email','mta','email_fetching','strip',

View File

@@ -5,7 +5,7 @@ use Illuminate\Database\Eloquent\Model;
class Responder extends Model { class Responder extends Model {
/* Using auto_response table */ /* Using auto_response table */
protected $table = 'auto_response'; protected $table = 'settings_auto_response';
/* Set fillable fields in table */ /* Set fillable fields in table */
protected $fillable = [ protected $fillable = [

View File

@@ -5,7 +5,7 @@ use Illuminate\Database\Eloquent\Model;
class System extends Model { class System extends Model {
/* Using System Table */ /* Using System Table */
protected $table = 'system'; protected $table = 'settings_system';
protected $fillable = [ protected $fillable = [
'id','status','url','name','department','page_size','log_level','purge_log','name_format', 'id','status','url','name','department','page_size','log_level','purge_log','name_format',

View File

@@ -5,7 +5,7 @@ use Illuminate\Database\Eloquent\Model;
class Ticket extends Model { class Ticket extends Model {
/* Using Ticket table */ /* Using Ticket table */
protected $table = 'ticket_settings'; protected $table = 'settings_ticket';
/* Set fillable fields in table */ /* Set fillable fields in table */
protected $fillable = [ protected $fillable = [
'id','num_format','num_sequence','priority','sla','help_topic','max_open_ticket','collision_avoid', 'id','num_format','num_sequence','priority','sla','help_topic','max_open_ticket','collision_avoid',

View File

@@ -0,0 +1,11 @@
<?php namespace App\Model\helpdesk\Theme;
use Illuminate\Database\Eloquent\Model;
class Widgets extends Model {
protected $table = 'widgets';
protected $fillable = ['name', 'value','created_at','updated_at'];
}

View File

@@ -2,10 +2,9 @@
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
class Tickets extends Model class Tickets extends Model {
{
protected $table = 'tickets'; protected $table = 'tickets';
protected $fillable = [ protected $fillable = ['id','ticket_number','num_sequence','user_id','priority_id','sla','help_topic_id','max_open_ticket','captcha','status','lock_by','lock_at','source','isoverdue','reopened','isanswered','is_deleted','closed','is_transfer','transfer_at','reopened_at','duedate','closed_at','last_message_at','last_response_at','created_at','updated_at'];
'id','ticket_number','num_sequence','user_id','priority_id','sla','help_topic_id','max_open_ticket','collision_avoid','captcha','status','lock_by','lock_at','claim_response','assigned_ticket','answered_ticket','agent_mask','html','client_update','max_file_size','remember_token','reopened_at','duedate','closed_at','last_message_at','last_response_at','created_at','updated_at'
];
} }

View File

@@ -8,6 +8,6 @@ class MailboxProtocol extends Model {
protected $table = 'mailbox_protocol'; protected $table = 'mailbox_protocol';
protected $fillable = ['id', 'name']; protected $fillable = ['id', 'name', 'value'];
} }

View File

@@ -20,7 +20,7 @@ class Article extends Model {
]; ];
/* define the table name to get the properties of article model as protected */ /* define the table name to get the properties of article model as protected */
protected $table = 'article'; protected $table = 'kb_article';
/* define the fillable field in the table */ /* define the fillable field in the table */
protected $fillable = ['name', 'slug', 'description', 'type', 'status']; protected $fillable = ['name', 'slug', 'description', 'type', 'status'];

View File

@@ -4,7 +4,7 @@ use Illuminate\Database\Eloquent\Model;
class Category extends Model { class Category extends Model {
protected $table = 'category'; protected $table = 'kb_category';
protected $fillable = ['id', 'slug', 'name', 'description', 'status', 'parent', 'created_at', 'updated_at']; protected $fillable = ['id', 'slug', 'name', 'description', 'status', 'parent', 'created_at', 'updated_at'];
} }

View File

@@ -8,7 +8,7 @@ use Illuminate\Database\Eloquent\Model;
*/ */
class Comment extends Model { class Comment extends Model {
protected $table = 'comment'; protected $table = 'kb_comment';
protected $fillable = ['article_id', 'name', 'email', 'website', 'comment', 'status']; protected $fillable = ['article_id', 'name', 'email', 'website', 'comment', 'status'];
} }

View File

@@ -4,7 +4,7 @@ use Illuminate\Database\Eloquent\Model;
class Page extends Model { class Page extends Model {
protected $table = 'pages'; protected $table = 'kb_pages';
protected $fillable = ['name', 'slug', 'status', 'visibility', 'description']; protected $fillable = ['name', 'slug', 'status', 'visibility', 'description'];
} }

View File

@@ -5,7 +5,7 @@ use Illuminate\Database\Eloquent\Model;
class Relationship extends Model { class Relationship extends Model {
/* define the table */ /* define the table */
protected $table = 'article_relationship'; protected $table = 'kb_article_relationship';
/* define fillable fields */ /* define fillable fields */
protected $fillable = ['id', 'category_id', 'article_id']; protected $fillable = ['id', 'category_id', 'article_id'];

View File

@@ -9,7 +9,7 @@ class Settings extends Model {
* @param $table, $fillable * @param $table, $fillable
* @package default * @package default
*/ */
protected $table = 'settings'; protected $table = 'kb_settings';
protected $fillable = ['language', 'dateformat', 'company_name', 'website', 'phone', 'address', 'logo', 'timezone', protected $fillable = ['language', 'dateformat', 'company_name', 'website', 'phone', 'address', 'logo', 'timezone',
'background', 'version', 'pagination', 'port', 'host', 'encryption', 'email', 'password']; 'background', 'version', 'pagination', 'port', 'host', 'encryption', 'email', 'password'];

View File

@@ -26,7 +26,7 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
protected $fillable = ['user_name', 'email', 'password', 'active', 'first_name', 'last_name', 'ban', 'ext', 'mobile', 'profile_pic', protected $fillable = ['user_name', 'email', 'password', 'active', 'first_name', 'last_name', 'ban', 'ext', 'mobile', 'profile_pic',
'phone_number', 'company', 'agent_sign', 'account_type', 'account_status', 'phone_number', 'company', 'agent_sign', 'account_type', 'account_status',
'assign_group', 'primary_dpt', 'agent_tzone', 'daylight_save', 'limit_access', 'assign_group', 'primary_dpt', 'agent_tzone', 'daylight_save', 'limit_access',
'directory_listing', 'vocation_mode', 'role', 'internal_note']; 'directory_listing', 'vacation_mode', 'role', 'internal_note'];
/** /**
* The attributes excluded from the model's JSON form. * The attributes excluded from the model's JSON form.

View File

@@ -15,7 +15,8 @@
"php-imap/php-imap": "~2.0", "php-imap/php-imap": "~2.0",
"neitanod/forceutf8": "dev-master", "neitanod/forceutf8": "dev-master",
"nicolaslopezj/searchable": "1.*", "nicolaslopezj/searchable": "1.*",
"chumper/datatable": "dev-develop" "chumper/datatable": "dev-develop",
"chumper/zipper": "0.6.x"
}, },

520
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -38,7 +38,7 @@ return [
| |
*/ */
'version' => 'COMMUNITY 1.0.4.1', 'version' => 'Community 1.0.5',
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateBanlistTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('banlist', function(Blueprint $table)
{
$table->increments('id');
$table->boolean('ban_status');
$table->string('email_address');
$table->string('internal_notes');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('banlist');
}
}

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateCannedResponseTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('canned_response', function(Blueprint $table)
{
$table->increments('id');
$table->integer('user_id')->unsigned()->index('user_id');
$table->string('title');
$table->text('message', 65535);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('canned_response');
}
}

View File

@@ -0,0 +1,39 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateCustomFormFieldsTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('custom_form_fields', function(Blueprint $table)
{
$table->increments('id');
$table->integer('forms_id');
$table->string('label');
$table->string('name');
$table->string('type');
$table->string('value');
$table->string('required');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('custom_form_fields');
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateCustomFormsTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('custom_forms', function(Blueprint $table)
{
$table->increments('id');
$table->string('formname');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('custom_forms');
}
}

View File

@@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateDateFormatTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('date_format', function(Blueprint $table)
{
$table->increments('id');
$table->string('format');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('date_format');
}
}

View File

@@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateDateTimeFormatTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('date_time_format', function(Blueprint $table)
{
$table->increments('id');
$table->string('format');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('date_time_format');
}
}

View File

@@ -0,0 +1,46 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateDepartmentTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('department', function(Blueprint $table)
{
$table->increments('id');
$table->string('name');
$table->string('type');
$table->integer('sla')->unsigned()->nullable()->index('sla');
$table->integer('manager')->unsigned()->nullable()->index('manager_2');
$table->string('ticket_assignment');
$table->string('outgoing_email');
$table->string('template_set');
$table->string('auto_ticket_response');
$table->string('auto_message_response');
$table->string('auto_response_email');
$table->string('recipient');
$table->string('group_access');
$table->string('department_sign');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('department');
}
}

View File

@@ -0,0 +1,58 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateEmailsTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('emails', function(Blueprint $table)
{
$table->increments('id');
$table->string('email_address');
$table->string('email_name');
$table->integer('department')->unsigned()->nullable();
$table->integer('priority')->unsigned()->nullable()->index('priority');
$table->integer('help_topic')->unsigned()->nullable()->index('help_topic');
$table->string('user_name');
$table->string('password');
$table->string('fetching_host');
$table->string('fetching_port');
$table->string('mailbox_protocol');
$table->string('imap_config');
$table->string('folder');
$table->string('sending_host');
$table->string('sending_port');
$table->string('internal_notes');
$table->boolean('auto_response');
$table->boolean('fetching_status');
$table->boolean('move_to_folder');
$table->boolean('delete_email');
$table->boolean('do_nothing');
$table->boolean('sending_status');
$table->boolean('authentication');
$table->boolean('header_spoofing');
$table->timestamps();
$table->index(['department','priority','help_topic'], 'department');
$table->index(['department','priority','help_topic'], 'department_2');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('emails');
}
}

View File

@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateGroupAssignDepartmentTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('group_assign_department', function(Blueprint $table)
{
$table->increments('id');
$table->integer('group_id')->unsigned()->index('group_id');
$table->integer('department_id')->unsigned()->index('department_id');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('group_assign_department');
}
}

View File

@@ -0,0 +1,48 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateGroupsTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('groups', function(Blueprint $table)
{
$table->increments('id');
$table->string('name');
$table->boolean('group_status');
$table->boolean('can_create_ticket');
$table->boolean('can_edit_ticket');
$table->boolean('can_post_ticket');
$table->boolean('can_close_ticket');
$table->boolean('can_assign_ticket');
$table->boolean('can_transfer_ticket');
$table->boolean('can_delete_ticket');
$table->boolean('can_ban_email');
$table->boolean('can_manage_canned');
$table->boolean('can_manage_faq');
$table->boolean('can_view_agent_stats');
$table->boolean('department_access');
$table->string('admin_notes');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('groups');
}
}

View File

@@ -0,0 +1,47 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateHelpTopicTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('help_topic', function(Blueprint $table)
{
$table->increments('id');
$table->string('topic');
$table->string('parent_topic');
$table->integer('custom_form')->unsigned()->nullable()->index('custom_form');
$table->integer('department')->unsigned()->nullable()->index('department');
$table->integer('ticket_status')->unsigned()->nullable()->index('ticket_status');
$table->integer('priority')->unsigned()->nullable()->index('priority');
$table->integer('sla_plan')->unsigned()->nullable()->index('sla_plan');
$table->string('thank_page');
$table->string('ticket_num_format');
$table->string('internal_notes');
$table->boolean('status');
$table->boolean('type');
$table->integer('auto_assign')->unsigned()->nullable()->index('auto_assign_2');
$table->boolean('auto_response');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('help_topic');
}
}

View File

@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateKbArticleRelationshipTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('kb_article_relationship', function(Blueprint $table)
{
$table->increments('id');
$table->integer('article_id')->unsigned()->index('article_relationship_article_id_foreign');
$table->integer('category_id')->unsigned()->index('article_relationship_category_id_foreign');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('kb_article_relationship');
}
}

View File

@@ -0,0 +1,38 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateKbArticleTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('kb_article', function(Blueprint $table)
{
$table->increments('id');
$table->string('name');
$table->string('slug');
$table->text('description', 65535);
$table->boolean('status');
$table->boolean('type');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('kb_article');
}
}

View File

@@ -0,0 +1,38 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateKbCategoryTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('kb_category', function(Blueprint $table)
{
$table->increments('id');
$table->string('name');
$table->string('slug');
$table->text('description', 65535);
$table->boolean('status');
$table->integer('parent');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('kb_category');
}
}

View File

@@ -0,0 +1,39 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateKbCommentTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('kb_comment', function(Blueprint $table)
{
$table->increments('id');
$table->integer('article_id')->unsigned()->index('comment_article_id_foreign');
$table->string('name');
$table->string('email');
$table->string('website');
$table->string('comment');
$table->boolean('status');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('kb_comment');
}
}

View File

@@ -0,0 +1,38 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateKbPagesTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('kb_pages', function(Blueprint $table)
{
$table->increments('id');
$table->string('name');
$table->boolean('status');
$table->boolean('visibility');
$table->string('slug');
$table->text('description', 65535);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('kb_pages');
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateKbSettingsTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('kb_settings', function(Blueprint $table)
{
$table->increments('id');
$table->integer('pagination');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('kb_settings');
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateLanguagesTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('languages', function(Blueprint $table)
{
$table->increments('id');
$table->string('name');
$table->string('locale');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('languages');
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateLogNotificationTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('log_notification', function(Blueprint $table)
{
$table->increments('id');
$table->string('log');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('log_notification');
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateMailboxProtocolTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('mailbox_protocol', function(Blueprint $table)
{
$table->increments('id');
$table->string('name');
$table->string('value', 50)->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('mailbox_protocol');
}
}

View File

@@ -0,0 +1,39 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateOrganizationTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('organization', function(Blueprint $table)
{
$table->increments('id');
$table->string('name');
$table->string('phone');
$table->string('website');
$table->string('address');
$table->integer('head')->unsigned()->nullable()->index('head');
$table->string('internal_notes');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('organization');
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreatePasswordResetsTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('password_resets', function(Blueprint $table)
{
$table->string('email')->index();
$table->string('token')->index();
$table->dateTime('created_at')->default('0000-00-00 00:00:00');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('password_resets');
}
}

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreatePluginsTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('plugins', function(Blueprint $table)
{
$table->increments('id');
$table->string('name');
$table->string('path');
$table->integer('status');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('plugins');
}
}

View File

@@ -0,0 +1,39 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateSendMailTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('send_mail', function(Blueprint $table)
{
$table->increments('id');
$table->string('driver');
$table->string('host');
$table->string('port');
$table->string('encryption');
$table->string('name');
$table->string('email');
$table->string('password');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('send_mail');
}
}

View File

@@ -0,0 +1,62 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateSettingsAlertNoticeTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('settings_alert_notice', function(Blueprint $table)
{
$table->increments('id');
$table->boolean('ticket_status');
$table->boolean('ticket_admin_email');
$table->boolean('ticket_department_manager');
$table->boolean('ticket_department_member');
$table->boolean('ticket_organization_accmanager');
$table->boolean('message_status');
$table->boolean('message_last_responder');
$table->boolean('message_assigned_agent');
$table->boolean('message_department_manager');
$table->boolean('message_organization_accmanager');
$table->boolean('internal_status');
$table->boolean('internal_last_responder');
$table->boolean('internal_assigned_agent');
$table->boolean('internal_department_manager');
$table->boolean('assignment_status');
$table->boolean('assignment_assigned_agent');
$table->boolean('assignment_team_leader');
$table->boolean('assignment_team_member');
$table->boolean('transfer_status');
$table->boolean('transfer_assigned_agent');
$table->boolean('transfer_department_manager');
$table->boolean('transfer_department_member');
$table->boolean('overdue_status');
$table->boolean('overdue_assigned_agent');
$table->boolean('overdue_department_manager');
$table->boolean('overdue_department_member');
$table->boolean('system_error');
$table->boolean('sql_error');
$table->boolean('excessive_failure');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('settings_alert_notice');
}
}

View File

@@ -0,0 +1,38 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateSettingsAutoResponseTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('settings_auto_response', function(Blueprint $table)
{
$table->increments('id');
$table->boolean('new_ticket');
$table->boolean('agent_new_ticket');
$table->boolean('submitter');
$table->boolean('participants');
$table->boolean('overlimit');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('settings_auto_response');
}
}

Some files were not shown because too many files have changed in this diff Show More