update for version 1.0.1
This commit is contained in:
244
code/app/Http/Controllers/Admin/helpdesk/AgentController.php
Normal file
244
code/app/Http/Controllers/Admin/helpdesk/AgentController.php
Normal file
@@ -0,0 +1,244 @@
|
||||
<?php namespace App\Http\Controllers\Admin\helpdesk;
|
||||
// controller
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Controllers\Common\SettingsController;
|
||||
// request
|
||||
use App\Http\Requests\helpdesk\AgentRequest;
|
||||
use App\Http\Requests\helpdesk\AgentUpdate;
|
||||
// model
|
||||
use App\User;
|
||||
use App\Model\helpdesk\Agent\Assign_team_agent;
|
||||
use App\Model\helpdesk\Agent\Department;
|
||||
use App\Model\helpdesk\Agent\Groups;
|
||||
use App\Model\helpdesk\Agent\Teams;
|
||||
use App\Model\helpdesk\Utility\Timezones;
|
||||
use App\Model\helpdesk\Settings\Company;
|
||||
// classes
|
||||
use DB;
|
||||
use Mail;
|
||||
use Hash;
|
||||
|
||||
/**
|
||||
* AgentController
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class AgentController extends Controller {
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* @return Response
|
||||
*/
|
||||
public function __construct() {
|
||||
SettingsController::smtp();
|
||||
$this->middleware('auth');
|
||||
$this->middleware('roles');
|
||||
}
|
||||
|
||||
/**
|
||||
* get index page
|
||||
* @param type User $user
|
||||
* @return type Response
|
||||
*/
|
||||
public function index() {
|
||||
try {
|
||||
return view('themes.default1.admin.helpdesk.agent.agents.index');
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
* @param type Assign_team_agent $team_assign_agent
|
||||
* @param type Timezones $timezone
|
||||
* @param type Groups $group
|
||||
* @param type Department $department
|
||||
* @param type Teams $team
|
||||
* @return type Response
|
||||
*/
|
||||
public function create(Assign_team_agent $team_assign_agent, Timezones $timezone, Groups $group, Department $department, Teams $team) {
|
||||
try {
|
||||
$team = $team->get();
|
||||
$timezones = $timezone->get();
|
||||
$groups = $group->get();
|
||||
$departments = $department->get();
|
||||
$teams = $team->lists('id', 'name');
|
||||
return view('themes.default1.admin.helpdesk.agent.agents.create', compact('assign', 'teams', 'agents', 'timezones', 'groups', 'departments', 'team'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
* @param type User $user
|
||||
* @param type AgentRequest $request
|
||||
* @param type Assign_team_agent $team_assign_agent
|
||||
* @return type Response
|
||||
*/
|
||||
public function store(User $user, AgentRequest $request, Assign_team_agent $team_assign_agent) {
|
||||
try {
|
||||
/* Insert to user table */
|
||||
$user->role = 'agent';
|
||||
$user->fill($request->input())->save();
|
||||
$password = $this->generateRandomString();
|
||||
$user->password = Hash::make($password);
|
||||
$requests = $request->input('team_id');
|
||||
$id = $user->id;
|
||||
foreach ($requests as $req) {
|
||||
DB::insert('insert into team_assign_agent (team_id, agent_id) values (?,?)', [$req, $id]);
|
||||
}
|
||||
/* Succes And Failure condition */
|
||||
if ($user->save() == true) {
|
||||
$name = $user->user_name;
|
||||
$email = $user->email;
|
||||
$from = $this->company();
|
||||
Mail::send('emails.pass', ['name' => $name, 'password' => $password, 'from' => $from], function ($message) use ($email, $name) {
|
||||
$message->to($email, $name)->subject('[password]');
|
||||
});
|
||||
return redirect('agents')->with('success', 'Agent Created sucessfully');
|
||||
} else {
|
||||
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.
|
||||
* @param int $id
|
||||
* @return Response
|
||||
*/
|
||||
public function show($id) {
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
* @param type int $id
|
||||
* @param type User $user
|
||||
* @param type Assign_team_agent $team_assign_agent
|
||||
* @param type Timezones $timezone
|
||||
* @param type Groups $group
|
||||
* @param type Department $department
|
||||
* @param type Teams $team
|
||||
* @return type Response
|
||||
*/
|
||||
public function edit($id, User $user, Assign_team_agent $team_assign_agent, Timezones $timezone, Groups $group, Department $department, Teams $team) {
|
||||
try {
|
||||
$user = $user->whereId($id)->first();
|
||||
$team = $team->get();
|
||||
$teams1 = $team->lists('name', 'id');
|
||||
$timezones = $timezone->get();
|
||||
$groups = $group->get();
|
||||
$departments = $department->get();
|
||||
$table = $team_assign_agent->where('agent_id', $id)->first();
|
||||
$teams = $team->lists('id', 'name');
|
||||
$assign = $team_assign_agent->where('agent_id', $id)->lists('team_id');
|
||||
return view('themes.default1.admin.helpdesk.agent.agents.edit', compact('teams', 'assign', 'table', 'teams1', 'selectedTeams', 'user', 'timezones', 'groups', 'departments', 'team', 'exp', 'counted'));
|
||||
} catch (Exception $e) {
|
||||
return redirect('agents')->with('fail', 'No such file');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
* @param type int $id
|
||||
* @param type User $user
|
||||
* @param type AgentUpdate $request
|
||||
* @param type Assign_team_agent $team_assign_agent
|
||||
* @return type Response
|
||||
*/
|
||||
public function update($id, User $user, AgentUpdate $request, Assign_team_agent $team_assign_agent) {
|
||||
try {
|
||||
$user = $user->whereId($id)->first();
|
||||
$daylight_save = $request->input('daylight_save');
|
||||
$limit_access = $request->input('limit_access');
|
||||
$directory_listing = $request->input('directory_listing');
|
||||
$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->delete();
|
||||
$requests = $request->input('team_id');
|
||||
foreach ($requests as $req) {
|
||||
DB::insert('insert into team_assign_agent (team_id, agent_id) values (?,?)', [$req, $id]);
|
||||
}
|
||||
//Todo For success and failure conditions
|
||||
$user->fill($request->except('daylight_save', 'limit_access', 'directory_listing', 'vocation_mode', 'assign_team'))->save();
|
||||
return redirect('agents')->with('success', 'Agent Updated sucessfully');
|
||||
} catch (Exception $e) {
|
||||
return redirect('agents')->with('fails', 'Agent did not update');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
* @param type int $id
|
||||
* @param type User $user
|
||||
* @param type Assign_team_agent $team_assign_agent
|
||||
* @return type Response
|
||||
*/
|
||||
public function destroy($id, User $user, Assign_team_agent $team_assign_agent) {
|
||||
try {
|
||||
/* Becouse of foreign key we delete team_assign_agent first */
|
||||
$team_assign_agent = $team_assign_agent->where('agent_id', $id);
|
||||
$team_assign_agent->delete();
|
||||
$user = $user->whereId($id)->first();
|
||||
if ($user->delete()) {
|
||||
return redirect('agents')->with('success', 'Agent Deleted sucessfully');
|
||||
} else {
|
||||
return redirect('agents')->with('fails', 'Agent can not Delete ');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
return redirect('agents')->with('fails', 'Agent can not Delete if the team Excist');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generate a random string for password
|
||||
* @param type $length
|
||||
* @return type string
|
||||
*/
|
||||
public function generateRandomString($length = 10) {
|
||||
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
$charactersLength = strlen($characters);
|
||||
$randomString = '';
|
||||
for ($i = 0; $i < $length; $i++) {
|
||||
$randomString .= $characters[rand(0, $charactersLength - 1)];
|
||||
}
|
||||
return $randomString;
|
||||
}
|
||||
|
||||
/**
|
||||
* company
|
||||
* @return type
|
||||
*/
|
||||
public function company()
|
||||
{
|
||||
$company = Company::Where('id','=','1')->first();
|
||||
if($company->company_name == null){
|
||||
$company = "Support Center";
|
||||
}else{
|
||||
$company = $company->company_name;
|
||||
}
|
||||
return $company;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function agent_profile($id) {
|
||||
$agent = User::where('id','=',$id)->first();
|
||||
return \View::make('themes.default1.admin.helpdesk.agent.agents.agent-profile',compact('agent'));
|
||||
}
|
||||
|
||||
}
|
152
code/app/Http/Controllers/Admin/helpdesk/BanlistController.php
Normal file
152
code/app/Http/Controllers/Admin/helpdesk/BanlistController.php
Normal file
@@ -0,0 +1,152 @@
|
||||
<?php namespace App\Http\Controllers\Admin\helpdesk;
|
||||
// controller
|
||||
use App\Http\Controllers\Controller;
|
||||
// request
|
||||
use App\Http\Requests\helpdesk\BanlistRequest;
|
||||
use App\Http\Requests\helpdesk\BanRequest;
|
||||
// model
|
||||
use App\User;
|
||||
|
||||
/**
|
||||
* BanlistController
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class BanlistController extends Controller {
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* @return type void
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->middleware('auth');
|
||||
$this->middleware('roles');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
* @param type Banlist $ban
|
||||
* @return type Response
|
||||
*/
|
||||
public function index() {
|
||||
try {
|
||||
$bans = User::where('ban','=',1)->get();
|
||||
return view('themes.default1.admin.helpdesk.emails.banlist.index', compact('bans'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
* @return type Response
|
||||
*/
|
||||
public function create() {
|
||||
try {
|
||||
return view('themes.default1.admin.helpdesk.emails.banlist.create');
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
* @param type banlist $ban
|
||||
* @param type BanRequest $request
|
||||
* @param type User $user
|
||||
* @return type Response
|
||||
*/
|
||||
public function store(BanRequest $request, User $user) {
|
||||
// try {
|
||||
//adding field to user whether it is banned or not
|
||||
$adban = $request->input('email');
|
||||
$use = $user->where('email', $adban)->first();
|
||||
if ($use != null) {
|
||||
$use->ban = $request->input('ban_status');
|
||||
$use->internal_note = $request->input('internal_note');
|
||||
$use->save();
|
||||
// $user->create($request->input())->save();
|
||||
return redirect()->back()->with('success', 'Email Banned sucessfully');
|
||||
} else {
|
||||
$user = new User;
|
||||
$user->email = $adban;
|
||||
$user->ban = $request->input('ban_status');
|
||||
$user->internal_note = $request->input('internal_note');
|
||||
$user->save();
|
||||
return redirect()->back()->with('success', 'Email Banned sucessfully');
|
||||
}
|
||||
// } catch (Exception $e) {
|
||||
// return redirect('banlist')->with('fails', 'Email can not Ban');
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return Response
|
||||
*/
|
||||
public function show($id) {
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
* @param type int $id
|
||||
* @param type Banlist $ban
|
||||
* @return type Response
|
||||
*/
|
||||
public function edit($id, User $ban) {
|
||||
try {
|
||||
$bans = $ban->whereId($id)->first();
|
||||
return view('themes.default1.admin.helpdesk.emails.banlist.edit', compact('bans'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
* @param type int $id
|
||||
* @param type Banlist $ban
|
||||
* @param type BanlistRequest $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function update($id, User $ban, BanlistRequest $request) {
|
||||
try {
|
||||
$bans = $ban->whereId($id)->first();
|
||||
$bans->internal_note = $request->input('internal_note');
|
||||
$bans->ban = $request->input('ban');
|
||||
// dd($request->input('ban'));
|
||||
if ($bans->save()) {
|
||||
return redirect('banlist')->with('success', 'Banned Email Updated sucessfully');
|
||||
} else {
|
||||
return redirect('banlist')->with('fails', 'Banned Email not Updated');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
return redirect('banlist')->with('fails', 'Banned Email not Updated');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
* @param type int $id
|
||||
* @param type Banlist $ban
|
||||
* @return type Response
|
||||
*/
|
||||
public function destroy($id, Banlist $ban) {
|
||||
try {
|
||||
$bans = $ban->whereId($id)->first();
|
||||
/* Success and Falure condition */
|
||||
if ($bans->delete() == true) {
|
||||
return redirect('banlist')->with('success', 'Banned Email Deleted sucessfully');
|
||||
} else {
|
||||
return redirect('banlist')->with('fails', 'Banned Email can not Delete');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
return redirect('banlist')->with('fails', 'Banned Email can not Delete');
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,191 @@
|
||||
<?php namespace App\Http\Controllers\Admin\helpdesk;
|
||||
// controller
|
||||
use App\Http\Controllers\Controller;
|
||||
// request
|
||||
use App\Http\Requests\helpdesk\DepartmentRequest;
|
||||
use App\Http\Requests\helpdesk\DepartmentUpdate;
|
||||
// model
|
||||
use App\Model\helpdesk\Agent\Department;
|
||||
use App\Model\helpdesk\Agent\Groups;
|
||||
use App\Model\helpdesk\Agent\Group_assign_department;
|
||||
use App\Model\helpdesk\Agent\Teams;
|
||||
use App\Model\helpdesk\Email\Emails;
|
||||
use App\Model\helpdesk\Email\Template;
|
||||
use App\Model\helpdesk\Manage\Sla_plan;
|
||||
use App\User;
|
||||
// classes
|
||||
use DB;
|
||||
|
||||
/**
|
||||
* DepartmentController
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class DepartmentController extends Controller {
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->middleware('auth');
|
||||
$this->middleware('roles');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get index page
|
||||
* @param type Department $department
|
||||
* @return type Response
|
||||
*/
|
||||
public function index(Department $department) {
|
||||
try {
|
||||
$departments = $department->get();
|
||||
return view('themes.default1.admin.helpdesk.agent.departments.index', compact('departments'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
* @param type User $user
|
||||
* @param type Group_assign_department $group_assign_department
|
||||
* @param type Department $department
|
||||
* @param type Sla_plan $sla
|
||||
* @param type Template $template
|
||||
* @param type Emails $email
|
||||
* @param type Groups $group
|
||||
* @return type Response
|
||||
*/
|
||||
public function create(User $user, Group_assign_department $group_assign_department, Department $department, Sla_plan $sla, Template $template, Emails $email, Groups $group) {
|
||||
try {
|
||||
$slas = $sla->get();
|
||||
$user = $user->where('role', 'agent')->get();
|
||||
$emails = $email->get();
|
||||
$templates = $template->get();
|
||||
$department = $department->get();
|
||||
$groups = $group->lists('id', 'name');
|
||||
return view('themes.default1.admin.helpdesk.agent.departments.create', compact('department', 'templates', 'slas', 'user', 'emails', 'groups'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
* @param type Department $department
|
||||
* @param type DepartmentRequest $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function store(Department $department, DepartmentRequest $request) {
|
||||
try {
|
||||
$department->fill($request->except('group_id'))->save();
|
||||
$requests = $request->input('group_id');
|
||||
$id = $department->id;
|
||||
// foreach ($requests as $req) {
|
||||
// DB::insert('insert into group_assign_department(group_id, department_id) values (?,?)', [$req, $id]);
|
||||
// }
|
||||
/* Succes And Failure condition */
|
||||
/* Check Whether the function Success or Fail */
|
||||
if ($department->save() == true) {
|
||||
return redirect('departments')->with('success', 'Department Created sucessfully');
|
||||
} else {
|
||||
return redirect('departments')->with('fails', 'Department can not Create');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
return redirect('departments')->with('fails', 'Department can not Create');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return Response
|
||||
*/
|
||||
public function show($id) {
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
* @param type int $id
|
||||
* @param type User $user
|
||||
* @param type Group_assign_department $group_assign_department
|
||||
* @param type Template $template
|
||||
* @param type Teams $team
|
||||
* @param type Department $department
|
||||
* @param type Sla_plan $sla
|
||||
* @param type Emails $email
|
||||
* @param type Groups $group
|
||||
* @return type Response
|
||||
*/
|
||||
public function edit($id, User $user, Group_assign_department $group_assign_department, Template $template, Teams $team, Department $department, Sla_plan $sla, Emails $email, Groups $group) {
|
||||
try {
|
||||
$slas = $sla->get();
|
||||
$user = $user->where('role', 'agent')->get();
|
||||
$emails = $email->get();
|
||||
$templates = $template->get();
|
||||
$departments = $department->whereId($id)->first();
|
||||
$groups = $group->lists('id', 'name');
|
||||
$assign = $group_assign_department->where('department_id', $id)->lists('group_id');
|
||||
return view('themes.default1.admin.helpdesk.agent.departments.edit', compact('assign', 'team', 'templates', 'departments', 'slas', 'user', 'emails', 'groups'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
* @param type int $id
|
||||
* @param type Group_assign_department $group_assign_department
|
||||
* @param type Department $department
|
||||
* @param type DepartmentUpdate $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function update($id, Group_assign_department $group_assign_department, Department $department, DepartmentUpdate $request) {
|
||||
try {
|
||||
$table = $group_assign_department->where('department_id', $id);
|
||||
$table->delete();
|
||||
$requests = $request->input('group_id');
|
||||
// foreach ($requests as $req) {
|
||||
// DB::insert('insert into group_assign_department (group_id, department_id) values (?,?)', [$req, $id]);
|
||||
// }
|
||||
$departments = $department->whereId($id)->first();
|
||||
if ($departments->fill($request->except('group_access'))->save()) {
|
||||
return redirect('departments')->with('success', 'Department Updated sucessfully');
|
||||
} else {
|
||||
return redirect('departments')->with('fails', 'Department not Updated');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
return redirect('departments')->with('fails', 'Department not Updated');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
* @param type int $id
|
||||
* @param type Department $department
|
||||
* @param type Group_assign_department $group_assign_department
|
||||
* @return type Response
|
||||
*/
|
||||
public function destroy($id, Department $department, Group_assign_department $group_assign_department) {
|
||||
try {
|
||||
/* 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');
|
||||
} else {
|
||||
return redirect('departments')->with('fails', 'Department can not Delete');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
return redirect('departments')->with('fails', 'Department can not Delete');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
164
code/app/Http/Controllers/Admin/helpdesk/EmailsController.php
Normal file
164
code/app/Http/Controllers/Admin/helpdesk/EmailsController.php
Normal file
@@ -0,0 +1,164 @@
|
||||
<?php namespace App\Http\Controllers\Admin\helpdesk;
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
// request
|
||||
use App\Http\Requests\helpdesk\EmailsEditRequest;
|
||||
use App\Http\Requests\helpdesk\EmailsRequest;
|
||||
// model
|
||||
use App\Model\helpdesk\Agent\Department;
|
||||
use App\Model\helpdesk\Email\Emails;
|
||||
use App\Model\helpdesk\Manage\Help_topic;
|
||||
use App\Model\helpdesk\Utility\MailboxProtocol;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Priority;
|
||||
// classes
|
||||
use Crypt;
|
||||
|
||||
/**
|
||||
* EmailsController
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class EmailsController extends Controller {
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* @return type
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->middleware('auth');
|
||||
$this->middleware('roles');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
* @param type Emails $emails
|
||||
* @return type Response
|
||||
*/
|
||||
public function index(Emails $emails) {
|
||||
try {
|
||||
$emails = $emails->get();
|
||||
return view('themes.default1.admin.helpdesk.emails.emails.index', compact('emails'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
* @param type Department $department
|
||||
* @param type Help_topic $help
|
||||
* @param type Priority $priority
|
||||
* @param type MailboxProtocol $mailbox_protocol
|
||||
* @return type Response
|
||||
*/
|
||||
public function create(Department $department, Help_topic $help, Ticket_Priority $priority, MailboxProtocol $mailbox_protocol) {
|
||||
try {
|
||||
$departments = $department->get();
|
||||
$helps = $help->get();
|
||||
$priority = $priority->get();
|
||||
$mailbox_protocols = $mailbox_protocol->get();
|
||||
return view('themes.default1.admin.helpdesk.emails.emails.create', compact('mailbox_protocols', 'priority', 'departments', 'helps'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
* @param type Emails $email
|
||||
* @param type EmailsRequest $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function store(Emails $email, EmailsRequest $request) {
|
||||
try {
|
||||
$password = $request->input('password');
|
||||
$encrypted = Crypt::encrypt($password);
|
||||
$email->password = $encrypted;
|
||||
if ($email->fill($request->except('password'))->save() == true) {
|
||||
return redirect('emails')->with('success', 'Email Created sucessfully');
|
||||
} else {
|
||||
return redirect('emails')->with('fails', 'Email can not Create');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
return redirect('emails')->with('fails', 'Email can not Create');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return Response
|
||||
*/
|
||||
public function show($id) {
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
* @param type int $id
|
||||
* @param type Department $department
|
||||
* @param type Help_topic $help
|
||||
* @param type Emails $email
|
||||
* @param type Priority $priority
|
||||
* @param type MailboxProtocol $mailbox_protocol
|
||||
* @return type Response
|
||||
*/
|
||||
public function edit($id, Department $department, Help_topic $help, Emails $email, Ticket_Priority $priority, MailboxProtocol $mailbox_protocol) {
|
||||
try {
|
||||
$emails = $email->whereId($id)->first();
|
||||
$departments = $department->get();
|
||||
$helps = $help->get();
|
||||
$priority = $priority->get();
|
||||
$mailbox_protocols = $mailbox_protocol->get();
|
||||
return view('themes.default1.admin.helpdesk.emails.emails.edit', compact('mailbox_protocols', 'priority', 'departments', 'helps', 'emails'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
* @param type $id
|
||||
* @param type Emails $email
|
||||
* @param type EmailsEditRequest $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function update($id, Emails $email, EmailsEditRequest $request) {
|
||||
$password = $request->input('password');
|
||||
$encrypted = Crypt::encrypt($password);
|
||||
//echo $encrypted;
|
||||
//$value = Crypt::decrypt($encrypted);
|
||||
//echo $value;
|
||||
try {
|
||||
$emails = $email->whereId($id)->first();
|
||||
$emails->password = $encrypted;
|
||||
$emails->fill($request->except('password'))->save();
|
||||
return redirect('emails')->with('success', 'Email Updated sucessfully');
|
||||
} catch (Exception $e) {
|
||||
return redirect('emails')->with('fails', 'Email not updated');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
* @param type int $id
|
||||
* @param type Emails $email
|
||||
* @return type Response
|
||||
*/
|
||||
public function destroy($id, Emails $email) {
|
||||
try {
|
||||
$emails = $email->whereId($id)->first();
|
||||
if ($emails->delete() == true) {
|
||||
return redirect('emails')->with('success', 'Email Deleted sucessfully');
|
||||
} else {
|
||||
return redirect('emails')->with('fails', 'Email can not Delete ');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
return redirect('emails')->with('fails', 'Email can not Delete ');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
108
code/app/Http/Controllers/Admin/helpdesk/FormController.php
Normal file
108
code/app/Http/Controllers/Admin/helpdesk/FormController.php
Normal file
@@ -0,0 +1,108 @@
|
||||
<?php namespace App\Http\Controllers\Admin\helpdesk;
|
||||
|
||||
use App\Model\helpdesk\Form\Fields;
|
||||
use App\Model\helpdesk\Form\Forms;
|
||||
use Illuminate\Http\Request;
|
||||
use Input;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Redirect;
|
||||
|
||||
class FormController extends Controller {
|
||||
private $fields;
|
||||
private $forms;
|
||||
|
||||
|
||||
public function __construct(Fields $fields,Forms $forms) {
|
||||
$this->fields = $fields;
|
||||
$this->forms = $forms;
|
||||
// $this->middleware('auth');
|
||||
}
|
||||
|
||||
/**
|
||||
* home
|
||||
* @return type
|
||||
*/
|
||||
public function home() {
|
||||
return view('forms.home');
|
||||
}
|
||||
|
||||
/**
|
||||
* list of forms
|
||||
* @param type Forms $forms
|
||||
* @return Response
|
||||
*/
|
||||
public function index(Forms $forms) {
|
||||
return view('themes.default1.admin.helpdesk.manage.form.index',compact('forms'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
* @return Response
|
||||
*/
|
||||
public function create() {
|
||||
return view('themes.default1.admin.helpdesk.manage.form.form');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
* @param int $id
|
||||
* @return Response
|
||||
*/
|
||||
public function show($id) {
|
||||
return view('themes.default1.admin.helpdesk.manage.form.preview',compact('id'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function store(Forms $forms) {
|
||||
if(!Input::get('formname')) {
|
||||
return Redirect::back()->with('fails','Please fill Form name');
|
||||
}
|
||||
$required = Input::get('required');
|
||||
$count = count($required);
|
||||
$require = array();
|
||||
for($i=2;$i<$count+2;$i++) {
|
||||
for($j=0;$j<1;$j++) {
|
||||
array_push($require,$required[$i][$j]);
|
||||
}
|
||||
}
|
||||
$forms->formname = Input::get('formname');
|
||||
$forms->save();
|
||||
$count = count(Input::get('name'));
|
||||
$fields = array();
|
||||
for($i=0; $i<=$count; $i++) {
|
||||
if(!empty(Input::get('name')[$i])) {
|
||||
array_push($fields, array(
|
||||
'forms_id' => $forms->id,
|
||||
'label' => Input::get('label')[$i],
|
||||
'name' => Input::get('name')[$i],
|
||||
'type' => Input::get('type')[$i],
|
||||
'value' => Input::get('value')[$i],
|
||||
'required'=>$require[$i],
|
||||
));
|
||||
}
|
||||
}
|
||||
Fields::insert($fields);
|
||||
return Redirect::back()->with('success','Successfully created Form');
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function delete($id,Forms $forms, Fields $field) {
|
||||
$fields = $field->where('forms_id',$id)->get();
|
||||
foreach($fields as $field) {
|
||||
$field->delete();
|
||||
}
|
||||
$forms = $forms->where('id',$id)->first();
|
||||
$forms->delete();
|
||||
return redirect()->back()->with('success', 'Deleted Successfully');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
198
code/app/Http/Controllers/Admin/helpdesk/GroupController.php
Normal file
198
code/app/Http/Controllers/Admin/helpdesk/GroupController.php
Normal file
@@ -0,0 +1,198 @@
|
||||
<?php namespace App\Http\Controllers\Admin\helpdesk;
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
// requests
|
||||
use App\Http\Requests\helpdesk\GroupRequest;
|
||||
use Illuminate\Http\Request;
|
||||
// models
|
||||
use App\Model\helpdesk\Agent\Department;
|
||||
use App\Model\helpdesk\Agent\Groups;
|
||||
use App\Model\helpdesk\Agent\Group_assign_department;
|
||||
// classes
|
||||
use Illuminate\Support\Facades\Input;
|
||||
|
||||
/**
|
||||
* GroupController
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class GroupController extends Controller {
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* @return type void
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->middleware('auth');
|
||||
$this->middleware('roles');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
* @param type Groups $group
|
||||
* @param type Department $department
|
||||
* @param type Group_assign_department $group_assign_department
|
||||
* @return type Response
|
||||
*/
|
||||
public function index(Groups $group, Department $department, Group_assign_department $group_assign_department) {
|
||||
try {
|
||||
$groups = $group->get();
|
||||
$departments = $department->lists('id');
|
||||
return view('themes.default1.admin.helpdesk.agent.groups.index', compact('departments', 'group_assign_department', 'groups'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
* @return type Response
|
||||
*/
|
||||
public function create() {
|
||||
try {
|
||||
return view('themes.default1.admin.helpdesk.agent.groups.create');
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
* @param type Groups $group
|
||||
* @param type GroupRequest $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function store(Groups $group, GroupRequest $request) {
|
||||
try {
|
||||
/* Check Whether function success or not */
|
||||
if ($group->fill($request->input())->save() == true) {
|
||||
/* redirect to Index page with Success Message */
|
||||
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) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('groups')->with('fails', 'Groups can not Create');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* @param type int $id
|
||||
* @param type Groups $group
|
||||
* @return type Response
|
||||
*/
|
||||
public function edit($id, Groups $group) {
|
||||
try {
|
||||
$groups = $group->whereId($id)->first();
|
||||
return view('themes.default1.admin.helpdesk.agent.groups.edit', compact('groups'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
* @param type int $id
|
||||
* @param type Groups $group
|
||||
* @param type Request $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function update($id, Groups $group, Request $request) {
|
||||
try {
|
||||
$var = $group->whereId($id)->first();
|
||||
//Updating Status
|
||||
$status = $request->Input('group_status');
|
||||
$var->group_status = $status;
|
||||
//Updating can_create_ticket field
|
||||
$createTicket = $request->Input('can_create_ticket');
|
||||
$var->can_create_ticket = $createTicket;
|
||||
//Updating can_edit_ticket field
|
||||
$editTicket = $request->Input('can_edit_ticket');
|
||||
$var->can_edit_ticket = $editTicket;
|
||||
//Updating can_post_ticket field
|
||||
$postTicket = $request->Input('can_post_ticket');
|
||||
$var->can_post_ticket = $postTicket;
|
||||
//Updating can_close_ticket field
|
||||
$closeTicket = $request->Input('can_close_ticket');
|
||||
$var->can_close_ticket = $closeTicket;
|
||||
//Updating can_assign_ticket field
|
||||
$assignTicket = $request->Input('can_assign_ticket');
|
||||
$var->can_assign_ticket = $assignTicket;
|
||||
//Updating can_trasfer_ticket field
|
||||
$trasferTicket = $request->Input('can_trasfer_ticket');
|
||||
$var->can_trasfer_ticket = $trasferTicket;
|
||||
//Updating can_delete_ticket field
|
||||
$deleteTicket = $request->Input('can_delete_ticket');
|
||||
$var->can_delete_ticket = $deleteTicket;
|
||||
//Updating can_ban_email field
|
||||
$banEmail = $request->Input('can_ban_email');
|
||||
$var->can_ban_email = $banEmail;
|
||||
//Updating can_manage_canned field
|
||||
$manageCanned = $request->Input('can_manage_canned');
|
||||
$var->can_manage_canned = $manageCanned;
|
||||
//Updating can_manage_faq field
|
||||
$manageFaq = $request->Input('can_manage_faq');
|
||||
$var->can_manage_faq = $manageFaq;
|
||||
//Updating can_view_agent_stats field
|
||||
$viewAgentStats = $request->Input('can_view_agent_stats');
|
||||
$var->can_view_agent_stats = $viewAgentStats;
|
||||
//Updating department_access field
|
||||
$departmentAccess = $request->Input('department_access');
|
||||
$var->department_access = $departmentAccess;
|
||||
//Updating admin_notes field
|
||||
$adminNotes = $request->Input('admin_notes');
|
||||
$var->admin_notes = $adminNotes;
|
||||
/* Check whether function success or not */
|
||||
if ($var->save() == true) {
|
||||
/* redirect to Index page with Success Message */
|
||||
return redirect('groups')->with('success', 'Group Updated Successfully');
|
||||
} else {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('groups')->with('fails', 'Group can not Update');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('groups')->with('fails', 'Groups can not Create');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
* @param type int $id
|
||||
* @param type Groups $group
|
||||
* @param type Group_assign_department $group_assign_department
|
||||
* @return type Response
|
||||
*/
|
||||
public function destroy($id, Groups $group, Group_assign_department $group_assign_department) {
|
||||
try {
|
||||
$group_assign_department->where('group_id', $id)->delete();
|
||||
$groups = $group->whereId($id)->first();
|
||||
/* Check whether function success or not */
|
||||
if ($groups->delete() == true) {
|
||||
/* redirect to Index page with Success Message */
|
||||
return redirect('groups')->with('success', 'Group Deleted Successfully');
|
||||
} else {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('groups')->with('fails', 'Group can not Delete');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('groups')->with('fails', 'Groups can not Create');
|
||||
}
|
||||
}
|
||||
}
|
185
code/app/Http/Controllers/Admin/helpdesk/HelptopicController.php
Normal file
185
code/app/Http/Controllers/Admin/helpdesk/HelptopicController.php
Normal file
@@ -0,0 +1,185 @@
|
||||
<?php namespace App\Http\Controllers\Admin\helpdesk;
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
// requests
|
||||
use App\Http\Requests\helpdesk\HelptopicRequest;
|
||||
use App\Http\Requests\helpdesk\HelptopicUpdate;
|
||||
// models
|
||||
use App\Model\helpdesk\Agent\Agents;
|
||||
use App\Model\helpdesk\Agent\Department;
|
||||
use App\Model\helpdesk\Form\Forms;
|
||||
use App\Model\helpdesk\Manage\Help_topic;
|
||||
use App\Model\helpdesk\Manage\Sla_plan;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Priority;
|
||||
use App\User;
|
||||
|
||||
/**
|
||||
* HelptopicController
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class HelptopicController extends Controller {
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* @return type vodi
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->middleware('auth');
|
||||
$this->middleware('roles');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
* @param type Help_topic $topic
|
||||
* @return type Response
|
||||
*/
|
||||
public function index(Help_topic $topic) {
|
||||
try {
|
||||
$topics = $topic->get();
|
||||
return view('themes.default1.admin.helpdesk.manage.helptopic.index', compact('topics'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
* @param type Priority $priority
|
||||
* @param type Department $department
|
||||
* @param type Help_topic $topic
|
||||
* @param type Form_name $form
|
||||
* @param type Agents $agent
|
||||
* @param type Sla_plan $sla
|
||||
* @return type Response
|
||||
*/
|
||||
/*
|
||||
================================================
|
||||
| Route to Create view file passing Model Values
|
||||
| 1.Department Model
|
||||
| 2.Help_topic Model
|
||||
| 3.Agents Model
|
||||
| 4.Sla_plan Model
|
||||
| 5.Forms Model
|
||||
================================================
|
||||
*/
|
||||
public function create(Ticket_Priority $priority, Department $department, Help_topic $topic, Forms $form, User $agent, Sla_plan $sla) {
|
||||
try {
|
||||
$departments = $department->get();
|
||||
$topics = $topic->get();
|
||||
$forms = $form->get();
|
||||
$agents = $agent->where('role','=','agent')->get();
|
||||
$slas = $sla->get();
|
||||
$priority = $priority->get();
|
||||
return view('themes.default1.admin.helpdesk.manage.helptopic.create', compact('priority', 'departments', 'topics', 'forms', 'agents', 'slas'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
* @param type Help_topic $topic
|
||||
* @param type HelptopicRequest $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function store(Help_topic $topic, HelptopicRequest $request) {
|
||||
try {
|
||||
/* Check whether function success or not */
|
||||
if ($topic->fill($request->input())->save() == true) {
|
||||
/* redirect to Index page with Success Message */
|
||||
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) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('helptopic')->with('fails', 'Helptopic can not Create');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return Response
|
||||
*/
|
||||
public function show($id) {
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
* @param type $id
|
||||
* @param type Priority $priority
|
||||
* @param type Department $department
|
||||
* @param type Help_topic $topic
|
||||
* @param type Form_name $form
|
||||
* @param type Agents $agent
|
||||
* @param type Sla_plan $sla
|
||||
* @return type Response
|
||||
*/
|
||||
public function edit($id, Ticket_Priority $priority, Department $department, Help_topic $topic, Forms $form, Sla_plan $sla) {
|
||||
try {
|
||||
$agents = User::where('role','=','agent')->get();
|
||||
$departments = $department->get();
|
||||
$topics = $topic->whereId($id)->first();
|
||||
$forms = $form->get();
|
||||
$slas = $sla->get();
|
||||
$priority = $priority->get();
|
||||
return view('themes.default1.admin.helpdesk.manage.helptopic.edit', compact('priority', 'departments', 'topics', 'forms', 'agents', 'slas'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
* @param type $id
|
||||
* @param type Help_topic $topic
|
||||
* @param type HelptopicUpdate $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function update($id, Help_topic $topic, HelptopicUpdate $request) {
|
||||
try {
|
||||
$topics = $topic->whereId($id)->first();
|
||||
/* Check whether function success or not */
|
||||
if ($topics->fill($request->input())->save() == true) {
|
||||
/* redirect to Index page with Success Message */
|
||||
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) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('helptopic')->with('fails', 'Helptopic can not Create');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
* @param type int $id
|
||||
* @param type Help_topic $topic
|
||||
* @return type Response
|
||||
*/
|
||||
public function destroy($id, Help_topic $topic) {
|
||||
try {
|
||||
$topics = $topic->whereId($id)->first();
|
||||
/* Check whether function success or not */
|
||||
if ($topics->delete() == true) {
|
||||
/* redirect to Index page with Success Message */
|
||||
return redirect('helptopic')->with('success', 'Helptopic Deleted Successfully');
|
||||
} else {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('helptopic')->with('fails', 'Helptopic can not Delete');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('helptopic')->with('fails', 'Helptopic can not Create');
|
||||
}
|
||||
}
|
||||
}
|
34
code/app/Http/Controllers/Admin/helpdesk/HomeController.php
Normal file
34
code/app/Http/Controllers/Admin/helpdesk/HomeController.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php namespace App\Http\Controllers\Admin\helpdesk;
|
||||
|
||||
/**
|
||||
* -----------------------------------------------
|
||||
* HelptopicController
|
||||
* -----------------------------------------------
|
||||
* This controller renders your application's "dashboard" for users that
|
||||
* are authenticated. Of course, you are free to change or remove the
|
||||
* controller as you wish. It is just here to get your app started!
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class HomeController extends Controller {
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->middleware('auth');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the application dashboard to the user.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function index() {
|
||||
return view('themes/default1/admin/dashboard');
|
||||
}
|
||||
|
||||
}
|
122
code/app/Http/Controllers/Admin/helpdesk/ProfileController.php
Normal file
122
code/app/Http/Controllers/Admin/helpdesk/ProfileController.php
Normal file
@@ -0,0 +1,122 @@
|
||||
<?php namespace App\Http\Controllers\Admin\helpdesk;
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
// requests
|
||||
use App\Http\Requests\ProfilePassword;
|
||||
use App\Http\Requests\ProfileRequest;
|
||||
// models
|
||||
use App\User;
|
||||
// classes
|
||||
use Auth;
|
||||
use Hash;
|
||||
use Input;
|
||||
|
||||
/**
|
||||
* ProfileController
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class ProfileController extends Controller {
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* @return type void
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->middleware('auth');
|
||||
$this->middleware('roles');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get profile page
|
||||
* @return type Response
|
||||
*/
|
||||
public function getProfile() {
|
||||
try {
|
||||
$user = Auth::user();
|
||||
if ($user) {
|
||||
return view('themes.default1.agent.helpdesk.user.profile', compact('user'));
|
||||
} else {
|
||||
return redirect('404');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
return redirect('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get profile Edit page
|
||||
* @return type Response
|
||||
*/
|
||||
public function getProfileedit() {
|
||||
try {
|
||||
$user = Auth::user();
|
||||
if ($user) {
|
||||
return view('themes.default1.agent.helpdesk.user.profile-edit', compact('user'));
|
||||
} else {
|
||||
return redirect('404');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
return redirect('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Post profile page
|
||||
* @param type int $id
|
||||
* @param type ProfileRequest $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function postProfile($id, ProfileRequest $request) {
|
||||
$user = Auth::user();
|
||||
$user->gender = $request->input('gender');
|
||||
$user->save();
|
||||
if ($user->profile_pic == 'avatar5.png' || $user->profile_pic == 'avatar2.png') {
|
||||
if ($request->input('gender') == 1) {
|
||||
$name = 'avatar5.png';
|
||||
$destinationPath = 'lb-faveo/profilepic';
|
||||
$user->profile_pic = $name;
|
||||
} elseif ($request->input('gender') == 0) {
|
||||
$name = 'avatar2.png';
|
||||
$destinationPath = 'lb-faveo/profilepic';
|
||||
$user->profile_pic = $name;
|
||||
}
|
||||
}
|
||||
if (Input::file('profile_pic')) {
|
||||
//$extension = Input::file('profile_pic')->getClientOriginalExtension();
|
||||
$name = Input::file('profile_pic')->getClientOriginalName();
|
||||
$destinationPath = 'lb-faveo/profilepic';
|
||||
$fileName = rand(0000, 9999) . '.' . $name;
|
||||
//echo $fileName;
|
||||
Input::file('profile_pic')->move($destinationPath, $fileName);
|
||||
$user->profile_pic = $fileName;
|
||||
} else {
|
||||
$user->fill($request->except('profile_pic', 'gender'))->save();
|
||||
return redirect('guest')->with('success', 'Profile Updated sucessfully');
|
||||
}
|
||||
if ($user->fill($request->except('profile_pic'))->save()) {
|
||||
return redirect('guest')->with('success', 'Profile Updated sucessfully');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Post Profile password page
|
||||
* @param type int $id
|
||||
* @param type User $user
|
||||
* @param type ProfilePassword $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function postProfilePassword($id, User $user, ProfilePassword $request) {
|
||||
$user = Auth::user();
|
||||
//echo $user->password;
|
||||
if (Hash::check($request->input('old_password'), $user->getAuthPassword())) {
|
||||
$user->password = Hash::make($request->input('new_password'));
|
||||
$user->save();
|
||||
return redirect('guest')->with('success', 'Password Updated sucessfully');
|
||||
} else {
|
||||
return redirect('guest')->with('fails', 'Password was not Updated');
|
||||
}
|
||||
}
|
||||
}
|
435
code/app/Http/Controllers/Admin/helpdesk/SettingsController.php
Normal file
435
code/app/Http/Controllers/Admin/helpdesk/SettingsController.php
Normal file
@@ -0,0 +1,435 @@
|
||||
<?php namespace App\Http\Controllers\Admin\helpdesk;
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
// requests
|
||||
use App\Http\Requests\helpdesk\CompanyRequest;
|
||||
use App\Http\Requests\helpdesk\EmailRequest;
|
||||
use App\Http\Requests\helpdesk\SystemRequest;
|
||||
// models
|
||||
use App\Model\helpdesk\Agent\Department;
|
||||
use App\Model\helpdesk\Email\Emails;
|
||||
use App\Model\helpdesk\Email\Template;
|
||||
use App\Model\helpdesk\Manage\Help_topic;
|
||||
use App\Model\helpdesk\Manage\Sla_plan;
|
||||
use App\Model\helpdesk\Settings\Access;
|
||||
use App\Model\helpdesk\Settings\Alert;
|
||||
use App\Model\helpdesk\Settings\Company;
|
||||
use App\Model\helpdesk\Settings\Email;
|
||||
use App\Model\helpdesk\Settings\Responder;
|
||||
use App\Model\helpdesk\Settings\System;
|
||||
use App\Model\helpdesk\Settings\Ticket;
|
||||
use App\Model\helpdesk\Utility\Date_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\Utility\Timezones;
|
||||
use App\Model\helpdesk\Utility\Time_format;
|
||||
// classes
|
||||
use Illuminate\Http\Request;
|
||||
use Input;
|
||||
|
||||
/**
|
||||
* SettingsController
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class SettingsController extends Controller {
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
// $this->smtp();
|
||||
$this->middleware('auth');
|
||||
$this->middleware('roles');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
* @return Response
|
||||
* @param $compant instance of company table
|
||||
*
|
||||
* get the form for company setting page
|
||||
*/
|
||||
public function getcompany(Company $company) {
|
||||
try {
|
||||
/* fetch the values of company from company table */
|
||||
$companys = $company->whereId('1')->first();
|
||||
/* Direct to Company Settings Page */
|
||||
return view('themes.default1.admin.helpdesk.settings.company', compact('companys'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
* @param type int $id
|
||||
* @param type Company $company
|
||||
* @param type CompanyRequest $request
|
||||
* @return Response
|
||||
*/
|
||||
public function postcompany($id, Company $company, CompanyRequest $request) {
|
||||
try {
|
||||
/* fetch the values of company request */
|
||||
$companys = $company->whereId('1')->first();
|
||||
if (Input::file('logo')) {
|
||||
$name = Input::file('logo')->getClientOriginalName();
|
||||
$destinationPath = 'dist';
|
||||
$fileName = rand(0000, 9999) . '.' . $name;
|
||||
Input::file('logo')->move($destinationPath, $fileName);
|
||||
$companys->logo = $fileName;
|
||||
}
|
||||
if($request->input('use_logo')==null)
|
||||
{
|
||||
$companys->use_logo = '0';
|
||||
}
|
||||
/* Check whether function success or not */
|
||||
if ($companys->fill($request->except('logo'))->save() == true) {
|
||||
/* redirect to Index page with Success Message */
|
||||
return redirect('getcompany')->with('success', 'Company Updated Successfully');
|
||||
} else {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('getcompany')->with('fails', 'Company can not Updated');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('getcompany')->with('fails', 'Company can not Updated');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get the form for System setting page
|
||||
* @param type System $system
|
||||
* @param type Department $department
|
||||
* @param type Timezones $timezone
|
||||
* @param type Date_format $date
|
||||
* @param type Date_time_format $date_time
|
||||
* @param type Time_format $time
|
||||
* @param type Logs $log
|
||||
* @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) {
|
||||
try {
|
||||
/* fetch the values of system from system table */
|
||||
$systems = $system->whereId('1')->first();
|
||||
/* Fetch the values from Department table */
|
||||
$departments = $department->get();
|
||||
/* Fetch the values from Timezones table */
|
||||
$timezones = $timezone->get();
|
||||
/* Direct to System Settings Page */
|
||||
return view('themes.default1.admin.helpdesk.settings.system', compact('systems', 'departments', 'timezones', 'time', 'date', 'date_time', 'log'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
* @param type int $id
|
||||
* @param type System $system
|
||||
* @param type SystemRequest $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function postsystem($id, System $system, SystemRequest $request) {
|
||||
try {
|
||||
/* fetch the values of system request */
|
||||
$systems = $system->whereId('1')->first();
|
||||
/* fill the values to coompany table */
|
||||
/* Check whether function success or not */
|
||||
if ($systems->fill($request->input())->save() == true) {
|
||||
/* redirect to Index page with Success Message */
|
||||
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) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('getsystem')->with('fails', 'System can not Updated');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get the form for Ticket setting page
|
||||
* @param type Ticket $ticket
|
||||
* @param type Sla_plan $sla
|
||||
* @param type Help_topic $topic
|
||||
* @param type Priority $priority
|
||||
* @return type Response
|
||||
*/
|
||||
public function getticket(Ticket $ticket, Sla_plan $sla, Help_topic $topic, Ticket_Priority $priority) {
|
||||
try {
|
||||
/* fetch the values of ticket from ticket table */
|
||||
$tickets = $ticket->whereId('1')->first();
|
||||
/* Fetch the values from SLA Plan table */
|
||||
$slas = $sla->get();
|
||||
/* Fetch the values from Help_topic table */
|
||||
$topics = $topic->get();
|
||||
/* Direct to Ticket Settings Page */
|
||||
return view('themes.default1.admin.helpdesk.settings.ticket', compact('tickets', 'slas', 'topics', 'priority'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
* @param type int $id
|
||||
* @param type Ticket $ticket
|
||||
* @param type Request $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function postticket($id, Ticket $ticket, Request $request) {
|
||||
try {
|
||||
/* fetch the values of ticket request */
|
||||
$tickets = $ticket->whereId('1')->first();
|
||||
/* fill the values to coompany table */
|
||||
$tickets->fill($request->except('captcha', 'claim_response', 'assigned_ticket', 'answered_ticket', 'agent_mask', 'html', 'client_update'))->save();
|
||||
/* insert checkbox to Database */
|
||||
$tickets->captcha = $request->input('captcha');
|
||||
$tickets->claim_response = $request->input('claim_response');
|
||||
$tickets->assigned_ticket = $request->input('assigned_ticket');
|
||||
$tickets->answered_ticket = $request->input('answered_ticket');
|
||||
$tickets->agent_mask = $request->input('agent_mask');
|
||||
$tickets->html = $request->input('html');
|
||||
$tickets->client_update = $request->input('client_update');
|
||||
/* Check whether function success or not */
|
||||
if ($tickets->save() == true) {
|
||||
/* redirect to Index page with Success Message */
|
||||
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) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('getticket')->with('fails', 'Ticket can not Updated');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get the form for Email setting page
|
||||
* @param type Email $email
|
||||
* @param type Template $template
|
||||
* @param type Emails $email1
|
||||
* @return type Response
|
||||
*/
|
||||
public function getemail(Email $email, Template $template, Emails $email1) {
|
||||
try {
|
||||
/* fetch the values of email from Email table */
|
||||
$emails = $email->whereId('1')->first();
|
||||
/* Fetch the values from Template table */
|
||||
$templates = $template->get();
|
||||
/* Fetch the values from Emails table */
|
||||
$emails1 = $email1->get();
|
||||
/* Direct to Email Settings Page */
|
||||
return view('themes.default1.admin.helpdesk.settings.email', compact('emails', 'templates', 'emails1'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
* @param type int $id
|
||||
* @param type Email $email
|
||||
* @param type EmailRequest $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function postemail($id, Email $email, EmailRequest $request) {
|
||||
try {
|
||||
/* fetch the values of email request */
|
||||
$emails = $email->whereId('1')->first();
|
||||
/* fill the values to email table */
|
||||
$emails->fill($request->except('email_fetching', 'all_emails', 'email_collaborator', 'strip', 'attachment'))->save();
|
||||
/* insert checkboxes to database */
|
||||
$emails->email_fetching = $request->input('email_fetching');
|
||||
$emails->all_emails = $request->input('all_emails');
|
||||
$emails->email_collaborator = $request->input('email_collaborator');
|
||||
$emails->strip = $request->input('strip');
|
||||
$emails->attachment = $request->input('attachment');
|
||||
/* Check whether function success or not */
|
||||
if ($emails->save() == true) {
|
||||
/* redirect to Index page with Success Message */
|
||||
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) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('getemail')->with('fails', 'Email can not Updated');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get the form for Access setting page
|
||||
* @param type Access $access
|
||||
* @return type Response
|
||||
*/
|
||||
// public function getaccess(Access $access) {
|
||||
// try {
|
||||
// /* fetch the values of access from access table */
|
||||
// $accesses = $access->whereId('1')->first();
|
||||
// // Direct to Access Settings Page
|
||||
// return view('themes.default1.admin.helpdesk.settings.access', compact('accesses'));
|
||||
// } catch (Exception $e) {
|
||||
// return view('404');
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
* @param type Access $access
|
||||
* @param type Request $request
|
||||
* @return type Response
|
||||
*/
|
||||
// public function postaccess(Access $access, Request $request) {
|
||||
// try {
|
||||
// /* fetch the values of access request */
|
||||
// $accesses = $access->whereId('1')->first();
|
||||
// /* fill the values to access table */
|
||||
// $accesses->fill($request->except('password_reset', 'bind_agent_ip', 'reg_require', 'quick_access'))->save();
|
||||
// /* insert checkbox value to DB */
|
||||
// $accesses->password_reset = $request->input('password_reset');
|
||||
// $accesses->bind_agent_ip = $request->input('bind_agent_ip');
|
||||
// $accesses->reg_require = $request->input('reg_require');
|
||||
// $accesses->quick_access = $request->input('quick_access');
|
||||
// /* Check whether function success or not */
|
||||
// if ($accesses->save() == true) {
|
||||
// /* redirect to Index page with Success Message */
|
||||
// return redirect('getaccess')->with('success', 'Access Updated Successfully');
|
||||
// } else {
|
||||
// /* redirect to Index page with Fails Message */
|
||||
// return redirect('getaccess')->with('fails', 'Access can not Updated');
|
||||
// }
|
||||
// } catch (Exception $e) {
|
||||
// /* redirect to Index page with Fails Message */
|
||||
// return redirect('getaccess')->with('fails', 'Access can not Updated');
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* get the form for Responder setting page
|
||||
* @param type Responder $responder
|
||||
* @return type Response
|
||||
*/
|
||||
public function getresponder(Responder $responder) {
|
||||
try {
|
||||
/* fetch the values of responder from responder table */
|
||||
$responders = $responder->whereId('1')->first();
|
||||
/* Direct to Responder Settings Page */
|
||||
return view('themes.default1.admin.helpdesk.settings.responder', compact('responders'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
* @param type Responder $responder
|
||||
* @param type Request $request
|
||||
* @return type
|
||||
*/
|
||||
public function postresponder(Responder $responder, Request $request) {
|
||||
try {
|
||||
/* fetch the values of responder request */
|
||||
$responders = $responder->whereId('1')->first();
|
||||
/* insert Checkbox value to DB */
|
||||
$responders->new_ticket = $request->input('new_ticket');
|
||||
$responders->agent_new_ticket = $request->input('agent_new_ticket');
|
||||
$responders->submitter = $request->input('submitter');
|
||||
$responders->participants = $request->input('participants');
|
||||
$responders->overlimit = $request->input('overlimit');
|
||||
/* fill the values to coompany table */
|
||||
/* Check whether function success or not */
|
||||
if ($responders->save() == true) {
|
||||
/* redirect to Index page with Success Message */
|
||||
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) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('getresponder')->with('fails', 'Responder can not Updated');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get the form for Alert setting page
|
||||
* @param type Alert $alert
|
||||
* @return type Response
|
||||
*/
|
||||
public function getalert(Alert $alert) {
|
||||
try {
|
||||
/* fetch the values of alert from alert table */
|
||||
$alerts = $alert->whereId('1')->first();
|
||||
/* Direct to Alert Settings Page */
|
||||
return view('themes.default1.admin.helpdesk.settings.alert', compact('alerts'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
* @param type $id
|
||||
* @param type Alert $alert
|
||||
* @param type Request $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function postalert($id, Alert $alert, Request $request) {
|
||||
try {
|
||||
/* fetch the values of alert request */
|
||||
$alerts = $alert->whereId('1')->first();
|
||||
/* Insert Checkbox to DB */
|
||||
$alerts->assignment_status = $request->input('assignment_status');
|
||||
$alerts->ticket_status = $request->input('ticket_status');
|
||||
$alerts->overdue_department_member = $request->input('overdue_department_member');
|
||||
$alerts->sql_error = $request->input('sql_error');
|
||||
$alerts->excessive_failure = $request->input('excessive_failure');
|
||||
$alerts->overdue_status = $request->input('overdue_status');
|
||||
$alerts->overdue_assigned_agent = $request->input('overdue_assigned_agent');
|
||||
$alerts->overdue_department_manager = $request->input('overdue_department_manager');
|
||||
$alerts->internal_status = $request->input('internal_status');
|
||||
$alerts->internal_last_responder = $request->input('internal_last_responder');
|
||||
$alerts->internal_assigned_agent = $request->input('internal_assigned_agent');
|
||||
$alerts->internal_department_manager = $request->input('internal_department_manager');
|
||||
$alerts->assignment_assigned_agent = $request->input('assignment_assigned_agent');
|
||||
$alerts->assignment_team_leader = $request->input('assignment_team_leader');
|
||||
$alerts->assignment_team_member = $request->input('assignment_team_member');
|
||||
$alerts->system_error = $request->input('system_error');
|
||||
$alerts->transfer_department_member = $request->input('transfer_department_member');
|
||||
$alerts->transfer_department_manager = $request->input('transfer_department_manager');
|
||||
$alerts->transfer_assigned_agent = $request->input('transfer_assigned_agent');
|
||||
$alerts->transfer_status = $request->input('transfer_status');
|
||||
$alerts->message_organization_accmanager = $request->input('message_organization_accmanager');
|
||||
$alerts->message_department_manager = $request->input('message_department_manager');
|
||||
$alerts->message_assigned_agent = $request->input('message_assigned_agent');
|
||||
$alerts->message_last_responder = $request->input('message_last_responder');
|
||||
$alerts->message_status = $request->input('message_status');
|
||||
$alerts->ticket_organization_accmanager = $request->input('ticket_organization_accmanager');
|
||||
$alerts->ticket_department_manager = $request->input('ticket_department_manager');
|
||||
$alerts->ticket_department_member = $request->input('ticket_department_member');
|
||||
$alerts->ticket_admin_email = $request->input('ticket_admin_email');
|
||||
/* fill the values to coompany table */
|
||||
/* Check whether function success or not */
|
||||
if ($alerts->save() == true) {
|
||||
/* redirect to Index page with Success Message */
|
||||
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) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('getalert')->with('fails', 'Alert can not Updated');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
161
code/app/Http/Controllers/Admin/helpdesk/SlaController.php
Normal file
161
code/app/Http/Controllers/Admin/helpdesk/SlaController.php
Normal file
@@ -0,0 +1,161 @@
|
||||
<?php namespace App\Http\Controllers\Admin\helpdesk;
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
// requests
|
||||
use App\Http\Requests\helpdesk\SlaRequest;
|
||||
use App\Http\Requests\helpdesk\SlaUpdate;
|
||||
// models
|
||||
use App\Model\helpdesk\Manage\Sla_plan;
|
||||
|
||||
/**
|
||||
* SlaController
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class SlaController extends Controller {
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* @return type void
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->middleware('auth');
|
||||
$this->middleware('roles');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
* @param type Sla_plan $sla
|
||||
* @return type Response
|
||||
*/
|
||||
public function index(Sla_plan $sla) {
|
||||
try {
|
||||
/* Declare a Variable $slas to store all Values From Sla_plan Table */
|
||||
$slas = $sla->get();
|
||||
/* Listing the values From Sla_plan Table */
|
||||
return view('themes.default1.admin.helpdesk.manage.sla.index', compact('slas'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
* @return type Response
|
||||
*/
|
||||
public function create() {
|
||||
try {
|
||||
/* Direct to Create Page */
|
||||
return view('themes.default1.admin.helpdesk.manage.sla.create');
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
* @param type Sla_plan $sla
|
||||
* @param type SlaRequest $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function store(Sla_plan $sla, SlaRequest $request) {
|
||||
try {
|
||||
/* Fill the request values to Sla_plan Table */
|
||||
/* Check whether function success or not */
|
||||
if ($sla->fill($request->input())->save() == true) {
|
||||
/* redirect to Index page with Success Message */
|
||||
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) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('sla')->with('fails', 'SLA Plan can not Create');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return Response
|
||||
*/
|
||||
public function show($id) {
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
* @param type int $id
|
||||
* @param type Sla_plan $sla
|
||||
* @return type Response
|
||||
*/
|
||||
public function edit($id, Sla_plan $sla) {
|
||||
try {
|
||||
/* Direct to edit page along values of perticular field using Id */
|
||||
$slas = $sla->whereId($id)->first();
|
||||
$slas->get();
|
||||
return view('themes.default1.admin.helpdesk.manage.sla.edit', compact('slas'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
* @param type int $id
|
||||
* @param type Sla_plan $sla
|
||||
* @param type SlaUpdate $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function update($id, Sla_plan $sla, SlaUpdate $request) {
|
||||
try {
|
||||
/* Fill values to selected field using Id except Check box */
|
||||
$slas = $sla->whereId($id)->first();
|
||||
$slas->fill($request->except('transient', 'ticket_overdue'))->save();
|
||||
/* Update transient checkox field */
|
||||
$slas->transient = $request->input('transient');
|
||||
/* Update ticket_overdue checkox field */
|
||||
$slas->ticket_overdue = $request->input('ticket_overdue');
|
||||
/* Check whether function success or not */
|
||||
if ($slas->save() == true) {
|
||||
/* redirect to Index page with Success Message */
|
||||
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) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('sla')->with('fails', 'SLA Plan can not Update');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
* @param type int $id
|
||||
* @param type Sla_plan $sla
|
||||
* @return type Response
|
||||
*/
|
||||
public function destroy($id, Sla_plan $sla) {
|
||||
try {
|
||||
/* Delete a perticular field from the database by delete() using Id */
|
||||
$slas = $sla->whereId($id)->first();
|
||||
/* Check whether function success or not */
|
||||
if ($slas->delete() == true) {
|
||||
/* redirect to Index page with Success Message */
|
||||
return redirect('sla')->with('success', 'SLA Plan Deleted Successfully');
|
||||
} else {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('sla')->with('fails', 'SLA Plan can not Delete');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('sla')->with('fails', 'SLA Plan can not Delete');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
167
code/app/Http/Controllers/Admin/helpdesk/TeamController.php
Normal file
167
code/app/Http/Controllers/Admin/helpdesk/TeamController.php
Normal file
@@ -0,0 +1,167 @@
|
||||
<?php namespace App\Http\Controllers\Admin\helpdesk;
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
// requests
|
||||
use App\Http\Requests\helpdesk\TeamRequest;
|
||||
use App\Http\Requests\helpdesk\TeamUpdate;
|
||||
// models
|
||||
use App\Model\helpdesk\Agent\Assign_team_agent;
|
||||
use App\Model\helpdesk\Agent\Teams;
|
||||
use App\User;
|
||||
|
||||
/**
|
||||
* TeamController
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class TeamController extends Controller {
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* @return type void
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->middleware('auth');
|
||||
$this->middleware('roles');
|
||||
}
|
||||
|
||||
/**
|
||||
* get Index page
|
||||
* @param type Teams $team
|
||||
* @param type Assign_team_agent $assign_team_agent
|
||||
* @return type Response
|
||||
*/
|
||||
public function index(Teams $team, Assign_team_agent $assign_team_agent) {
|
||||
try {
|
||||
$teams = $team->get();
|
||||
/* find out the Number of Members in the Team */
|
||||
$id = $teams->lists('id');
|
||||
$assign_team_agent = $assign_team_agent->get();
|
||||
return view('themes.default1.admin.helpdesk.agent.teams.index', compact('assign_team_agent', 'teams'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
* @param type User $user
|
||||
* @return type Response
|
||||
*/
|
||||
public function create(User $user) {
|
||||
try {
|
||||
$user = $user->get();
|
||||
return view('themes.default1.admin.helpdesk.agent.teams.create', compact('user'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
* @param type Teams $team
|
||||
* @param type TeamRequest $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function store(Teams $team, TeamRequest $request) {
|
||||
try {
|
||||
/* Check whether function success or not */
|
||||
if ($team->fill($request->input())->save() == true) {
|
||||
/* redirect to Index page with Success Message */
|
||||
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) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('teams')->with('fails', 'Teams can not Create');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return Response
|
||||
*/
|
||||
public function show($id) {
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
* @param type $id
|
||||
* @param type User $user
|
||||
* @param type Assign_team_agent $assign_team_agent
|
||||
* @param type Teams $team
|
||||
* @return type Response
|
||||
*/
|
||||
public function edit($id, User $user, Assign_team_agent $assign_team_agent, Teams $team) {
|
||||
try {
|
||||
$user = $user->whereId($id)->first();
|
||||
$teams = $team->whereId($id)->first();
|
||||
$agent_team = $assign_team_agent->where('team_id', $id)->get();
|
||||
$agent_id = $agent_team->lists('agent_id', 'agent_id');
|
||||
return view('themes.default1.admin.helpdesk.agent.teams.edit', compact('agent_id', 'user', 'teams', 'allagents'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
* @param type int $id
|
||||
* @param type Teams $team
|
||||
* @param type TeamUpdate $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function update($id, Teams $team, TeamUpdate $request) {
|
||||
try {
|
||||
$teams = $team->whereId($id)->first();
|
||||
//updating check box
|
||||
$alert = $request->input('assign_alert');
|
||||
$teams->assign_alert = $alert;
|
||||
$teams->save(); //saving check box
|
||||
//updating whole field
|
||||
/* Check whether function success or not */
|
||||
if ($teams->fill($request->input())->save() == true) {
|
||||
/* redirect to Index page with Success Message */
|
||||
return redirect('teams')->with('success', 'Teams Updated Successfully');
|
||||
} else {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('teams')->with('fails', 'Teams can not Update');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('teams')->with('fails', 'Teams can not Update');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
* @param type int $id
|
||||
* @param type Teams $team
|
||||
* @param type Assign_team_agent $assign_team_agent
|
||||
* @return type Response
|
||||
*/
|
||||
public function destroy($id, Teams $team, Assign_team_agent $assign_team_agent) {
|
||||
try {
|
||||
$assign_team_agent->where('team_id', $id)->delete();
|
||||
$teams = $team->whereId($id)->first();
|
||||
/* Check whether function success or not */
|
||||
if ($teams->delete() == true) {
|
||||
/* redirect to Index page with Success Message */
|
||||
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) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('teams')->with('fails', 'Teams can not Delete');
|
||||
}
|
||||
}
|
||||
}
|
192
code/app/Http/Controllers/Admin/helpdesk/TemplateController.php
Normal file
192
code/app/Http/Controllers/Admin/helpdesk/TemplateController.php
Normal file
@@ -0,0 +1,192 @@
|
||||
<?php namespace App\Http\Controllers\Admin\helpdesk;
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Controllers\Common\SettingsController;
|
||||
// requests
|
||||
use App\Http\Requests\helpdesk\TemplateRequest;
|
||||
use App\Http\Requests\helpdesk\TemplateUdate;
|
||||
// models
|
||||
use App\Model\helpdesk\Email\Emails;
|
||||
use App\Model\helpdesk\Email\Template;
|
||||
use App\Model\helpdesk\Utility\Languages;
|
||||
// classes
|
||||
use Illuminate\Http\Request;
|
||||
use Mail;
|
||||
|
||||
/**
|
||||
* TemplateController
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class TemplateController extends Controller {
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* @return type void
|
||||
*/
|
||||
public function __construct() {
|
||||
SettingsController::smtp();
|
||||
$this->middleware('auth');
|
||||
$this->middleware('roles');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
* @param type Template $template
|
||||
* @return type Response
|
||||
*/
|
||||
public function index(Template $template) {
|
||||
try {
|
||||
$templates = $template->get();
|
||||
return view('themes.default1.admin.helpdesk.emails.template.index', compact('templates'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
* @param type Languages $language
|
||||
* @param type Template $template
|
||||
* @return type Response
|
||||
*/
|
||||
public function create(Languages $language, Template $template) {
|
||||
try {
|
||||
$templates = $template->get();
|
||||
$languages = $language->get();
|
||||
return view('themes.default1.admin.helpdesk.emails.template.create', compact('languages', 'templates'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
* @param type Template $template
|
||||
* @param type TemplateRequest $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function store(Template $template, TemplateRequest $request) {
|
||||
try {
|
||||
/* Check whether function success or not */
|
||||
if ($template->fill($request->input())->save() == true) {
|
||||
/* redirect to Index page with Success Message */
|
||||
return redirect('template')->with('success', 'Teams Created Successfully');
|
||||
} else {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('template')->with('fails', 'Teams can not Create');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('template')->with('fails', 'Teams can not Create');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
* @param int $id
|
||||
* @return Response
|
||||
*/
|
||||
public function show($id) {
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
* @param type $id
|
||||
* @param type Template $template
|
||||
* @param type Languages $language
|
||||
* @return type Response
|
||||
*/
|
||||
public function edit($id, Template $template, Languages $language) {
|
||||
try {
|
||||
$templates = $template->whereId($id)->first();
|
||||
$languages = $language->get();
|
||||
return view('themes.default1.admin.helpdesk.emails.template.edit', compact('templates', 'languages'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
* @param type int $id
|
||||
* @param type Template $template
|
||||
* @param type TemplateUdate $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function update($id, Template $template, TemplateUdate $request) {
|
||||
try {
|
||||
//TODO validation
|
||||
$templates = $template->whereId($id)->first();
|
||||
/* Check whether function success or not */
|
||||
if ($templates->fill($request->input())->save() == true) {
|
||||
/* redirect to Index page with Success Message */
|
||||
return redirect('template')->with('success', 'Teams Updated Successfully');
|
||||
} else {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('template')->with('fails', 'Teams can not Update');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('template')->with('fails', 'Teams can not Update');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
* @param type int $id
|
||||
* @param type Template $template
|
||||
* @return type Response
|
||||
*/
|
||||
public function destroy($id, Template $template) {
|
||||
try {
|
||||
$templates = $template->whereId($id)->first();
|
||||
/* Check whether function success or not */
|
||||
if ($templates->delete() == true) {
|
||||
/* redirect to Index page with Success Message */
|
||||
return redirect('template')->with('success', 'Teams Deleted Successfully');
|
||||
} else {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('template')->with('fails', 'Teams can not Delete');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('template')->with('fails', 'Teams can not Delete');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Form for Email connection checking.
|
||||
* @param type Emails $email
|
||||
* @return type Response
|
||||
*/
|
||||
public function formDiagno(Emails $email) {
|
||||
try {
|
||||
$emails = $email->get();
|
||||
return view('themes.default1.admin.helpdesk.emails.template.formDiagno', compact('emails'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* function to send emails
|
||||
* @param type Request $request
|
||||
* @return type
|
||||
*/
|
||||
public function postDiagno(Request $request) {
|
||||
$email = $request->input('to');
|
||||
if($email == null)
|
||||
{
|
||||
return redirect('getdiagno')->with('fails', 'Please provide E-mail address !');
|
||||
}
|
||||
$mail = Mail::send('themes.default1.admin.helpdesk.emails.template.connection', array('link' => url('getmail'), 'username' => $email), function ($message) use ($email) {
|
||||
$message->to($email)->subject('Checking the connection');
|
||||
});
|
||||
return redirect('getdiagno')->with('success', 'Please check your mail. An E-mail has been sent to your E-mail address');
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,35 @@
|
||||
<?php namespace App\Http\Controllers\Admin\helpdesk;
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
// models
|
||||
use App\Model\helpdesk\Priority;
|
||||
use App\Model\helpdesk\Ticket_thread;
|
||||
|
||||
/**
|
||||
* ThreadController
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class ThreadController extends Controller {
|
||||
|
||||
/**
|
||||
* get the values from ticket_thread Table and direct to view page
|
||||
* @param type Ticket_thread $thread
|
||||
* @param type Priority $priority
|
||||
* @return type Response
|
||||
*/
|
||||
public function getTickets(Ticket_thread $thread, Priority $priority) {
|
||||
try {
|
||||
/* get the values of Ticket_thread from Ticket_thread Table */
|
||||
$threads = $thread->get();
|
||||
/* get the values of priority from Priority Table */
|
||||
$priorities = $priority->get();
|
||||
/* Direct to view page */
|
||||
return view('themes.default1.admin.helpdesk.tickets.ticket', compact('threads', 'priorities'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
}
|
131
code/app/Http/Controllers/Agent/helpdesk/CannedController.php
Normal file
131
code/app/Http/Controllers/Agent/helpdesk/CannedController.php
Normal file
@@ -0,0 +1,131 @@
|
||||
<?php namespace App\Http\Controllers\Agent\helpdesk;
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
// requests
|
||||
use App\Http\Requests\helpdesk\CannedRequest;
|
||||
use App\Http\Requests\helpdesk\CannedUpdateRequest;
|
||||
// model
|
||||
use App\Model\helpdesk\Agent_panel\Canned;
|
||||
use App\User;
|
||||
|
||||
/**
|
||||
* UserController
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class CannedController extends Controller {
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* constructor to check
|
||||
* 1. authentication
|
||||
* 2. user roles
|
||||
* 3. roles must be agent
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->middleware('auth');
|
||||
$this->middleware('role.agent');
|
||||
// $this->middleware('roles');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
* @param type User $user
|
||||
* @return type Response
|
||||
*/
|
||||
public function index() {
|
||||
return view('themes.default1.agent.helpdesk.canned.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
* @return type Response
|
||||
*/
|
||||
public function create() {
|
||||
return view('themes.default1.agent.helpdesk.canned.create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
* @param type User $user
|
||||
* @param type Sys_userRequest $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function store(CannedRequest $request, Canned $canned) {
|
||||
$canned->user_id = \Auth::user()->id;
|
||||
$canned->title = $request->input('title');
|
||||
$canned->message = $request->input('message');
|
||||
$canned->save();
|
||||
return redirect()->route('canned.list')->with('success','Added Successfully');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
* @param type int $id
|
||||
* @param type User $user
|
||||
* @return type Response
|
||||
*/
|
||||
public function edit($id, Canned $canned) {
|
||||
$canned = $canned->where('user_id', '=', \Auth::user()->id)->where('id','=',$id)->first();
|
||||
return view('themes.default1.agent.helpdesk.canned.edit',compact('canned'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
* @param type int $id
|
||||
* @param type User $user
|
||||
* @param type Sys_userUpdate $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function update($id, CannedUpdateRequest $request, Canned $canned) {
|
||||
|
||||
$canned = $canned->where('id','=',$id)->where('user_id', '=', \Auth::user()->id)->first();
|
||||
$canned->user_id = \Auth::user()->id;
|
||||
$canned->title = $request->input('title');
|
||||
$canned->message = $request->input('message');
|
||||
$canned->save();
|
||||
|
||||
return redirect()->route('canned.list')->with('success','Updated Successfully');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
* @param type int $id
|
||||
* @param type User $user
|
||||
* @return type Response
|
||||
*/
|
||||
public function destroy($id, Canned $canned) {
|
||||
/* select the field where id = $id(request Id) */
|
||||
$canned = $canned->whereId($id)->first();
|
||||
/* delete the selected field */
|
||||
/* Check whether function success or not */
|
||||
if ($canned->delete() == true) {
|
||||
/* redirect to Index page with Success Message */
|
||||
return redirect()->route('canned.list')->with('success', 'User Deleted Successfully');
|
||||
} else {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect()->route('canned.list')->with('fails', 'User can not Delete');
|
||||
}
|
||||
return view('themes.default1.agent.helpdesk.canned.destroy');
|
||||
}
|
||||
|
||||
/**
|
||||
* get canned
|
||||
* @param type $id
|
||||
* @return type json
|
||||
*/
|
||||
public function get_canned($id) {
|
||||
if($id != "zzz") {
|
||||
$canned = Canned::where('id','=',$id)->where('user_id','=',\Auth::user()->id)->first();
|
||||
$msg = $canned->message;
|
||||
} else {
|
||||
$msg = "";
|
||||
}
|
||||
return \Response::json($msg);
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,67 @@
|
||||
<?php namespace App\Http\Controllers\Agent\helpdesk;
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
// models
|
||||
use App\Model\helpdesk\Settings\Company;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Collaborator;
|
||||
use App\Model\helpdesk\Email\Emails;
|
||||
use App\User;
|
||||
// classes
|
||||
use DB;
|
||||
use View;
|
||||
use Auth;
|
||||
|
||||
/**
|
||||
* DashboardController
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class DashboardController extends Controller {
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* constructor to check
|
||||
* 1. authentication
|
||||
* 2. user roles
|
||||
* 3. roles must be agent
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->middleware('auth');
|
||||
$this->middleware('role.agent');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
* @return type Response
|
||||
*/
|
||||
public function index() {
|
||||
try {
|
||||
if(Auth::user()->role == "user"){
|
||||
return \Redirect::route('home');
|
||||
}
|
||||
return View::make('themes.default1.agent.helpdesk.dashboard.dashboard');
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ChartData
|
||||
* @return type
|
||||
*/
|
||||
public function ChartData()
|
||||
{
|
||||
$ticketlist = DB::table('tickets')
|
||||
->select(DB::raw('MONTH(updated_at) as month'),
|
||||
DB::raw('count(*) as tickets'))
|
||||
->groupBy('month')
|
||||
->orderBy('month', 'asc')
|
||||
->get();
|
||||
|
||||
return $ticketlist;
|
||||
}
|
||||
|
||||
}
|
228
code/app/Http/Controllers/Agent/helpdesk/MailController.php
Normal file
228
code/app/Http/Controllers/Agent/helpdesk/MailController.php
Normal file
@@ -0,0 +1,228 @@
|
||||
<?php namespace App\Http\Controllers\Agent\helpdesk;
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Controllers\Agent\helpdesk\TicketController;
|
||||
// models
|
||||
use App\User;
|
||||
use App\Model\helpdesk\Email\Emails;
|
||||
use App\Model\helpdesk\Settings\Email;
|
||||
use App\Model\helpdesk\Ticket\Ticket_attachments;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Thread;
|
||||
use App\Model\helpdesk\Settings\System;
|
||||
// classes
|
||||
use PhpImap\Mailbox as ImapMailbox;
|
||||
use PhpImap\IncomingMail;
|
||||
use PhpImap\IncomingMailAttachment;
|
||||
use \ForceUTF8\Encoding;
|
||||
use App;
|
||||
use DB;
|
||||
use Crypt;
|
||||
use Schedule;
|
||||
use File;
|
||||
use Artisan;
|
||||
|
||||
/**
|
||||
* MailController
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class MailController extends Controller {
|
||||
|
||||
/**
|
||||
* constructor
|
||||
* Create a new controller instance.
|
||||
* @param type TicketController $TicketController
|
||||
*/
|
||||
public function __construct(TicketController $TicketController) {
|
||||
$this->TicketController = $TicketController;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reademails
|
||||
* @return type
|
||||
*/
|
||||
public function readmails(Emails $emails, Email $settings_email, System $system)
|
||||
{
|
||||
$path_url = $system->first()->url;
|
||||
if($settings_email->first()->email_fetching == 1)
|
||||
{
|
||||
if($settings_email->first()->all_emails == 1)
|
||||
{
|
||||
$helptopic = $this->TicketController->default_helptopic();
|
||||
$sla = $this->TicketController->default_sla();
|
||||
$email = $emails->get();
|
||||
foreach($email as $e_mail)
|
||||
{
|
||||
$dept = $e_mail->department;
|
||||
$host = $e_mail->fetching_host;
|
||||
$port = $e_mail->fetching_port;
|
||||
$protocol = $e_mail->mailbox_protocol;
|
||||
$imap_config = '{'.$host.':'.$port.$protocol.'}INBOX';
|
||||
|
||||
$password = Crypt::decrypt($e_mail->password);
|
||||
$mailbox = new ImapMailbox($imap_config, $e_mail->user_name, $password, __DIR__);
|
||||
$mails = array();
|
||||
$mailsIds = $mailbox->searchMailBox('SINCE '. date('d-M-Y', strtotime("-1 day")));
|
||||
if(!$mailsIds) {
|
||||
die('Mailbox is empty');
|
||||
}
|
||||
// dd($mailsIds);
|
||||
foreach($mailsIds as $mailId)
|
||||
{
|
||||
$overview = $mailbox->get_overview($mailId);
|
||||
$var = $overview[0]->seen ? 'read' : 'unread';
|
||||
if ($var == 'unread') {
|
||||
$mail = $mailbox->getMail($mailId);
|
||||
if($settings_email->email_collaborator == 1) {
|
||||
$collaborator = $mail->cc;
|
||||
} else {
|
||||
$collaborator = null;
|
||||
}
|
||||
$body = $mail->textHtml;
|
||||
// dd($mailId);
|
||||
if($body == null)
|
||||
{
|
||||
$body = $mailbox->backup_getmail($mailId);
|
||||
$body = str_replace('\r\n', '<br/>', $body);
|
||||
// var_dump($body);
|
||||
}
|
||||
// dd($body);
|
||||
$date = $mail->date;
|
||||
$datetime = $overview[0]->date;
|
||||
$date_time = explode(" ", $datetime);
|
||||
$date = $date_time[1] . "-" . $date_time[2] . "-" . $date_time[3] . " " . $date_time[4];
|
||||
$date = date('Y-m-d H:i:s', strtotime($date));
|
||||
|
||||
if(isset($mail->subject)){
|
||||
$subject = $mail->subject;
|
||||
} else {
|
||||
$subject = "No Subject";
|
||||
}
|
||||
|
||||
$fromname = $mail->fromName;
|
||||
$fromaddress = $mail->fromAddress;
|
||||
$source = "2";
|
||||
$phone = "";
|
||||
$priority = '1';
|
||||
$assign = "";
|
||||
$form_data = null;
|
||||
if ($this->TicketController->create_user($fromaddress, $fromname, $subject, $body, $phone, $helptopic, $sla, $priority, $source, $collaborator, $dept, $assign, $form_data) == true) {
|
||||
$thread_id = Ticket_Thread::whereRaw('id = (select max(`id`) from ticket_thread)')->first();
|
||||
$thread_id = $thread_id->id;
|
||||
|
||||
foreach($mail->getAttachments() as $attachment)
|
||||
{
|
||||
$support = "support";
|
||||
// echo $_SERVER['DOCUMENT_ROOT'];
|
||||
$dir_img_paths = __DIR__;
|
||||
$dir_img_path = explode('/code', $dir_img_paths);
|
||||
$filepath = explode('../../../../../public/',$attachment->filePath);
|
||||
$path = $dir_img_path[0]."/code/public/".$filepath[1];
|
||||
// dd($path);
|
||||
$filesize = filesize($path);
|
||||
$file_data = file_get_contents($path);
|
||||
$ext = pathinfo($attachment->filePath, PATHINFO_EXTENSION);
|
||||
$imageid = $attachment->id;
|
||||
$string = str_replace('-', '', $attachment->name);
|
||||
$filename = explode('src', $attachment->filePath);
|
||||
$filename = str_replace('\\', '', $filename);
|
||||
$body = str_replace("cid:".$imageid, $filepath[1], $body);
|
||||
$pos = strpos($body, $filepath[1]);
|
||||
|
||||
if($pos == false) {
|
||||
|
||||
if($settings_email->first()->attachment == 1) {
|
||||
$upload = new Ticket_attachments;
|
||||
$upload->file = $file_data;
|
||||
$upload->thread_id = $thread_id;
|
||||
$upload->name = $filepath[1];
|
||||
$upload->type = $ext;
|
||||
$upload->size = $filesize;
|
||||
$upload->poster = "ATTACHMENT";
|
||||
$upload->save();
|
||||
}
|
||||
} else {
|
||||
$upload = new Ticket_attachments;
|
||||
$upload->file = $file_data;
|
||||
$upload->thread_id = $thread_id;
|
||||
$upload->name = $filepath[1];
|
||||
$upload->type = $ext;
|
||||
$upload->size = $filesize;
|
||||
$upload->poster = "INLINE";
|
||||
$upload->save();
|
||||
}
|
||||
unlink($path);
|
||||
}
|
||||
$body = Encoding::fixUTF8($body);
|
||||
$thread = Ticket_Thread::where('id','=',$thread_id)->first();
|
||||
$thread->body = $this->separate_reply($body) ;
|
||||
$thread->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* separate reply
|
||||
* @param type $body
|
||||
* @return type string
|
||||
*/
|
||||
public function separate_reply($body) {
|
||||
$body2 = explode('---Reply above this line---', $body);
|
||||
$body3 = $body2[0];
|
||||
return $body3;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode Imap text
|
||||
* @param type $str
|
||||
* @return type string
|
||||
*/
|
||||
public function decode_imap_text($str) {
|
||||
$result = '';
|
||||
$decode_header = imap_mime_header_decode($str);
|
||||
foreach ($decode_header AS $obj) {
|
||||
$result .= htmlspecialchars(rtrim($obj->text, "\t"));
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* fetch_attachments
|
||||
* @return type
|
||||
*/
|
||||
public function fetch_attachments(){
|
||||
$uploads = Upload::all();
|
||||
foreach($uploads as $attachment) {
|
||||
$image = @imagecreatefromstring($attachment->file);
|
||||
ob_start();
|
||||
imagejpeg($image, null, 80);
|
||||
$data = ob_get_contents();
|
||||
ob_end_clean();
|
||||
$var = '<a href="" target="_blank"><img src="data:image/jpg;base64,' . base64_encode($data) . '"/></a>';
|
||||
echo '<br/><span class="mailbox-attachment-icon has-img">'.$var.'</span>';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* function to load data
|
||||
* @param type $id
|
||||
* @return type file
|
||||
*/
|
||||
public function get_data($id){
|
||||
$attachments = App\Model\helpdesk\Ticket\Ticket_attachments::where('id','=',$id)->get();
|
||||
foreach($attachments as $attachment)
|
||||
{
|
||||
header('Content-type: application/'.$attachment->type.'');
|
||||
header('Content-Disposition: inline; filename='.$attachment->name.'');
|
||||
header('Content-Transfer-Encoding: binary');
|
||||
echo $attachment->file;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,185 @@
|
||||
<?php namespace App\Http\Controllers\Agent\helpdesk;
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
// requests
|
||||
use App\Http\Requests\helpdesk\OrganizationRequest;
|
||||
/* include organization model */
|
||||
use App\Http\Requests\helpdesk\OrganizationUpdate;
|
||||
// models
|
||||
/* Define OrganizationRequest to validate the create form */
|
||||
use App\Model\helpdesk\Agent_panel\Organization;
|
||||
/* Define OrganizationUpdate to validate the create form */
|
||||
use App\Model\helpdesk\Agent_panel\User_org_head;
|
||||
|
||||
/**
|
||||
* OrganizationController
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class OrganizationController extends Controller {
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* constructor to check
|
||||
* 1. authentication
|
||||
* 2. user roles
|
||||
* 3. roles must be agent
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->middleware('auth');
|
||||
$this->middleware('role.agent');
|
||||
// $this->middleware('roles');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
* @param type Organization $org
|
||||
* @return type Response
|
||||
*/
|
||||
public function index() {
|
||||
try {
|
||||
/* get all values of table organization */
|
||||
return view('themes.default1.agent.helpdesk.organization.index');
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
* @return type Response
|
||||
*/
|
||||
public function create() {
|
||||
try {
|
||||
return view('themes.default1.agent.helpdesk.organization.create');
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
* @param type Organization $org
|
||||
* @param type OrganizationRequest $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function store(Organization $org, OrganizationRequest $request) {
|
||||
try {
|
||||
/* Insert the all input request to organization table */
|
||||
/* Check whether function success or not */
|
||||
if ($org->fill($request->input())->save() == true) {
|
||||
/* redirect to Index page with Success Message */
|
||||
return redirect('organizations')->with('success', 'Organization Created Successfully');
|
||||
} else {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('organizations')->with('fails', 'Organization can not Create');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('organizations')->with('fails', 'Organization can not Create');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param type $id
|
||||
* @param type Organization $org
|
||||
* @return type Response
|
||||
*/
|
||||
public function show($id, Organization $org) {
|
||||
try {
|
||||
/* select the field by id */
|
||||
$orgs = $org->whereId($id)->first();
|
||||
/* To view page */
|
||||
return view('themes.default1.agent.helpdesk.organization.show', compact('orgs'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param type $id
|
||||
* @param type Organization $org
|
||||
* @return type Response
|
||||
*/
|
||||
public function edit($id, Organization $org) {
|
||||
try {
|
||||
/* select the field by id */
|
||||
$orgs = $org->whereId($id)->first();
|
||||
/* To view page */
|
||||
return view('themes.default1.agent.helpdesk.organization.edit', compact('orgs'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param type $id
|
||||
* @param type Organization $org
|
||||
* @param type OrganizationUpdate $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function update($id, Organization $org, OrganizationUpdate $request) {
|
||||
try {
|
||||
/* select the field by id */
|
||||
$orgs = $org->whereId($id)->first();
|
||||
/* update the organization table */
|
||||
/* Check whether function success or not */
|
||||
if ($orgs->fill($request->input())->save() == true) {
|
||||
/* redirect to Index page with Success Message */
|
||||
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 */
|
||||
return redirect('organizations')->with('fails', 'Organization can not Update');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
* @param type int $id
|
||||
* @return type Response
|
||||
*/
|
||||
public function destroy($id, Organization $org) {
|
||||
try {
|
||||
// User_org
|
||||
/* select the field by id */
|
||||
$orgs = $org->whereId($id)->first();
|
||||
/* Delete the field selected from the table */
|
||||
/* Check whether function success or not */
|
||||
if ($orgs->delete() == true) {
|
||||
/* redirect to Index page with Success Message */
|
||||
return redirect('organizations')->with('success', 'Organization Deleted Successfully');
|
||||
} else {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('organizations')->with('fails', 'Organization can not Delete');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('organizations')->with('fails', 'Organization can not Delete');
|
||||
}
|
||||
}
|
||||
|
||||
public function Head_Org($id){
|
||||
|
||||
$head_user = \Input::get('user');
|
||||
|
||||
$org_head = Organization::where('id','=',$id)->first();
|
||||
$org_head->head = $head_user;
|
||||
$org_head->save();
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,99 @@
|
||||
<?php namespace App\Http\Controllers\Agent\helpdesk;
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Controllers\Agent\helpdesk\TicketController;
|
||||
use App\Http\Controllers\Common\SettingsController;
|
||||
// requests
|
||||
use App\Http\Requests\helpdesk\CreateTicketRequest;
|
||||
use App\Http\Requests\helpdesk\TicketRequest;
|
||||
use App\Http\Requests\helpdesk\TicketEditRequest;
|
||||
// models
|
||||
use App\Model\helpdesk\Email\Banlist;
|
||||
use App\Model\helpdesk\Ticket\Tickets;
|
||||
use App\Model\helpdesk\Ticket\Ticket_attachments;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Collaborator;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Thread;
|
||||
use App\Model\helpdesk\Settings\Company;
|
||||
use App\Model\helpdesk\Settings\System;
|
||||
use App\Model\helpdesk\Settings\Alert;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Status;
|
||||
use App\Model\helpdesk\Email\Emails;
|
||||
use App\Model\helpdesk\Agent\Department;
|
||||
use App\User;
|
||||
// classes
|
||||
use Auth;
|
||||
use Hash;
|
||||
use Input;
|
||||
use Mail;
|
||||
use PDF;
|
||||
|
||||
/**
|
||||
* TicketController2
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class Ticket2Controller extends Controller {
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* @return type response
|
||||
*/
|
||||
public function __construct() {
|
||||
SettingsController::smtp();
|
||||
$this->middleware('auth');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the Inbox ticket list page
|
||||
* @return type response
|
||||
*/
|
||||
public function deptopen($id) {
|
||||
$dept = Department::where('name','=',$id)->first();
|
||||
if(Auth::user()->role == 'agent') {
|
||||
if(Auth::user()->dept_id == $dept->id) {
|
||||
return view('themes.default1.agent.helpdesk.dept-ticket.open',compact('id'));
|
||||
} else {
|
||||
return redirect()->back()->with('fails','Unauthorised!');
|
||||
}
|
||||
} else {
|
||||
return view('themes.default1.agent.helpdesk.dept-ticket.open',compact('id'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the Inbox ticket list page
|
||||
* @return type response
|
||||
*/
|
||||
public function deptclose($id) {
|
||||
$dept = Department::where('name','=',$id)->first();
|
||||
if(Auth::user()->role == 'agent') {
|
||||
if(Auth::user()->dept_id == $dept->id) {
|
||||
return view('themes.default1.agent.helpdesk.dept-ticket.closed',compact('id'));
|
||||
} else {
|
||||
return redirect()->back()->with('fails','Unauthorised!');
|
||||
}
|
||||
} else {
|
||||
return view('themes.default1.agent.helpdesk.dept-ticket.closed',compact('id'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the Inbox ticket list page
|
||||
* @return type response
|
||||
*/
|
||||
public function deptinprogress($id) {
|
||||
$dept = Department::where('name','=',$id)->first();
|
||||
if(Auth::user()->role == 'agent') {
|
||||
if(Auth::user()->dept_id == $dept->id) {
|
||||
return view('themes.default1.agent.helpdesk.dept-ticket.inprogress',compact('id'));
|
||||
} else {
|
||||
return redirect()->back()->with('fails','Unauthorised!');
|
||||
}
|
||||
} else {
|
||||
return view('themes.default1.agent.helpdesk.dept-ticket.inprogress',compact('id'));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
1312
code/app/Http/Controllers/Agent/helpdesk/TicketController.php
Normal file
1312
code/app/Http/Controllers/Agent/helpdesk/TicketController.php
Normal file
File diff suppressed because it is too large
Load Diff
322
code/app/Http/Controllers/Agent/helpdesk/UserController.php
Normal file
322
code/app/Http/Controllers/Agent/helpdesk/UserController.php
Normal file
@@ -0,0 +1,322 @@
|
||||
<?php namespace App\Http\Controllers\Agent\helpdesk;
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
// requests
|
||||
/* Include Sys_user Model */
|
||||
use App\Http\Requests\helpdesk\ProfilePassword;
|
||||
/* For validation include Sys_userRequest in create */
|
||||
use App\Http\Requests\helpdesk\ProfileRequest;
|
||||
/* For validation include Sys_userUpdate in update */
|
||||
use App\Http\Requests\helpdesk\Sys_userRequest;
|
||||
/* include guest_note model */
|
||||
use App\Http\Requests\helpdesk\Sys_userUpdate;
|
||||
// models
|
||||
use App\Model\helpdesk\Agent_panel\Organization;
|
||||
use App\Model\helpdesk\Agent_panel\User_org;
|
||||
/* include User Model */
|
||||
/* include Help_topic Model */
|
||||
/* Profile validator */
|
||||
/* Profile Password validator */
|
||||
use App\User;
|
||||
// classes
|
||||
/* include ticket_thred model */
|
||||
use Auth;
|
||||
/* include tickets model */
|
||||
use Hash;
|
||||
/* TicketRequest to validate the ticket response */
|
||||
/* Validate post check ticket */
|
||||
use Input;
|
||||
use Redirect;
|
||||
|
||||
/**
|
||||
* UserController
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class UserController extends Controller {
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* constructor to check
|
||||
* 1. authentication
|
||||
* 2. user roles
|
||||
* 3. roles must be agent
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->middleware('auth');
|
||||
$this->middleware('role.agent');
|
||||
// $this->middleware('roles');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
* @param type User $user
|
||||
* @return type Response
|
||||
*/
|
||||
public function index() {
|
||||
try {
|
||||
/* get all values in Sys_user */
|
||||
return view('themes.default1.agent.helpdesk.user.index');
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
* @return type Response
|
||||
*/
|
||||
public function create() {
|
||||
try {
|
||||
return view('themes.default1.agent.helpdesk.user.create');
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
* @param type User $user
|
||||
* @param type Sys_userRequest $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function store(User $user, Sys_userRequest $request) {
|
||||
try {
|
||||
/* insert the input request to sys_user table */
|
||||
/* Check whether function success or not */
|
||||
$user->email = $request->input('email');
|
||||
$user->user_name = $request->input('full_name');
|
||||
$user->mobile = $request->input('mobile');
|
||||
$user->ext = $request->input('ext');
|
||||
$user->phone_number = $request->input('phone_number');
|
||||
$user->active = $request->input('active');
|
||||
$user->internal_note = $request->input('internal_note');
|
||||
$user->role = 'user';
|
||||
if ($user->save() == true) {
|
||||
/* redirect to Index page with Success Message */
|
||||
return redirect('user')->with('success', 'User Created Successfully');
|
||||
} else {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('user')->with('fails', 'User can not Create');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('user')->with('fails', 'User can not Create');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
* @param type int $id
|
||||
* @param type User $user
|
||||
* @return type Response
|
||||
*/
|
||||
public function show($id, User $user) {
|
||||
try {
|
||||
/* select the field where id = $id(request Id) */
|
||||
$users = $user->whereId($id)->first();
|
||||
return view('themes.default1.agent.helpdesk.user.show', compact('users'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
* @param type int $id
|
||||
* @param type User $user
|
||||
* @return type Response
|
||||
*/
|
||||
public function edit($id, User $user) {
|
||||
try {
|
||||
/* select the field where id = $id(request Id) */
|
||||
$users = $user->whereId($id)->first();
|
||||
return view('themes.default1.agent.helpdesk.user.edit', compact('users'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
* @param type int $id
|
||||
* @param type User $user
|
||||
* @param type Sys_userUpdate $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function update($id, User $user, Sys_userUpdate $request) {
|
||||
try {
|
||||
/* select the field where id = $id(request Id) */
|
||||
$users = $user->whereId($id)->first();
|
||||
/* Update the value by selected field */
|
||||
/* Check whether function success or not */
|
||||
if ($users->fill($request->input())->save() == true) {
|
||||
/* redirect to Index page with Success Message */
|
||||
return redirect('user')->with('success', 'User Updated Successfully');
|
||||
} else {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('user')->with('fails', 'User can not Update');
|
||||
}
|
||||
} 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.
|
||||
* @param type int $id
|
||||
* @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() {
|
||||
$user = Auth::user();
|
||||
return view('themes.default1.agent.helpdesk.user.profile', compact('user'));
|
||||
}
|
||||
|
||||
/**
|
||||
* get profile edit page
|
||||
* @return type Response
|
||||
*/
|
||||
public function getProfileedit() {
|
||||
$user = Auth::user();
|
||||
return view('themes.default1.agent.helpdesk.user.profile-edit', compact('user'));
|
||||
}
|
||||
|
||||
/**
|
||||
* post profile page
|
||||
* @param type int $id
|
||||
* @param type ProfileRequest $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function postProfileedit(ProfileRequest $request) {
|
||||
$user = Auth::user();
|
||||
$user->gender = $request->input('gender');
|
||||
$user->save();
|
||||
if ($user->profile_pic == 'avatar5.png' || $user->profile_pic == 'avatar2.png') {
|
||||
if ($request->input('gender') == 1) {
|
||||
$name = 'avatar5.png';
|
||||
$destinationPath = 'lb-faveo/profilepic';
|
||||
$user->profile_pic = $name;
|
||||
} elseif ($request->input('gender') == 0) {
|
||||
$name = 'avatar2.png';
|
||||
$destinationPath = 'lb-faveo/profilepic';
|
||||
$user->profile_pic = $name;
|
||||
}
|
||||
}
|
||||
if (Input::file('profile_pic')) {
|
||||
//$extension = Input::file('profile_pic')->getClientOriginalExtension();
|
||||
$name = Input::file('profile_pic')->getClientOriginalName();
|
||||
$destinationPath = 'lb-faveo/profilepic';
|
||||
$fileName = rand(0000, 9999) . '.' . $name;
|
||||
//echo $fileName;
|
||||
Input::file('profile_pic')->move($destinationPath, $fileName);
|
||||
$user->profile_pic = $fileName;
|
||||
} else {
|
||||
$user->fill($request->except('profile_pic', 'gender'))->save();
|
||||
return Redirect::route('profile')->with('success', 'Profile Updated sucessfully');
|
||||
}
|
||||
if ($user->fill($request->except('profile_pic'))->save()) {
|
||||
return Redirect::route('profile')->with('success', 'Profile Updated sucessfully');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Post profile password
|
||||
* @param type int $id
|
||||
* @param type ProfilePassword $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function postProfilePassword($id, ProfilePassword $request) {
|
||||
$user = Auth::user();
|
||||
//echo $user->password;
|
||||
if (Hash::check($request->input('old_password'), $user->getAuthPassword())) {
|
||||
$user->password = Hash::make($request->input('new_password'));
|
||||
$user->save();
|
||||
return redirect('profile-edit')->with('success1', 'Password Updated sucessfully');
|
||||
} else {
|
||||
return redirect('profile-edit')->with('fails1', 'Password was not Updated. Incorrect old password');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* User Assign Org
|
||||
* @param type $id
|
||||
* @return type boolean
|
||||
*/
|
||||
public function UserAssignOrg($id) {
|
||||
$org = Input::get('org');
|
||||
$user_org = new User_org;
|
||||
$user_org->org_id = $org;
|
||||
$user_org->user_id = $id;
|
||||
$user_org->save();
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* user create organisation
|
||||
* @return type value
|
||||
*/
|
||||
public function User_Create_Org($id) {
|
||||
|
||||
if(Input::get('website')!=null) {
|
||||
// checking website
|
||||
$check = Organization::where('website','=',Input::get('website'))->first();
|
||||
} else {
|
||||
$check = null;
|
||||
}
|
||||
|
||||
// checking name
|
||||
$check2 = Organization::where('name','=',Input::get('name'))->first();
|
||||
|
||||
if (\Input::get('name') == null) {
|
||||
return "Name is required";
|
||||
} elseif($check2 != null) {
|
||||
return "Name should be Unique";
|
||||
} elseif($check != null) {
|
||||
return "Website should be Unique";
|
||||
} else {
|
||||
$org = new Organization;
|
||||
$org->name = Input::get('name');
|
||||
$org->phone = Input::get('phone');
|
||||
$org->website = Input::get('website');
|
||||
$org->address = Input::get('address');
|
||||
$org->internal_notes = Input::get('internal');
|
||||
$org->save();
|
||||
|
||||
$user_org = new User_org;
|
||||
$user_org->org_id = $org->id;
|
||||
$user_org->user_id = $id;
|
||||
$user_org->save();
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
168
code/app/Http/Controllers/Auth/AuthController.php
Normal file
168
code/app/Http/Controllers/Auth/AuthController.php
Normal file
@@ -0,0 +1,168 @@
|
||||
<?php namespace App\Http\Controllers\Auth;
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Controllers\Common\SettingsController;
|
||||
// requests
|
||||
use App\Http\Requests\helpdesk\LoginRequest;
|
||||
use App\Http\Requests\helpdesk\RegisterRequest;
|
||||
use App\User;
|
||||
// classes
|
||||
/* include User Model */
|
||||
use Hash;
|
||||
/* Include RegisterRequest */
|
||||
use Illuminate\Contracts\Auth\Guard;
|
||||
/* Register validation */
|
||||
use Illuminate\Contracts\Auth\Registrar;
|
||||
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;
|
||||
/* Include login validator */
|
||||
use Mail;
|
||||
use Auth;
|
||||
|
||||
/**
|
||||
* ---------------------------------------------------
|
||||
* AuthController
|
||||
* ---------------------------------------------------
|
||||
* This controller handles the registration of new users, as well as the
|
||||
* authentication of existing users. By default, this controller uses
|
||||
* a simple trait to add these behaviors. Why don't you explore it?
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class AuthController extends Controller {
|
||||
|
||||
use AuthenticatesAndRegistersUsers;
|
||||
/* to redirect after login */
|
||||
// if auth is agent
|
||||
protected $redirectTo = '/dashboard';
|
||||
// if auth is user
|
||||
protected $redirectToUser = '/profile';
|
||||
/* Direct After Logout */
|
||||
protected $redirectAfterLogout = '/';
|
||||
protected $loginPath = '/auth/login';
|
||||
|
||||
/**
|
||||
* Create a new authentication controller instance.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Auth\Guard $auth
|
||||
* @param \Illuminate\Contracts\Auth\Registrar $registrar
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Guard $auth, Registrar $registrar) {
|
||||
SettingsController::smtp();
|
||||
$this->auth = $auth;
|
||||
$this->registrar = $registrar;
|
||||
$this->middleware('guest', ['except' => 'getLogout']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the form for registration
|
||||
* @return type Response
|
||||
*/
|
||||
public function getRegister() {
|
||||
if(Auth::user()) {
|
||||
if(Auth::user()->role == "admin" || Auth::user()->role == "agent") {
|
||||
return \Redirect::route('dashboard');
|
||||
} elseif(Auth::user()->role == "user") {
|
||||
// return view('auth.register');
|
||||
}
|
||||
} else {
|
||||
return view('auth.register');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Post registration form
|
||||
* @param type User $user
|
||||
* @param type RegisterRequest $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function postRegister(User $user, RegisterRequest $request) {
|
||||
$password = Hash::make($request->input('password'));
|
||||
$user->password = $password;
|
||||
$name = $request->input('full_name');
|
||||
$user->user_name = $name;
|
||||
$user->email = $request->input('email');
|
||||
// $user->first_name = $request->input('first_name');
|
||||
// $user->last_nmae = $request->input('last_nmae');
|
||||
// $user->phone_number = $request->input('phone_number');
|
||||
// $user->company = $request->input('company');
|
||||
$user->role = 'user';
|
||||
$code = str_random(60);
|
||||
$user->remember_token = $code;
|
||||
$user->save();
|
||||
// send mail for successful registration
|
||||
$mail = Mail::send('auth.activate', array('link' => url('getmail', $code), 'username' => $name), function ($message) use ($user) {
|
||||
$message->to($user->email, $user->full_name)->subject('active your account');
|
||||
});
|
||||
return redirect('home')->with('success', 'Activate Your Account ! Click on Link that send to your mail');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get mail function
|
||||
* @param type $token
|
||||
* @param type User $user
|
||||
* @return type Response
|
||||
*/
|
||||
public function getMail($token, User $user) {
|
||||
$user = $user->where('remember_token', $token)->where('active', 0)->first();
|
||||
if ($user) {
|
||||
$user->active = 1;
|
||||
$user->save();
|
||||
return redirect('auth/login');
|
||||
} else {
|
||||
return redirect('auth/login');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get login page
|
||||
* @return type Response
|
||||
*/
|
||||
public function getLogin() {
|
||||
if(Auth::user()) {
|
||||
if(Auth::user()->role == "admin" || Auth::user()->role == "agent"){
|
||||
return \Redirect::route('dashboard');
|
||||
} elseif(Auth::user()->role == "user") {
|
||||
return \Redirect::route('home');
|
||||
}
|
||||
} else {
|
||||
return view('auth.login');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Post of login page
|
||||
* @param type LoginRequest $request
|
||||
* @return type Response
|
||||
*/
|
||||
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(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Failed login message
|
||||
* @return type string
|
||||
*/
|
||||
protected function getFailedLoginMessage() {
|
||||
return 'This Field do not match our records.';
|
||||
}
|
||||
}
|
53
code/app/Http/Controllers/Auth/PasswordController.php
Normal file
53
code/app/Http/Controllers/Auth/PasswordController.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php namespace App\Http\Controllers\Auth;
|
||||
// classes
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Contracts\Auth\Guard;
|
||||
use Illuminate\Contracts\Auth\PasswordBroker;
|
||||
use Illuminate\Foundation\Auth\ResetsPasswords;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
use App\User;
|
||||
|
||||
use App\Http\Controllers\Common\SettingsController;
|
||||
|
||||
|
||||
/**
|
||||
* PasswordController
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class PasswordController extends Controller {
|
||||
|
||||
use ResetsPasswords;
|
||||
|
||||
/**
|
||||
* Create a new password controller instance.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Auth\Guard $auth
|
||||
* @param \Illuminate\Contracts\Auth\PasswordBroker $passwords
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Guard $auth, PasswordBroker $passwords) {
|
||||
$this->auth = $auth;
|
||||
$this->passwords = $passwords;
|
||||
$this->middleware('guest');
|
||||
SettingsController::smtp();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Display the form to request a password reset link.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function getEmail()
|
||||
{
|
||||
return view('auth.password');
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,85 @@
|
||||
<?php namespace App\Http\Controllers\Client\helpdesk;
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Controllers\Agent\helpdesk\TicketController;
|
||||
use App\Http\Controllers\Common\SettingsController;
|
||||
// requests
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Requests\helpdesk\CreateTicketRequest;
|
||||
use App\Http\Requests\helpdesk\TicketRequest;
|
||||
use App\Http\Requests\helpdesk\TicketEditRequest;
|
||||
|
||||
// models
|
||||
use App\Model\helpdesk\Email\Banlist;
|
||||
use App\Model\helpdesk\Ticket\Tickets;
|
||||
use App\Model\helpdesk\Ticket\Ticket_attachments;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Collaborator;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Thread;
|
||||
use App\Model\helpdesk\Settings\Company;
|
||||
use App\Model\helpdesk\Settings\System;
|
||||
use App\Model\helpdesk\Settings\Alert;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Status;
|
||||
use App\Model\helpdesk\Email\Emails;
|
||||
use App\Model\helpdesk\Agent\Department;
|
||||
use App\User;
|
||||
// classes
|
||||
use Auth;
|
||||
use Hash;
|
||||
use Input;
|
||||
use Mail;
|
||||
use PDF;
|
||||
|
||||
/**
|
||||
* TicketController2
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class ClientTicketController extends Controller {
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* @return type response
|
||||
*/
|
||||
public function __construct() {
|
||||
SettingsController::smtp();
|
||||
// $this->middleware('auth');
|
||||
// $this->middleware('role.user');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Checked ticket
|
||||
* @param type Tickets $ticket
|
||||
* @param type User $user
|
||||
* @return type response
|
||||
*/
|
||||
public function getCheckTicket(Tickets $ticket, User $user) {
|
||||
return view('themes.default1.client.helpdesk.guest-user.newticket', compact('ticket'));
|
||||
}
|
||||
|
||||
/**
|
||||
* reply
|
||||
* @param type $value
|
||||
* @return type view
|
||||
*/
|
||||
public function reply($id, Request $request) {
|
||||
$comment = $request->input('comment');
|
||||
if($comment != null) {
|
||||
$tickets = Tickets::where('id','=',$id)->first();
|
||||
$threads = new Ticket_Thread;
|
||||
$threads->user_id = Auth::user()->id;
|
||||
$threads->ticket_id = $tickets->id;
|
||||
$threads->poster = "client";
|
||||
$threads->body = $comment;
|
||||
$threads->save();
|
||||
return \Redirect::back()->with('success1','Successfully replied');
|
||||
} else {
|
||||
return \Redirect::back()->with('fails1','Please fill some data!');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,82 @@
|
||||
<?php namespace App\Http\Controllers\Client\helpdesk;
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
// models
|
||||
use App\Model\helpdesk\Email\Emails;
|
||||
|
||||
|
||||
/**
|
||||
* EmailController
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class OuthouseController extends Controller {
|
||||
|
||||
/**
|
||||
* post port
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function port()
|
||||
{
|
||||
$port = Emails::where('id','=','1')->first();
|
||||
$portvalue = $port->option_value;
|
||||
|
||||
return $portvalue;
|
||||
}
|
||||
|
||||
/**
|
||||
* post host
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function host()
|
||||
{
|
||||
$host=Option::where('option_name','=','host')->first();
|
||||
$hostvalue=$host->option_value;
|
||||
|
||||
return $hostvalue;
|
||||
}
|
||||
|
||||
/**
|
||||
* post username
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function username()
|
||||
{
|
||||
$username=Option::where('option_name','=','username')->first();
|
||||
$uservalue=$username->option_value;
|
||||
|
||||
return $uservalue;
|
||||
}
|
||||
|
||||
/**
|
||||
* post passowrd
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function password()
|
||||
{
|
||||
$password=Option::where('option_name','=','password')->first();
|
||||
$passvalue=$password->option_value;
|
||||
|
||||
return $passvalue;
|
||||
}
|
||||
|
||||
/**
|
||||
* post encryption
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function encryption()
|
||||
{
|
||||
$encryption=Option::where('option_name','=','encryption')->first();
|
||||
$encryptvalue=$encryption->option_value;
|
||||
|
||||
return $encryptvalue;
|
||||
}
|
||||
|
||||
}
|
198
code/app/Http/Controllers/Client/helpdesk/FormController.php
Normal file
198
code/app/Http/Controllers/Client/helpdesk/FormController.php
Normal file
@@ -0,0 +1,198 @@
|
||||
<?php namespace App\Http\Controllers\Client\helpdesk;
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Controllers\Agent\helpdesk\TicketController;
|
||||
use App\Http\Controllers\Common\SettingsController;
|
||||
// requests
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Requests\helpdesk\ClientRequest;
|
||||
// models
|
||||
/* include help topic model */
|
||||
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\Settings\Company;
|
||||
/* Validate form TicketForm using */
|
||||
use App\Model\helpdesk\Ticket\Tickets;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Thread;
|
||||
use App\Model\helpdesk\Settings\System;
|
||||
use App\Model\helpdesk\Settings\Ticket;
|
||||
use App\Model\helpdesk\Agent\Department;
|
||||
use App\Model\helpdesk\Ticket\Ticket_source;
|
||||
use App\User;
|
||||
// classes
|
||||
use Form;
|
||||
use Input;
|
||||
use Mail;
|
||||
use Hash;
|
||||
use Redirect;
|
||||
use Config;
|
||||
|
||||
use DateTime;
|
||||
use DateTimeZone;
|
||||
use App\Model\helpdesk\Form\Fields;
|
||||
use App\Model\helpdesk\Form\Form_value;
|
||||
|
||||
|
||||
/**
|
||||
* FormController
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class FormController extends Controller {
|
||||
|
||||
public function __construct(TicketController $TicketController) {
|
||||
SettingsController::smtp();
|
||||
$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
|
||||
* @param type Help_topic $topic
|
||||
* @return type
|
||||
*/
|
||||
public function getForm(Help_topic $topic) {
|
||||
if(\Config::get('database.install') == '%0%') {
|
||||
return \Redirect::route('license');
|
||||
}
|
||||
if(System::first()->status == 1) {
|
||||
$topics = $topic->get();
|
||||
return view('themes.default1.client.helpdesk.form', compact('topics'));
|
||||
} else {
|
||||
return \Redirect::route('home');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This Function to post the form for the ticket
|
||||
* @param type Form_name $name
|
||||
* @param type Form_details $details
|
||||
* @return type string
|
||||
*/
|
||||
public function postForm($id,Form_name $name, Form_details $details, Help_topic $topic) {
|
||||
// dd($id);
|
||||
if($id != 0 ){
|
||||
$helptopic = $topic->where('id', '=', $id)->first();
|
||||
$custom_form = $helptopic->custom_form;
|
||||
$values = Fields::where('forms_id', '=', $custom_form)->get();
|
||||
if(!$values) {
|
||||
} if($values) {
|
||||
foreach($values as $value){
|
||||
if($value->type == "select") {
|
||||
$data = $value->value;
|
||||
$value = explode(',', $data);
|
||||
echo '<select class="form-control">';
|
||||
foreach($value as $option){
|
||||
echo '<option>'.$option.'</option>';
|
||||
}
|
||||
echo '</select></br>';
|
||||
} elseif ($value->type == "radio" ) {
|
||||
$type2 = $value->value;
|
||||
$val = explode(',', $type2);
|
||||
echo '<label class="radio-inline">'.$value->label.'</label>   <input type="'.$value->type.'" name="'.$value->name.'"> '.$val[0].'
|
||||
   <input type="'.$value->type.'" name="'.$value->name.'"> '.$val[1].'</br>';
|
||||
} elseif($value->type == "textarea" ) {
|
||||
$type3 = $value->value;
|
||||
$v = explode(',', $type3);
|
||||
//dd($v);
|
||||
if(array_key_exists(1, $v)){
|
||||
echo '<label>'.$value->label.'</label></br><textarea class=form-control rows="'.$v[0].'" cols="'.$v[1].'"></textarea></br>';
|
||||
} else {
|
||||
echo '<label>'.$value->label.'</label></br><textarea class=form-control rows="10" cols="60"></textarea></br>';
|
||||
}
|
||||
} elseif($value->type == "checkbox" ) {
|
||||
$type4 = $value->value;
|
||||
$check = explode(',', $type4);
|
||||
echo '<label class="radio-inline">'.$value->label.'   <input type="'.$value->type.'" name="'.$value->name.'">  '.$check[0].'</label><label class="radio-inline"><input type="'.$value->type.'" name="'.$value->name.'">  '.$check[1].'</label></br>';
|
||||
} else {
|
||||
echo '<label>'.$value->label.'</label><input type="'.$value->type.'" class="form-control" name="'.$value->name.'" /></br>';
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Posted form
|
||||
* @param type Request $request
|
||||
* @param type User $user
|
||||
*/
|
||||
public function postedForm(User $user, ClientRequest $request, Ticket $ticket_settings, Ticket_source $ticket_source) {
|
||||
|
||||
$form_extras = $request->except('Name','Phone','Email','Subject','Details','helptopic','_wysihtml5_mode','_token');
|
||||
|
||||
$name = $request->input('Name');
|
||||
$phone = $request->input('Phone');
|
||||
$email = $request->input('Email');
|
||||
$subject = $request->input('Subject');
|
||||
$details = $request->input('Details');
|
||||
|
||||
$System = System::where('id','=',1)->first();
|
||||
$departments = Department::where('id','=',$System->department)->first();
|
||||
$department = $departments->id;
|
||||
|
||||
$status = $ticket_settings->first()->status;
|
||||
$helptopic = $ticket_settings->first()->help_topic;
|
||||
$sla = $ticket_settings->first()->sla;
|
||||
$priority = $ticket_settings->first()->priority;
|
||||
$source = $ticket_source->where('name','=','web')->first();
|
||||
|
||||
$collaborator = null;
|
||||
|
||||
if($this->TicketController->create_user($email, $name, $subject, $details, $phone, $helptopic, $sla, $priority, $source->id, $collaborator, $department,$assignto = "", $form_extras)) {
|
||||
return Redirect::route('guest.getform')->with('success','Ticket Created Successfully');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* reply
|
||||
* @param type $value
|
||||
* @return type view
|
||||
*/
|
||||
public function post_ticket_reply($id, Request $request) {
|
||||
$comment = $request->input('comment');
|
||||
if($comment != null) {
|
||||
$tickets = Tickets::where('id','=',$id)->first();
|
||||
$threads = new Ticket_Thread;
|
||||
$threads->user_id = $tickets->user_id;
|
||||
$threads->ticket_id = $tickets->id;
|
||||
$threads->poster = "client";
|
||||
$threads->body = $comment;
|
||||
$threads->save();
|
||||
return \Redirect::back()->with('success1','Successfully replied');
|
||||
} else {
|
||||
return \Redirect::back()->with('fails1','Please fill some data!');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
278
code/app/Http/Controllers/Client/helpdesk/GuestController.php
Normal file
278
code/app/Http/Controllers/Client/helpdesk/GuestController.php
Normal file
@@ -0,0 +1,278 @@
|
||||
<?php namespace App\Http\Controllers\Client\helpdesk;
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Controllers\Common\SettingsController;
|
||||
// requests
|
||||
use App\Http\Requests\helpdesk\CheckTicket;
|
||||
use App\Http\Requests\helpdesk\ProfilePassword;
|
||||
use App\Http\Requests\helpdesk\ProfileRequest;
|
||||
use App\Http\Requests\helpdesk\TicketRequest;
|
||||
// models
|
||||
use App\Model\helpdesk\Manage\Help_topic;
|
||||
use App\Model\helpdesk\Ticket\Tickets;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Thread;
|
||||
use App\Model\helpdesk\Settings\Company;
|
||||
use App\Model\helpdesk\Settings\System;
|
||||
use App\User;
|
||||
// classes
|
||||
use Auth;
|
||||
use Hash;
|
||||
use Input;
|
||||
|
||||
/**
|
||||
* GuestController
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class GuestController extends Controller {
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* @return type void
|
||||
*/
|
||||
public function __construct() {
|
||||
SettingsController::smtp();
|
||||
$this->middleware('auth');
|
||||
// $this->middleware('role.user');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get profile
|
||||
* @return type Response
|
||||
*/
|
||||
public function getProfile() {
|
||||
$user = Auth::user();
|
||||
return view('themes.default1.client.helpdesk.profile', compact('user'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Save profile data
|
||||
* @param type $id
|
||||
* @param type ProfileRequest $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function postProfile(ProfileRequest $request) {
|
||||
$user = User::where('id','=',Auth::user()->id)->first();
|
||||
$user->gender = $request->get('gender');
|
||||
$user->save();
|
||||
if ($user->profile_pic == 'avatar5.png' || $user->profile_pic == 'avatar2.png') {
|
||||
if ($request->input('gender') == 1) {
|
||||
$name = 'avatar5.png';
|
||||
$destinationPath = 'lb-faveo/profilepic';
|
||||
$user->profile_pic = $name;
|
||||
} elseif ($request->input('gender') == 0) {
|
||||
$name = 'avatar2.png';
|
||||
$destinationPath = 'lb-faveo/profilepic';
|
||||
$user->profile_pic = $name;
|
||||
}
|
||||
}
|
||||
if (Input::file('profile_pic')) {
|
||||
//$extension = Input::file('profile_pic')->getClientOriginalExtension();
|
||||
$name = Input::file('profile_pic')->getClientOriginalName();
|
||||
$destinationPath = 'lb-faveo/profilepic';
|
||||
$fileName = rand(0000, 9999) . '.' . $name;
|
||||
//echo $fileName;
|
||||
Input::file('profile_pic')->move($destinationPath, $fileName);
|
||||
$user->profile_pic = $fileName;
|
||||
} else {
|
||||
$user->fill($request->except('profile_pic', 'gender'))->save();
|
||||
return redirect()->back()->with('success1', 'Profile Updated sucessfully');
|
||||
}
|
||||
if ($user->fill($request->except('profile_pic'))->save()) {
|
||||
return redirect()->back()->with('success1', 'Profile Updated sucessfully');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Ticket page
|
||||
* @param type Help_topic $topic
|
||||
* @return type Response
|
||||
*/
|
||||
public function getTicket(Help_topic $topic) {
|
||||
$topics = $topic->get();
|
||||
return view('themes.default1.client.helpdesk.tickets.form', compact('topics'));
|
||||
}
|
||||
|
||||
/**
|
||||
* getform
|
||||
* @param type Help_topic $topic
|
||||
* @return type
|
||||
*/
|
||||
public function getForm(Help_topic $topic) {
|
||||
if(\Config::get('database.install') == '%0%') {
|
||||
return \Redirect::route('license');
|
||||
}
|
||||
if(System::first()->status == 1) {
|
||||
$topics = $topic->get();
|
||||
return view('themes.default1.client.helpdesk.form', compact('topics'));
|
||||
} else {
|
||||
return \Redirect::route('home');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get my ticket
|
||||
* @param type Tickets $tickets
|
||||
* @param type Ticket_Thread $thread
|
||||
* @param type User $user
|
||||
* @return type Response
|
||||
*/
|
||||
public function getMyticket() {
|
||||
return view('themes.default1.client.helpdesk.mytickets');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get ticket-thread
|
||||
* @param type Ticket_Thread $thread
|
||||
* @param type Tickets $tickets
|
||||
* @param type User $user
|
||||
* @return type Response
|
||||
*/
|
||||
public function thread(Ticket_Thread $thread, Tickets $tickets, User $user) {
|
||||
$user_id = Auth::user()->id;
|
||||
//dd($user_id);
|
||||
/* get the ticket's id == ticket_id of thread */
|
||||
$tickets = $tickets->where('user_id', '=', $user_id)->first();
|
||||
//dd($ticket);
|
||||
$thread = $thread->where('ticket_id', $tickets->id)->first();
|
||||
//dd($thread);
|
||||
// $tickets = $tickets->whereId($id)->first();
|
||||
return view('themes.default1.client.guest-user.view_ticket', compact('thread', 'tickets'));
|
||||
}
|
||||
|
||||
/**
|
||||
* ticket Edit
|
||||
* @return
|
||||
*/
|
||||
public function ticketEdit() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Post porfile password
|
||||
* @param type $id
|
||||
* @param type ProfilePassword $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function postProfilePassword(ProfilePassword $request) {
|
||||
$user = Auth::user();
|
||||
//echo $user->password;
|
||||
if (Hash::check($request->input('old_password'), $user->getAuthPassword())) {
|
||||
$user->password = Hash::make($request->input('new_password'));
|
||||
$user->save();
|
||||
return redirect()->back()->with('success2', 'Password Updated sucessfully');
|
||||
} else {
|
||||
return redirect()->back()->with('fails2', 'Password was not Updated. Incorrect old password');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ticekt reply
|
||||
* @param type Ticket_Thread $thread
|
||||
* @param type TicketRequest $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function reply(Ticket_Thread $thread, TicketRequest $request) {
|
||||
$thread->ticket_id = $request->input('ticket_ID');
|
||||
$thread->title = $request->input('To');
|
||||
$thread->user_id = Auth::user()->id;
|
||||
$thread->body = $request->input('ReplyContent');
|
||||
$thread->poster = 'user';
|
||||
$thread->save();
|
||||
$ticket_id = $request->input('ticket_ID');
|
||||
$tickets = Tickets::where('id', '=', $ticket_id)->first();
|
||||
$thread = Ticket_Thread::where('ticket_id', '=', $ticket_id)->first();
|
||||
return Redirect("thread/" . $ticket_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Checked ticket
|
||||
* @param type Tickets $ticket
|
||||
* @param type User $user
|
||||
* @return type response
|
||||
*/
|
||||
public function getCheckTicket(Tickets $ticket, User $user) {
|
||||
return view('themes.default1.client.helpdesk.guest-user.newticket', compact('ticket'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Post Check ticket
|
||||
* @param type CheckTicket $request
|
||||
* @param type User $user
|
||||
* @param type Tickets $ticket
|
||||
* @param type Ticket_Thread $thread
|
||||
* @return type Response
|
||||
*/
|
||||
public function PostCheckTicket() {
|
||||
|
||||
$Email = \Input::get('email');
|
||||
$Ticket_number = \Input::get('ticket_number');
|
||||
|
||||
$ticket = Tickets::where('ticket_number', '=', $Ticket_number)->first();
|
||||
if($ticket == null) {
|
||||
return \Redirect::route('form')->with('fails', 'There is no such Ticket Number');
|
||||
} else {
|
||||
$userId = $ticket->user_id;
|
||||
$user = User::where('id', '=', $userId)->first();
|
||||
|
||||
if($user->role == 'user') {
|
||||
$username = $user->user_name;
|
||||
} else {
|
||||
$username = $user->first_name." ".$user->last_name;
|
||||
}
|
||||
|
||||
if($user->email != $Email) {
|
||||
return \Redirect::route('form')->with('fails', "Email didn't match with Ticket Number");
|
||||
} else {
|
||||
$code = $ticket->id;
|
||||
$code = \Crypt::encrypt($code);
|
||||
|
||||
$company = $this->company();
|
||||
|
||||
\Mail::send('emails.check_ticket',
|
||||
array('link'=>\URL::route('check_ticket',$code),'user'=>$username, 'from'=>$company),
|
||||
function($message) use($user, $username, $Ticket_number) {
|
||||
$message->to($user->email, $username)->subject('Ticket link Request ['.$Ticket_number.']');
|
||||
}
|
||||
);
|
||||
return \Redirect::back()
|
||||
->with('success','We have sent you a link by Email. Please click on that link to view ticket');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get ticket email
|
||||
* @param type $id
|
||||
* @return type
|
||||
*/
|
||||
public function get_ticket_email($id) {
|
||||
$id1 = \Crypt::decrypt($id);
|
||||
return view('themes.default1.client.helpdesk.ckeckticket',compact('id'));
|
||||
}
|
||||
|
||||
/**
|
||||
* get ticket status
|
||||
* @param type Tickets $ticket
|
||||
* @return type
|
||||
*/
|
||||
public function getTicketStat(Tickets $ticket) {
|
||||
return view('themes.default1.client.helpdesk.ckeckticket', compact('ticket'));
|
||||
}
|
||||
|
||||
/**
|
||||
* get company
|
||||
* @return type
|
||||
*/
|
||||
public function company() {
|
||||
$company = Company::Where('id','=','1')->first();
|
||||
if($company->company_name == null){
|
||||
$company = "Support Center";
|
||||
}else{
|
||||
$company = $company->company_name;
|
||||
}
|
||||
return $company;
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,41 @@
|
||||
<?php namespace App\Http\Controllers\Client\helpdesk;
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
// models
|
||||
use App\Model\helpdesk\Settings\System;
|
||||
// classes
|
||||
use Config;
|
||||
use Redirect;
|
||||
|
||||
/**
|
||||
* OuthouseController
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class WelcomepageController extends Controller {
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function get(System $note) {
|
||||
if(Config::get('database.install')=='%0%') {
|
||||
return Redirect::route('licence');
|
||||
}
|
||||
$notes = $note->get();
|
||||
foreach ($notes as $note) {
|
||||
$content = $note->content;
|
||||
}
|
||||
return view('themes.default1.client.guest-user.guest', compact('heading', 'content'));
|
||||
}
|
||||
|
||||
public function index() {
|
||||
if(Config::get('database.install')=='%0%') {
|
||||
return Redirect::route('licence');
|
||||
}
|
||||
return view('themes.default1.client.helpdesk.guest-user.index');
|
||||
}
|
||||
}
|
346
code/app/Http/Controllers/Common/SettingsController.php
Normal file
346
code/app/Http/Controllers/Common/SettingsController.php
Normal file
@@ -0,0 +1,346 @@
|
||||
<?php namespace App\Http\Controllers\Common;
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
// requests
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Requests\helpdesk\SmtpRequest;
|
||||
use App\Http\Requests;
|
||||
// models
|
||||
use App\Model\helpdesk\Theme\Footer2;
|
||||
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\Utility\Version_Check;
|
||||
// classes
|
||||
use Config;
|
||||
use Input;
|
||||
use Crypt;
|
||||
|
||||
/**
|
||||
****************************
|
||||
* Settings Controllers
|
||||
****************************
|
||||
* Controller to keep smtp details and fetch where ever needed
|
||||
* @package default
|
||||
*/
|
||||
class SettingsController extends Controller {
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* @return type void
|
||||
*/
|
||||
public function __construct() {
|
||||
// $this->smtp();
|
||||
$this->middleware('auth');
|
||||
$this->middleware('roles');
|
||||
SettingsController::driver();
|
||||
SettingsController::host();
|
||||
SettingsController::port();
|
||||
SettingsController::from();
|
||||
SettingsController::encryption();
|
||||
SettingsController::username();
|
||||
SettingsController::password();
|
||||
}
|
||||
|
||||
/**
|
||||
* get the page to create the footer
|
||||
* @return response
|
||||
*/
|
||||
public function CreateFooter(Footer $footer) {
|
||||
$footer = $footer->whereId('1')->first();
|
||||
return view('themes.default1.admin.helpdesk.theme.footer', compact('footer'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Post footer
|
||||
* @param type Footer $footer
|
||||
* @param type Request $request
|
||||
* @return type response
|
||||
*/
|
||||
public function PostFooter(Footer $footer, Request $request) {
|
||||
$footer = $footer->whereId('1')->first();
|
||||
if ($footer->fill($request->input())->save()) {
|
||||
return redirect('create-footer')->with('success', 'Footer Saved Successfully');
|
||||
} else {
|
||||
return redirect('create-footer')->with('fails', 'Footer was not Saved');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Driver
|
||||
* @return type void
|
||||
*/
|
||||
static function driver() {
|
||||
$set = new Smtp;
|
||||
$settings = Smtp::where('id','=','1')->first();
|
||||
Config::set('mail.host', $settings->driver);
|
||||
}
|
||||
|
||||
/**
|
||||
* SMTP host
|
||||
* @return type void
|
||||
*/
|
||||
static function host() {
|
||||
$set = new Smtp;
|
||||
$settings = Smtp::where('id','=','1')->first();
|
||||
Config::set('mail.host', $settings->host);
|
||||
}
|
||||
|
||||
/**
|
||||
* SMTP port
|
||||
* @return type void
|
||||
*/
|
||||
static function port() {
|
||||
$set = new Smtp;
|
||||
$settings = Smtp::where('id','=','1')->first();
|
||||
Config::set('mail.port', intval($settings->port));
|
||||
}
|
||||
|
||||
/**
|
||||
* SMTP from
|
||||
* @return type void
|
||||
*/
|
||||
static function from() {
|
||||
$set = new Smtp;
|
||||
$settings = Smtp::where('id','=','1')->first();
|
||||
Config::set('mail.from', ['address'=>$settings->email,'name'=>$settings->company_name]);
|
||||
}
|
||||
|
||||
/**
|
||||
* SMTP encryption
|
||||
* @return type void
|
||||
*/
|
||||
static function encryption() {
|
||||
$set = new Smtp;
|
||||
$settings = Smtp::where('id','=','1')->first();
|
||||
Config::set('mail.encryption', $settings->encryption);
|
||||
}
|
||||
|
||||
/**
|
||||
* SMTP username
|
||||
* @return type void
|
||||
*/
|
||||
static function username() {
|
||||
$set = new Smtp;
|
||||
$settings = Smtp::where('id','=','1')->first();
|
||||
Config::set('mail.username', $settings->email);
|
||||
}
|
||||
|
||||
/**
|
||||
* SMTP password
|
||||
* @return type void
|
||||
*/
|
||||
static function password() {
|
||||
$settings = Smtp::first();
|
||||
if($settings->password) {
|
||||
$pass = $settings->password;
|
||||
$password = Crypt::decrypt($pass);
|
||||
Config::set('mail.password', $password);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get SMTP
|
||||
* @return type view
|
||||
*/
|
||||
public function getsmtp(){
|
||||
$settings = Smtp::where('id','=','1')->first();
|
||||
return view('themes.default1.admin.helpdesk.emails.smtp',compact('settings'));
|
||||
}
|
||||
|
||||
/**
|
||||
* POST SMTP
|
||||
* @return type view
|
||||
*/
|
||||
public function postsmtp(SmtpRequest $request){
|
||||
$data = Smtp::where('id','=',1)->first();
|
||||
$data->driver = $request->input('driver');
|
||||
$data->host = $request->input('host');
|
||||
$data->port = $request->input('port');
|
||||
$data->encryption = $request->input('encryption');
|
||||
$data->name = $request->input('name');
|
||||
$data->email = $request->input('email');
|
||||
$data->password = Crypt::encrypt($request->input('password'));
|
||||
if($data->save()) {
|
||||
return \Redirect::route('getsmtp')->with('success','success');
|
||||
} else {
|
||||
return \Redirect::route('getsmtp')->with('fails','fails');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* SMTP
|
||||
* @return type void
|
||||
*/
|
||||
static function smtp() {
|
||||
$settings = Smtp::where('id','=','1')->first();
|
||||
if($settings->password) {
|
||||
$password = Crypt::decrypt($settings->password);
|
||||
Config::set('mail.driver', $settings->driver);
|
||||
Config::set('mail.password', $password);
|
||||
Config::set('mail.username', $settings->email);
|
||||
Config::set('mail.encryption', $settings->encryption);
|
||||
Config::set('mail.from', ['address'=>$settings->email,'name'=>$settings->name]);
|
||||
Config::set('mail.port', intval($settings->port));
|
||||
Config::set('mail.host', $settings->host);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Settings
|
||||
* @param type Smtp $set
|
||||
* @return type view\
|
||||
*/
|
||||
public function settings(Smtp $set) {
|
||||
$settings = $set->where('id','1')->first();
|
||||
return view('themes.default1.admin.settings',compact('settings'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Post settings
|
||||
* @param type Settings $set
|
||||
* @param type Request $request
|
||||
* @return type view
|
||||
*/
|
||||
public function PostSettings(Settings $set, Request $request) {
|
||||
$settings = $set->where('id','1')->first();
|
||||
$pass = $request->input('password');
|
||||
$password = Crypt::encrypt($pass);
|
||||
$settings->password = $password;
|
||||
$settings->save();
|
||||
if (Input::file('logo')) {
|
||||
$name = Input::file('logo')->getClientOriginalName();
|
||||
$destinationPath = 'dist/logo';
|
||||
$fileName = rand(0000, 9999) . '.' . $name;
|
||||
Input::file('logo')->move($destinationPath, $fileName);
|
||||
$settings->logo = $fileName;
|
||||
$settings->save();
|
||||
}
|
||||
$settings->fill($request->except('logo','password'))->save();
|
||||
return redirect()->back()->with('success','Settings updated Successfully');
|
||||
}
|
||||
|
||||
/**
|
||||
* version_check
|
||||
* @return type
|
||||
*/
|
||||
public function version_check() {
|
||||
|
||||
$response_url = \URL::route('post-version-check');
|
||||
|
||||
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='title' value='helpdeskcommunityedition'/>";
|
||||
echo "<input type='hidden' name='id' value='19'/>";
|
||||
echo "<input type='hidden' name='response_url' value='".$response_url."' />";
|
||||
echo "</form>";
|
||||
echo "<script language='javascript'>document.redirect.submit();</script>";
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* post_version_check
|
||||
* @return type
|
||||
*/
|
||||
public function post_version_check(Request $request) {
|
||||
|
||||
$current_version = \Config::get('app.version');
|
||||
|
||||
$new_version = $request->value;
|
||||
|
||||
if($current_version == $new_version) {
|
||||
// echo "No, new Updates";
|
||||
return redirect()->route('checkupdate')->with('info',' No, new Updates');
|
||||
} elseif($current_version < $new_version) {
|
||||
$version = Version_Check::where('id','=','1')->first();
|
||||
$version->current_version = $current_version;
|
||||
$version->new_version = $new_version;
|
||||
$version->save();
|
||||
// echo "Version " . $new_version . " is Available";
|
||||
return redirect()->route('checkupdate')->with('info',' Version '. $new_version . ' is Available');
|
||||
} else {
|
||||
// echo "Error Checking Version";
|
||||
return redirect()->route('checkupdate')->with('info',' Error Checking Version');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function getupdate() {
|
||||
return \View::make('themes.default1.admin.helpdesk.settings.checkupdate');
|
||||
}
|
||||
}
|
11
code/app/Http/Controllers/Controller.php
Normal file
11
code/app/Http/Controllers/Controller.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php namespace App\Http\Controllers;
|
||||
// classes
|
||||
use Illuminate\Foundation\Bus\DispatchesCommands;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
|
||||
abstract class Controller extends BaseController {
|
||||
|
||||
use DispatchesCommands,
|
||||
ValidatesRequests;
|
||||
}
|
21
code/app/Http/Controllers/Error/ErrorController.php
Normal file
21
code/app/Http/Controllers/Error/ErrorController.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php namespace App\Http\Controllers\Error;
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
/**
|
||||
* ErrorController
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class ErrorController extends Controller {
|
||||
|
||||
/**
|
||||
* Display a Error Page of 404.
|
||||
* @return Response
|
||||
*/
|
||||
public function error404() {
|
||||
return view('404');
|
||||
}
|
||||
}
|
40
code/app/Http/Controllers/HomeController.php
Normal file
40
code/app/Http/Controllers/HomeController.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php namespace App\Http\Controllers;
|
||||
|
||||
class HomeController extends Controller {
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Home Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller renders your application's "dashboard" for users that
|
||||
| are authenticated. Of course, you are free to change or remove the
|
||||
| controller as you wish. It is just here to get your app started!
|
||||
|
|
||||
*/
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
// $this->middleware('auth');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the application dashboard to the user.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function index() {
|
||||
ksjdckjdsnc
|
||||
return view('themes/default1/admin/dashboard');
|
||||
}
|
||||
|
||||
|
||||
public function getsmtp(){
|
||||
$smtp = \App\Model\helpdesk\Email\Smtp::where('id','=','1')->first();
|
||||
return $smtp->host;
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,428 @@
|
||||
<?php namespace App\Http\Controllers\Installer\helpdesk;
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
// requests
|
||||
use App\Http\Requests\helpdesk\InstallerRequest;
|
||||
// models
|
||||
use App\User;
|
||||
use App\Model\helpdesk\Settings\System;
|
||||
use App\Model\helpdesk\Form\Form_details;
|
||||
// classes
|
||||
use App;
|
||||
use Artisan;
|
||||
use Config;
|
||||
use File;
|
||||
use Hash;
|
||||
use Input;
|
||||
use Redirect;
|
||||
use Session;
|
||||
use View;
|
||||
|
||||
/**
|
||||
* |=======================================================================
|
||||
* |Class: InstallController
|
||||
* |=======================================================================
|
||||
*
|
||||
* Class to perform the first install operation without this the database
|
||||
* settings could not be started
|
||||
*
|
||||
* @package Faveo HELPDESK
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*
|
||||
*/
|
||||
class InstallController extends Controller {
|
||||
|
||||
/**
|
||||
* Get Licence (step 1)
|
||||
* @return type view
|
||||
*/
|
||||
public function licence() {
|
||||
if (Session::get('step5') == 'step5') {
|
||||
return Redirect::route('account');
|
||||
}
|
||||
|
||||
if (Config::get('database.install') == '%0%') {
|
||||
return view('themes/default1/installer/helpdesk/view1');
|
||||
} else {
|
||||
// return 1;
|
||||
return redirect('/auth/login');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Post Licencecheck
|
||||
* @return type view
|
||||
*/
|
||||
public function licencecheck() {
|
||||
$accept = (Input::has('accept1')) ? true : false;
|
||||
if ($accept == 'accept') {
|
||||
Session::put('step1', 'step1');
|
||||
return Redirect::route('prerequisites');
|
||||
} else {
|
||||
return Redirect::route('licence')->with('fails', 'Failed! first accept the licence agreeement');
|
||||
}
|
||||
// return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get prerequisites (step 2)
|
||||
*
|
||||
* Checking the extensions enabled required for installing the faveo
|
||||
* without which the project cannot be executed properly
|
||||
* @return type view
|
||||
*/
|
||||
public function prerequisites() {
|
||||
if (Session::get('step5') == 'step5') {
|
||||
return Redirect::route('account');
|
||||
}
|
||||
if (Config::get('database.install') == '%0%') {
|
||||
if (Session::get('step1') == 'step1') {
|
||||
return View::make('themes/default1/installer/helpdesk/view2');
|
||||
} else {
|
||||
return Redirect::route('licence');
|
||||
}
|
||||
} else {
|
||||
return redirect('/auth/login');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Post Prerequisitescheck
|
||||
* checking prerequisites
|
||||
* @return type view
|
||||
*/
|
||||
public function prerequisitescheck() {
|
||||
Session::put('step2', 'step2');
|
||||
return Redirect::route('localization');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Localization (step 3)
|
||||
* Requesting user recomended settings for installation
|
||||
* @return type view
|
||||
*/
|
||||
public function localization() {
|
||||
if (Session::get('step5') == 'step5') {
|
||||
return Redirect::route('account');
|
||||
}
|
||||
if (Config::get('database.install') == '%0%') {
|
||||
if (Session::get('step2') == 'step2') {
|
||||
return View::make('themes/default1/installer/helpdesk/view3');
|
||||
} else {
|
||||
return Redirect::route('prerequisites');
|
||||
}
|
||||
} else {
|
||||
return redirect('/auth/login');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Post localizationcheck
|
||||
* checking prerequisites
|
||||
* @return type view
|
||||
*/
|
||||
public function localizationcheck() {
|
||||
|
||||
Session::put('step3', 'step3');
|
||||
|
||||
Session::put('language', Input::get('language'));
|
||||
Session::put('timezone', Input::get('timezone'));
|
||||
Session::put('date', Input::get('date'));
|
||||
Session::put('datetime', Input::get('datetime'));
|
||||
|
||||
return Redirect::route('configuration');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Configuration (step 4)
|
||||
* checking prerequisites
|
||||
* @return type view
|
||||
*/
|
||||
public function configuration() {
|
||||
if (Session::get('step5') == 'step5') {
|
||||
return Redirect::route('account');
|
||||
}
|
||||
if (Config::get('database.install') == '%0%') {
|
||||
if (Session::get('step3') == 'step3') {
|
||||
return View::make('themes/default1/installer/helpdesk/view4');
|
||||
} else {
|
||||
return Redirect::route('localization');
|
||||
}
|
||||
} else {
|
||||
return redirect('/auth/login');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Post configurationcheck
|
||||
* checking prerequisites
|
||||
* @return type view
|
||||
*/
|
||||
public function configurationcheck() {
|
||||
|
||||
Session::put('step4', 'step4');
|
||||
|
||||
Session::put('default', Input::get('default'));
|
||||
Session::put('host', Input::get('host'));
|
||||
Session::put('databasename', Input::get('databasename'));
|
||||
Session::put('username', Input::get('username'));
|
||||
Session::put('password', Input::get('password'));
|
||||
|
||||
return Redirect::route('database');
|
||||
}
|
||||
|
||||
/**
|
||||
* postconnection
|
||||
* @return type view
|
||||
*/
|
||||
public function postconnection() {
|
||||
|
||||
$default = Input::get('default');
|
||||
$host = Input::get('host');
|
||||
$database = Input::get('databasename');
|
||||
$dbusername = Input::get('username');
|
||||
$dbpassword = Input::get('password');
|
||||
// set default value
|
||||
$path0 = app_path('../config/database.php');
|
||||
$content0 = File::get($path0);
|
||||
$content0 = str_replace('%default%', $default, $content0);
|
||||
File::put($path0, $content0);
|
||||
// set host,databasename,username,password
|
||||
if ($default == 'mysql') {
|
||||
$path = app_path('../config/database.php');
|
||||
$content = File::get($path);
|
||||
$content = str_replace('%host%', $host, $content);
|
||||
File::put($path, $content);
|
||||
|
||||
$path1 = app_path('../config/database.php');
|
||||
$content1 = File::get($path1);
|
||||
$content1 = str_replace('%database%', $database, $content1);
|
||||
File::put($path1, $content1);
|
||||
|
||||
$path2 = app_path('../config/database.php');
|
||||
$content2 = File::get($path2);
|
||||
$content2 = str_replace('%username%', $dbusername, $content2);
|
||||
File::put($path2, $content2);
|
||||
|
||||
$path3 = app_path('../config/database.php');
|
||||
$content3 = File::get($path3);
|
||||
$content3 = str_replace('%password%', $dbpassword, $content3);
|
||||
File::put($path3, $content3);
|
||||
} elseif ($default == 'pgsql') {
|
||||
$path = app_path('../config/database.php');
|
||||
$content = File::get($path);
|
||||
$content = str_replace('%host1%', $host, $content);
|
||||
File::put($path, $content);
|
||||
|
||||
$path1 = app_path('../config/database.php');
|
||||
$content1 = File::get($path1);
|
||||
$content1 = str_replace('%database1%', $database, $content1);
|
||||
File::put($path1, $content1);
|
||||
|
||||
$path2 = app_path('../config/database.php');
|
||||
$content2 = File::get($path2);
|
||||
$content2 = str_replace('%username1%', $username, $content2);
|
||||
File::put($path2, $content2);
|
||||
|
||||
$path3 = app_path('../config/database.php');
|
||||
$content3 = File::get($path3);
|
||||
$content3 = str_replace('%password1%', $password, $content3);
|
||||
File::put($path3, $content3);
|
||||
} elseif ($default == 'sqlsrv') {
|
||||
$path = app_path('../config/database.php');
|
||||
$content = File::get($path);
|
||||
$content = str_replace('%host2%', $host, $content);
|
||||
File::put($path, $content);
|
||||
|
||||
$path1 = app_path('../config/database.php');
|
||||
$content1 = File::get($path1);
|
||||
$content1 = str_replace('%database2%', $database, $content1);
|
||||
File::put($path1, $content1);
|
||||
|
||||
$path2 = app_path('../config/database.php');
|
||||
$content2 = File::get($path2);
|
||||
$content2 = str_replace('%username2%', $username, $content2);
|
||||
File::put($path2, $content2);
|
||||
|
||||
$path3 = app_path('../config/database.php');
|
||||
$content3 = File::get($path3);
|
||||
$content3 = str_replace('%password2%', $password, $content3);
|
||||
File::put($path3, $content3);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get database
|
||||
* checking prerequisites
|
||||
* @return type view
|
||||
*/
|
||||
public function database() {
|
||||
if (Config::get('database.install') == '%0%') {
|
||||
if (Session::get('step4') == 'step4') {
|
||||
return View::make('themes/default1/installer/helpdesk/view5');
|
||||
} else {
|
||||
return Redirect::route('configuration');
|
||||
}
|
||||
} else {
|
||||
return redirect('/auth/login');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get account
|
||||
* checking prerequisites
|
||||
* @return type view
|
||||
*/
|
||||
public function account() {
|
||||
if (Config::get('database.install') == '%0%') {
|
||||
if (Session::get('step4') == 'step4') {
|
||||
Session::put('step5', 'step5');
|
||||
Session::forget('step1');
|
||||
Session::forget('step2');
|
||||
Session::forget('step3');
|
||||
return View::make('themes/default1/installer/helpdesk/view6');
|
||||
} else {
|
||||
return Redirect::route('configuration');
|
||||
}
|
||||
} else {
|
||||
return redirect('/auth/login');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Post accountcheck
|
||||
* checking prerequisites
|
||||
* @param type InstallerRequest $request
|
||||
* @return type view
|
||||
*/
|
||||
public function accountcheck(InstallerRequest $request) {
|
||||
// dd($request);
|
||||
// config/database.php management
|
||||
$default = $request->input('default');
|
||||
$host = $request->input('host');
|
||||
$database = $request->input('databasename');
|
||||
$dbusername = $request->input('dbusername');
|
||||
$dbpassword = $request->input('dbpassword');
|
||||
|
||||
// migrate database
|
||||
Artisan::call('migrate', array('--force' => true));
|
||||
Artisan::call('db:seed', array('--force' => true));
|
||||
|
||||
// create user
|
||||
$firstname = $request->input('firstname');
|
||||
$lastname = $request->input('Lastname');
|
||||
$email = $request->input('email');
|
||||
$username = $request->input('username');
|
||||
$password = $request->input('password');
|
||||
|
||||
$language = $request->input('language');
|
||||
$timezone = $request->input('timezone');
|
||||
$date = $request->input('date');
|
||||
$datetime = $request->input('datetime');
|
||||
|
||||
$system = System::where('id','=','1')->first();
|
||||
$system->time_zone = $timezone;
|
||||
$system->date_time_format = $datetime;
|
||||
$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();
|
||||
|
||||
$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',
|
||||
));
|
||||
|
||||
if ($user) {
|
||||
Session::put('step6', 'step6');
|
||||
return Redirect::route('final');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get finalize
|
||||
* checking prerequisites
|
||||
* @return type view
|
||||
*/
|
||||
public function finalize() {
|
||||
if (Session::get('step6') == 'step6') {
|
||||
// $var = "http://" . $_SERVER['HTTP_HOST'] . "/epeper-pdf";
|
||||
// $siteurl = Option::where('option_name', '=', 'siteurl')->first();
|
||||
// $siteurl->option_value = $var;
|
||||
// $siteurl->save();
|
||||
$value = '1';
|
||||
$install = app_path('../config/database.php');
|
||||
$datacontent = File::get($install);
|
||||
$datacontent = str_replace('%0%', $value, $datacontent);
|
||||
File::put($install, $datacontent);
|
||||
|
||||
$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);
|
||||
|
||||
|
||||
try {
|
||||
return View::make('themes/default1/installer/helpdesk/view7');
|
||||
} catch (Exception $e) {
|
||||
return Redirect::route('npl');
|
||||
}
|
||||
} else {
|
||||
return redirect('/auth/login');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Post finalcheck
|
||||
* checking prerequisites
|
||||
* @return type view
|
||||
*/
|
||||
public function finalcheck() {
|
||||
try
|
||||
{
|
||||
return redirect('/auth/login');
|
||||
} catch (Exception $e) {
|
||||
return redirect('/auth/login');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user