diff --git a/code/app/Http/Controllers/Admin/AgentController.php b/code/app/Http/Controllers/Admin/AgentController.php
index 0adf991a4..d90c80a89 100644
--- a/code/app/Http/Controllers/Admin/AgentController.php
+++ b/code/app/Http/Controllers/Admin/AgentController.php
@@ -1,129 +1,104 @@
-
+ */
class AgentController extends Controller {
/**
- * Display a listing of the resource.
+ * Create a new controller instance.
*
* @return Response
*/
- public function __construct()
- {
+ public function __construct() {
$this->middleware('auth');
$this->middleware('roles');
}
-
- public function index(User $user)
- {
- try
- {
- $user = $user->where('role','agent')->get();
+
+ /**
+ * get index page
+ * @param type User $user
+ * @return type Response
+ */
+ public function index(User $user) {
+ try {
+ $user = $user->where('role', 'agent')->get();
return view('themes.default1.admin.agent.agents.index', compact('user'));
- }
- catch(Exception $e)
- {
+ } catch (Exception $e) {
return view('404');
}
}
/**
* Show the form for creating a new resource.
- *
- * @return Response
+ * @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();
+ public function create(Assign_team_agent $team_assign_agent, Timezones $timezone, Groups $group, Department $department, Teams $team) {
+ try {
+ $team = $team->get();
//$agents = $agent->get();
$timezones = $timezone->get();
$groups = $group->get();
$departments = $department->get();
-
- $teams = $team->lists('id','name');
-
- //$assign = $team_assign_agent->where('agent_id',$id)->lists('team_id');
-
- //$assign = $team_assign_agent->where('agent_id',1)->lists('team_id');
-
- return view('themes.default1.admin.agent.agents.create', compact('assign','teams','agents','timezones','groups','departments','team'));
- }
- catch(Exception $e)
- {
+ $teams = $team->lists('id', 'name');
+ //$assign = $team_assign_agent->where('agent_id',$id)->lists('team_id');
+ //$assign = $team_assign_agent->where('agent_id',1)->lists('team_id');
+ return view('themes.default1.admin.agent.agents.create', compact('assign', 'teams', 'agents', 'timezones', 'groups', 'departments', 'team'));
+ } catch (Exception $e) {
return view('404');
}
}
/**
* Store a newly created resource in storage.
- *
- * @return Response
+ * @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
- {
-
+ public function store(User $user, AgentRequest $request, Assign_team_agent $team_assign_agent) {
+ try {
//$agent -> fill($request->except('team_id'))->save();
-
/* Insert to user table */
$user->role = 'agent';
$user->fill($request->input())->save();
-
-
// $teams = $request->input('assign_team');
// $imp =implode(',', $teams);
// $agent->assign_team = $imp;
-
- $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]);
-
- }
-
+ $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)
- {
- return redirect('agents')->with('success','Agent Created sucessfully');
- }
- else
- {
- return redirect('agents')->with('fails','Agent can not Create');
+ if ($user->save() == true) {
+ 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');
}
- catch( Exception $e)
- {
- return redirect('agents')->with('fails','Agent can not Create');
- }
-
}
/**
@@ -132,139 +107,104 @@ class AgentController extends Controller {
* @param int $id
* @return Response
*/
- public function show($id)
- {
+ public function show($id) {
//
}
/**
* Show the form for editing the specified resource.
- *
- * @param int $id
- * @return Response
+ * @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
- {
+ 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');
+ $team = $team->get();
+ $teams1 = $team->lists('name', 'id');
$timezones = $timezone->get();
$groups = $group->get();
$departments = $department->get();
-
- // $selectedTeam= $user->assign_team;
- // $selectedTeams = explode(',',$selectedTeam);
-
- $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.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');
+ // $selectedTeam= $user->assign_team;
+ // $selectedTeams = explode(',',$selectedTeam);
+ $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.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 int $id
- * @return Response
+ * @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
- {
+ public function update($id, User $user, AgentUpdate $request, Assign_team_agent $team_assign_agent) {
+ try {
//$agents = $agent -> whereId($id) -> first();
-
$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');
+ $daylight_save = $request->input('daylight_save');
+ $limit_access = $request->input('limit_access');
+ $directory_listing = $request->input('directory_listing');
+ $vocation_mode = $request->input('vocation_mode');
//$role=$request->input('role');
-
//dd($account_status);
-
// $agents->daylight_save=$daylight_save;
// $agents->limit_access=$limit_access;
// $agents->directory_listing=$directory_listing;
// $agents->vocation_mode=$vocation_mode;
-
//==============================================
-
- $user->daylight_save=$daylight_save;
- $user->limit_access=$limit_access;
- $user->directory_listing=$directory_listing;
- $user->vocation_mode=$vocation_mode;
+ $user->daylight_save = $daylight_save;
+ $user->limit_access = $limit_access;
+ $user->directory_listing = $directory_listing;
+ $user->vocation_mode = $vocation_mode;
//$user->role=$role;
-
//==============================================
-
-
- $table = $team_assign_agent->where('agent_id',$id);
+ $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]);
-
- }
-
+ foreach ($requests as $req) {
+ DB::insert('insert into team_assign_agent (team_id, agent_id) values (?,?)', [$req, $id]);
+ }
//Todo For success and failure conditions
-
//$agents->fill($request->except('daylight_save','limit_access','directory_listing','vocation_mode','assign_team'))->save();
- $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');
+ $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 int $id
- * @return Response
+ * @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
- {
+ 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 = $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');
+ if ($user->delete()) {
+ return redirect('agents')->with('success', 'Agent Deleted sucessfully');
+ } else {
+ return redirect('agents')->with('fails', 'Agent can not Delete ');
}
- 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');
+ } catch (Exception $e) {
+ return redirect('agents')->with('fails', 'Agent can not Delete if the team Excist');
}
}
-
}
diff --git a/code/app/Http/Controllers/Admin/BanlistController.php b/code/app/Http/Controllers/Admin/BanlistController.php
index f1cf6ce7d..b8aa159ac 100644
--- a/code/app/Http/Controllers/Admin/BanlistController.php
+++ b/code/app/Http/Controllers/Admin/BanlistController.php
@@ -1,92 +1,80 @@
-
+ */
class BanlistController extends Controller {
- /* constructor for authentication */
-
- public function __construct()
- {
+ /**
+ * Create a new controller instance.
+ * @return type void
+ */
+ public function __construct() {
$this->middleware('auth');
$this->middleware('roles');
}
/**
* Display a listing of the resource.
- *
- * @return Response
+ * @param type Banlist $ban
+ * @return type Response
*/
- public function index(Banlist $ban)
- {
- try
- {
+ public function index(Banlist $ban) {
+ try {
$bans = $ban->get();
- return view('themes.default1.admin.emails.banlist.index',compact('bans'));
- }
- catch(Exception $e)
- {
+ return view('themes.default1.admin.emails.banlist.index', compact('bans'));
+ } catch (Exception $e) {
return view('404');
}
-
}
/**
* Show the form for creating a new resource.
- *
- * @return Response
+ * @return type Response
*/
- public function create()
- {
- try
- {
+ public function create() {
+ try {
return view('themes.default1.admin.emails.banlist.create');
- }
- catch(Exception $e)
- {
+ } catch (Exception $e) {
return view('404');
}
}
/**
* Store a newly created resource in storage.
- *
- * @return Response
+ * @param type banlist $ban
+ * @param type BanRequest $request
+ * @param type User $user
+ * @return type Response
*/
- public function store(banlist $ban, BanRequest $request, User $user)
- {
- try
- {
+ public function store(banlist $ban, BanRequest $request, User $user) {
+ try {
//adding field to user whether it is banned or not
$adban = $request->input('email_address');
- $use = $user->where('email',$adban)->first();
- // dd($use);
- if($use!==null)
- {
+ $use = $user->where('email', $adban)->first();
+ // dd($use);
+ if ($use !== null) {
$use->ban = 1;
$use->save();
$ban->create($request->input())->save();
- return redirect('banlist')->with('success','Email Banned sucessfully');
- }
- else
- {
+ return redirect('banlist')->with('success', 'Email Banned sucessfully');
+ } else {
$ban->create($request->input())->save();
- return redirect('banlist')->with('success','Email Banned sucessfully');
+ return redirect('banlist')->with('success', 'Email Banned sucessfully');
}
// $use = $user->where('email',$adban)->first();
// $use->ban = 1;
// $use->save();
-
-
-
// if($ban->create($request->input())->save()==true)
// {
// return redirect('banlist')->with('success','Email Banned sucessfully');
@@ -95,12 +83,9 @@ class BanlistController extends Controller {
// {
// return redirect('banlist')->with('fails','Email can not Ban');
// }
+ } catch (Exception $e) {
+ return redirect('banlist')->with('fails', 'Email can not Ban');
}
- catch(Exception $e)
- {
- return redirect('banlist')->with('fails','Email can not Ban');
- }
-
}
/**
@@ -109,83 +94,62 @@ class BanlistController extends Controller {
* @param int $id
* @return Response
*/
- public function show($id)
- {
+ public function show($id) {
//
}
/**
* Show the form for editing the specified resource.
- *
- * @param int $id
- * @return Response
+ * @param type int $id
+ * @param type Banlist $ban
+ * @return type Response
*/
- public function edit($id, Banlist $ban)
- {
- try
- {
+ public function edit($id, Banlist $ban) {
+ try {
$bans = $ban->whereId($id)->first();
- return view('themes.default1.admin.emails.banlist.edit',compact('bans'));
- }
- catch(Exception $e)
- {
+ return view('themes.default1.admin.emails.banlist.edit', compact('bans'));
+ } catch (Exception $e) {
return view('404');
}
}
/**
* Update the specified resource in storage.
- *
- * @param int $id
- * @return Response
+ * @param type int $id
+ * @param type Banlist $ban
+ * @param type BanlistRequest $request
+ * @return type Response
*/
- public function update($id, Banlist $ban, BanlistRequest $request)
- {
- try
- {
+ public function update($id, Banlist $ban, BanlistRequest $request) {
+ try {
$bans = $ban->whereId($id)->first();
- if($bans->fill($request->input())->save())
- {
- return redirect('banlist')->with('success','Banned Email Updated sucessfully');
+ if ($bans->fill($request->input())->save()) {
+ return redirect('banlist')->with('success', 'Banned Email Updated sucessfully');
+ } else {
+ return redirect('banlist')->with('fails', 'Banned Email not Updated');
}
- else
- {
- return redirect('banlist')->with('fails','Banned Email not Updated');
- }
- }
- catch(Exception $e)
- {
- 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 int $id
- * @return Response
+ * @param type int $id
+ * @param type Banlist $ban
+ * @return type Response
*/
- public function destroy($id, Banlist $ban)
- {
- try
- {
+ 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');
+ if ($bans->delete() == true) {
+ return redirect('banlist')->with('success', 'Banned Email Deleted sucessfully');
+ } else {
+ return redirect('banlist')->with('fails', 'Banned Email can not Delete');
}
- else
- {
- return redirect('banlist')->with('fails','Banned Email can not Delete');
- }
- }
- catch(Exception $e)
- {
- return redirect('banlist')->with('fails','Banned Email can not Delete');
+ } catch (Exception $e) {
+ return redirect('banlist')->with('fails', 'Banned Email can not Delete');
}
}
-
}
diff --git a/code/app/Http/Controllers/Admin/Controller.php b/code/app/Http/Controllers/Admin/Controller.php
index a0ef00255..b0347a45f 100644
--- a/code/app/Http/Controllers/Admin/Controller.php
+++ b/code/app/Http/Controllers/Admin/Controller.php
@@ -1,11 +1,17 @@
-
+ */
abstract class Controller extends BaseController {
- use DispatchesCommands, ValidatesRequests;
-
+ use DispatchesCommands,
+ ValidatesRequests;
}
diff --git a/code/app/Http/Controllers/Admin/DepartmentController.php b/code/app/Http/Controllers/Admin/DepartmentController.php
index a985539fa..27b8caa42 100644
--- a/code/app/Http/Controllers/Admin/DepartmentController.php
+++ b/code/app/Http/Controllers/Admin/DepartmentController.php
@@ -1,117 +1,99 @@
-
+ */
class DepartmentController extends Controller {
-
/**
- * Display a listing of the resource.
- *
- * @return Response
+ * Create a new controller instance.
+ * @return void
*/
- public function __construct()
- {
+ public function __construct() {
$this->middleware('auth');
$this->middleware('roles');
}
- public function index(Department $department)
- {
- try
- {
+
+ /**
+ * Get index page
+ * @param type Department $department
+ * @return type Response
+ */
+ public function index(Department $department) {
+ try {
$departments = $department->get();
- return view('themes.default1.admin.agent.departments.index',compact('departments'));
- }
- catch(Exception $e)
- {
+ return view('themes.default1.admin.agent.departments.index', compact('departments'));
+ } catch (Exception $e) {
return view('404');
}
}
/**
* Show the form for creating a new resource.
- *
- * @return Response
+ * @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();
+ 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();
//$groups=$group->get();
$templates = $template->get();
$department = $department->get();
-
- $groups = $group->lists('id','name');
- return view('themes.default1.admin.agent.departments.create',compact('department','templates','slas','user','emails','groups'));
- }
- catch(Exception $e)
- {
+ $groups = $group->lists('id', 'name');
+ return view('themes.default1.admin.agent.departments.create', compact('department', 'templates', 'slas', 'user', 'emails', 'groups'));
+ } catch (Exception $e) {
return view('404');
}
}
/**
* Store a newly created resource in storage.
- *
- * @return Response
+ * @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]);
-
- }
-
+ 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');
+ if ($department->save() == true) {
+ return redirect('departments')->with('success', 'Department Created sucessfully');
+ } else {
+ return redirect('departments')->with('fails', 'Department can not Create');
}
- else
- {
- return redirect('departments')->with('fails','Department can not Create');
- }
- }
- catch(Exception $e)
- {
- return redirect('departments')->with('fails','Department can not Create');
+ } catch (Exception $e) {
+ return redirect('departments')->with('fails', 'Department can not Create');
}
}
@@ -121,109 +103,87 @@ class DepartmentController extends Controller {
* @param int $id
* @return Response
*/
- public function show($id)
- {
+ public function show($id) {
//
}
/**
* Show the form for editing the specified resource.
- *
- * @param int $id
- * @return Response
+ * @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();
+ 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();
//$groups=$group->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.agent.departments.edit',compact('assign','team','templates','departments','slas','user','emails','groups'));
- }
- catch(Exception $e)
- {
+ $groups = $group->lists('id', 'name');
+ $assign = $group_assign_department->where('department_id', $id)->lists('group_id');
+ return view('themes.default1.admin.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 int $id
- * @return Response
+ * @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);
+ 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]);
-
- }
-
-
-
+ 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');
+ 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');
}
- else
- {
- return redirect('departments')->with('fails','Department not Updated');
- }
- }
- catch(Exception $e)
- {
- 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 int $id
- * @return Response
+ * @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
- {
+ 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 = $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');
+ if ($departments->delete() == true) {
+ return redirect('departments')->with('success', 'Department Deleted sucessfully');
+ } else {
+ return redirect('departments')->with('fails', 'Department can not Delete');
}
- else
- {
- return redirect('departments')->with('fails','Department can not Delete');
- }
- }
- catch(Exception $e)
- {
- return redirect('departments')->with('fails','Department can not Delete');
+ } catch (Exception $e) {
+ return redirect('departments')->with('fails', 'Department can not Delete');
}
}
diff --git a/code/app/Http/Controllers/Admin/EmailsController.php b/code/app/Http/Controllers/Admin/EmailsController.php
index 4cae6daea..ff09a65df 100644
--- a/code/app/Http/Controllers/Admin/EmailsController.php
+++ b/code/app/Http/Controllers/Admin/EmailsController.php
@@ -1,92 +1,85 @@
-
+ */
class EmailsController extends Controller {
- /* constructor for authentication */
-
- public function __construct()
- {
+ /**
+ * Create a new controller instance.
+ * @return type
+ */
+ public function __construct() {
$this->middleware('auth');
$this->middleware('roles');
}
/**
* Display a listing of the resource.
- *
- * @return Response
+ * @param type Emails $emails
+ * @return type Response
*/
- public function index(Emails $emails)
- {
- try
- {
+ public function index(Emails $emails) {
+ try {
$emails = $emails->get();
return view('themes.default1.admin.emails.emails.index', compact('emails'));
- }
- catch(Exception $e)
- {
+ } catch (Exception $e) {
return view('404');
}
}
/**
* Show the form for creating a new resource.
- *
- * @return Response
+ * @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, Priority $priority, MailboxProtocol $mailbox_protocol)
- {
- try
- {
+ public function create(Department $department, Help_topic $help, 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.emails.emails.create',compact('mailbox_protocols','priority','departments','helps'));
- }
- catch(Exception $e)
- {
+ return view('themes.default1.admin.emails.emails.create', compact('mailbox_protocols', 'priority', 'departments', 'helps'));
+ } catch (Exception $e) {
return view('404');
}
}
/**
* Store a newly created resource in storage.
- *
- * @return Response
+ * @param type Emails $email
+ * @param type EmailsRequest $request
+ * @return type Response
*/
- public function store(Emails $email, EmailsRequest $request)
- {
- try
- {
+ 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');
+ 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');
}
- else
- {
- return redirect('emails')->with('fails','Email can not Create');
- }
- }
- catch(Exception $e)
- {
- return redirect('emails')->with('fails','Email can not Create');
+ } catch (Exception $e) {
+ return redirect('emails')->with('fails', 'Email can not Create');
}
}
@@ -96,86 +89,73 @@ class EmailsController extends Controller {
* @param int $id
* @return Response
*/
- public function show($id)
- {
+ public function show($id) {
//
}
/**
* Show the form for editing the specified resource.
- *
- * @param int $id
- * @return Response
+ * @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, Priority $priority, MailboxProtocol $mailbox_protocol)
- {
- try
- {
+ public function edit($id, Department $department, Help_topic $help, Emails $email, 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.emails.emails.edit',compact('mailbox_protocols','priority','departments','helps','emails'));
- }
- catch(Exception $e)
- {
+ return view('themes.default1.admin.emails.emails.edit', compact('mailbox_protocols', 'priority', 'departments', 'helps', 'emails'));
+ } catch (Exception $e) {
return view('404');
}
}
/**
* Update the specified resource in storage.
- *
- * @param int $id
- * @return Response
+ * @param type $id
+ * @param type Emails $email
+ * @param type EmailsEditRequest $request
+ * @return type Response
*/
- public function update($id, Emails $email, EmailsEditRequest $request)
- {
+ 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
- {
+ //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');
+ 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 int $id
- * @return Response
+ * @param type int $id
+ * @param type Emails $email
+ * @return type Response
*/
- public function destroy($id, Emails $email)
- {
- try
- {
+ 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 ');
+ 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 ');
}
- catch(Exception $e)
- {
- return redirect('emails')->with('fails','Email can not Delete ');
- }
-
}
}
diff --git a/code/app/Http/Controllers/Admin/FormController.php b/code/app/Http/Controllers/Admin/FormController.php
index 846ffc1d2..099b9b0a5 100644
--- a/code/app/Http/Controllers/Admin/FormController.php
+++ b/code/app/Http/Controllers/Admin/FormController.php
@@ -1,98 +1,80 @@
-
+ */
class FormController extends Controller {
- /* constructor for authentication */
-
- public function __construct()
- {
+ /**
+ * Create a new controller instance.
+ * @return type void
+ */
+ public function __construct() {
$this->middleware('auth');
$this->middleware('roles');
}
/**
* Display a listing of the resource.
- *
- * @return Response
+ * @param type Forms $form
+ * @return type Response
*/
- public function index(Forms $form)
- {
- try
- {
+ public function index(Forms $form) {
+ try {
/* declare variable $forms to hold the values of table form */
$forms = $form->get();
-
/* Direct to index page with Form table values */
- return view('themes.default1.admin.manage.form.index',compact('forms'));
- }
- catch(Exception $e)
- {
+ return view('themes.default1.admin.manage.form.index', compact('forms'));
+ } catch (Exception $e) {
return view('404');
}
}
/**
* Show the form for creating a new resource.
- *
- * @return Response
+ * @param type Form_visibility $visibility
+ * @param type Form_type $type
+ * @return type Response
*/
- public function create(Form_visibility $visibility, Form_type $type)
- {
- try
- {
+ public function create(Form_visibility $visibility, Form_type $type) {
+ try {
/* Direct to Create page */
- return view('themes.default1.admin.manage.form.create',compact('visibility','type'));
- }
- catch(Exception $e)
- {
+ return view('themes.default1.admin.manage.form.create', compact('visibility', 'type'));
+ } catch (Exception $e) {
return view('404');
}
}
/**
* Store a newly created resource in storage.
- *
- * @return Response
+ * @param type Forms $form
+ * @param type FormRequest $request
+ * @return type Response
*/
- public function store(Forms $form, FormRequest $request)
- {
- try
- {
+ public function store(Forms $form, FormRequest $request) {
+ try {
/* Fill the all request to the Table */
/* Checking Whether function Success or not */
-
- if($form->fill($request->input())->save()==true)
- {
+ if ($form->fill($request->input())->save() == true) {
/* Redirect to Index page with Success Message */
- return redirect('form')->with('success','Form Created Successfully');
- }
- else
- {
+ return redirect('form')->with('success', 'Form Created Successfully');
+ } else {
/* Redirect to Index page with Fail Message */
- return redirect('form')->with('fails','Form can not Create');
+ return redirect('form')->with('fails', 'Form can not Create');
}
- }
- catch(Exception $e)
- {
+ } catch (Exception $e) {
/* Redirect to Index page with Fail Message */
- return redirect('form')->with('fails','Form can not Create');
+ return redirect('form')->with('fails', 'Form can not Create');
}
}
@@ -102,97 +84,78 @@ class FormController extends Controller {
* @param int $id
* @return Response
*/
- public function show($id)
- {
+ public function show($id) {
//
}
/**
* Show the form for editing the specified resource.
- *
- * @param int $id
- * @return Response
+ * @param type int $id
+ * @param type Forms $form
+ * @param type Form_visibility $visibility
+ * @param type Form_type $type
+ * @return type Response
*/
- public function edit($id, Forms $form, Form_visibility $visibility, Form_type $type)
- {
- try
- {
+ public function edit($id, Forms $form, Form_visibility $visibility, Form_type $type) {
+ try {
/* declare variable $forms to hold the values of a row by Id */
$forms = $form->whereId($id)->first();
/* Direct to Edit page with Form table's perticular row using Id */
- return view('themes.default1.admin.manage.form.edit',compact('forms','visibility','type'));
- }
- catch(Exception $e)
- {
+ return view('themes.default1.admin.manage.form.edit', compact('forms', 'visibility', 'type'));
+ } catch (Exception $e) {
return view('404');
}
}
/**
* Update the specified resource in storage.
- *
- * @param int $id
- * @return Response
+ * @param type int $id
+ * @param type Forms $form
+ * @param type FormRequest $request
+ * @return type Response
*/
- public function update($id, Forms $form, FormRequest $request)
- {
- try
- {
+ public function update($id, Forms $form, FormRequest $request) {
+ try {
/* declare variable $forms to hold the values of a row by Id */
$forms = $form->whereId($id)->first();
-
/* Fill the values to the row of a selected, by Id */
/* Check Whether function is Success or not */
- if($forms->fill($request->input())->save()==true)
- {
+ if ($forms->fill($request->input())->save() == true) {
/* redirect to Index page with Success Message */
- return redirect('form')->with('success','Form Updated Successfully');
- }
- else
- {
+ return redirect('form')->with('success', 'Form Updated Successfully');
+ } else {
/* redirect to Index page with Fails Message */
- return redirect('form')->with('fails','Form can not Update');
+ return redirect('form')->with('fails', 'Form can not Update');
}
- }
- catch(Exception $e)
- {
+ } catch (Exception $e) {
/* Redirect to Index page with Fail Message */
- return redirect('form')->with('fails','Form can not Create');
+ return redirect('form')->with('fails', 'Form can not Create');
}
}
/**
* Remove the specified resource from storage.
- *
- * @param int $id
- * @return Response
+ * @param type int $id
+ * @param type Forms $form
+ * @return type Response
*/
- public function destroy($id, Forms $form)
- {
- try
- {
+ public function destroy($id, Forms $form) {
+ try {
/* declare variable $forms to hold the values of a row by Id */
$forms = $form->whereId($id)->first();
-
/* Delete the values to the row of a selected, by Id */
/* Check whether the fuction success or not */
- if($forms->delete()==true)
- {
+ if ($forms->delete() == true) {
/* redirect to Index page with Success Message */
- return redirect('form')->with('success','Form Deleted Successfully');
- }
- else
- {
+ return redirect('form')->with('success', 'Form Deleted Successfully');
+ } else {
/* redirect to Index page with Fails Message */
- return redirect('form')->with('fails','Form can not Deleted');
+ return redirect('form')->with('fails', 'Form can not Deleted');
}
- }
- catch(Exception $e)
- {
+ } catch (Exception $e) {
/* Redirect to Index page with Fail Message */
- return redirect('form')->with('fails','Form can not Create');
+ return redirect('form')->with('fails', 'Form can not Create');
}
}
-
}
diff --git a/code/app/Http/Controllers/Admin/GroupController.php b/code/app/Http/Controllers/Admin/GroupController.php
index 8d405f84d..e73154bc9 100644
--- a/code/app/Http/Controllers/Admin/GroupController.php
+++ b/code/app/Http/Controllers/Admin/GroupController.php
@@ -1,96 +1,80 @@
-
+ */
class GroupController extends Controller {
-
- /* constructor for authentication */
-
- public function __construct()
- {
+ /**
+ * Create a new controller instance.
+ * @return type void
+ */
+ public function __construct() {
$this->middleware('auth');
$this->middleware('roles');
}
/**
* Display a listing of the resource.
- *
- * @return Response
+ * @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
- {
+ 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.agent.groups.index',compact('departments','group_assign_department','groups'));
- }
- catch(Exception $e)
- {
+ return view('themes.default1.admin.agent.groups.index', compact('departments', 'group_assign_department', 'groups'));
+ } catch (Exception $e) {
return view('404');
}
}
/**
* Show the form for creating a new resource.
- *
- * @return Response
+ * @return type Response
*/
- public function create()
- {
- try
- {
+ public function create() {
+ try {
return view('themes.default1.admin.agent.groups.create');
- }
- catch(Exception $e)
- {
+ } catch (Exception $e) {
return view('404');
}
-
}
/**
* Store a newly created resource in storage.
- *
- * @return Response
+ * @param type Groups $group
+ * @param type GroupRequest $request
+ * @return type Response
*/
- public function store(Groups $group,GroupRequest $request)
- {
- try
- {
+ public function store(Groups $group, GroupRequest $request) {
+ try {
/* Check Whether function success or not */
-
- if($group->fill($request->input())->save()==true)
- {
+ if ($group->fill($request->input())->save() == true) {
/* redirect to Index page with Success Message */
- return redirect('groups')->with('success','Groups Created Successfully');
- }
- else
- {
+ 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');
+ return redirect('groups')->with('fails', 'Groups can not Create');
}
- }
- catch(Exception $e)
- {
+ } catch (Exception $e) {
/* redirect to Index page with Fails Message */
- return redirect('groups')->with('fails','Groups can not Create');
+ return redirect('groups')->with('fails', 'Groups can not Create');
}
-
}
/**
@@ -99,45 +83,39 @@ class GroupController extends Controller {
* @param int $id
* @return Response
*/
- public function show($id, Groups $group, Request $request)
- {
-
+ public function show($id, Groups $group, Request $request) {
+
}
/**
* Show the form for editing the specified resource.
- *
- * @param int $id
- * @return Response
+ * @param type int $id
+ * @param type Groups $group
+ * @return type Response
*/
- public function edit($id, Groups $group)
- {
- try
- {
+ public function edit($id, Groups $group) {
+ try {
$groups = $group->whereId($id)->first();
- return view('themes.default1.admin.agent.groups.edit',compact('groups'));
- }
- catch(Exception $e)
- {
+ return view('themes.default1.admin.agent.groups.edit', compact('groups'));
+ } catch (Exception $e) {
return view('404');
}
}
/**
* Update the specified resource in storage.
- *
- * @param int $id
- * @return Response
+ * @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() ;
+ public function update($id, Groups $group, Request $request) {
+ try {
+ $var = $group->whereId($id)->first();
//Updating Name
// $name = $request->Input('name');
// $var->name = $name;
- //Updating Status
+ //Updating Status
$status = $request->Input('group_status');
$var->group_status = $status;
//Updating can_create_ticket field
@@ -179,28 +157,20 @@ class GroupController extends Controller {
//Updating admin_notes field
$adminNotes = $request->Input('admin_notes');
$var->admin_notes = $adminNotes;
-
/* Check whether function success or not */
-
- if($var->save()==true)
- {
+ if ($var->save() == true) {
/* redirect to Index page with Success Message */
- return redirect('groups')->with('success','Group Updated Successfully');
- }
- else
- {
+ 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');
+ return redirect('groups')->with('fails', 'Group can not Update');
}
- }
- catch(Exception $e)
- {
+ } catch (Exception $e) {
/* redirect to Index page with Fails Message */
- return redirect('groups')->with('fails','Groups can not Create');
+ return redirect('groups')->with('fails', 'Groups can not Create');
}
-
-
}
+
// public function delete($id, Groups $group)
// {
// return view('')
@@ -208,38 +178,26 @@ class GroupController extends Controller {
/**
* Remove the specified resource from storage.
- *
- * @param int $id
- * @return Response
+ * @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();
-
+ 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)
- {
+ if ($groups->delete() == true) {
/* redirect to Index page with Success Message */
- return redirect('groups')->with('success','Group Deleted Successfully');
- }
- else
- {
+ 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');
+ return redirect('groups')->with('fails', 'Group can not Delete');
}
- }
- catch(Exception $e)
- {
+ } catch (Exception $e) {
/* redirect to Index page with Fails Message */
- return redirect('groups')->with('fails','Groups can not Create');
+ return redirect('groups')->with('fails', 'Groups can not Create');
}
-
}
-
-
}
diff --git a/code/app/Http/Controllers/Admin/HelptopicController.php b/code/app/Http/Controllers/Admin/HelptopicController.php
index a43bcf1fe..e821d4e5b 100644
--- a/code/app/Http/Controllers/Admin/HelptopicController.php
+++ b/code/app/Http/Controllers/Admin/HelptopicController.php
@@ -1,126 +1,100 @@
-
+ */
class HelptopicController extends Controller {
- /* constructor for authentication */
-
- public function __construct()
- {
+ /**
+ * Create a new controller instance.
+ * @return type vodi
+ */
+ public function __construct() {
$this->middleware('auth');
$this->middleware('roles');
}
/**
* Display a listing of the resource.
- *
- * @return Response
+ * @param type Help_topic $topic
+ * @return type Response
*/
- public function index(Help_topic $topic)
- {
- try
- {
+ public function index(Help_topic $topic) {
+ try {
$topics = $topic->get();
- return view('themes.default1.admin.manage.helptopic.index',compact('topics'));
- }
- catch(Exception $e)
- {
+ return view('themes.default1.admin.manage.helptopic.index', compact('topics'));
+ } catch (Exception $e) {
return view('404');
}
}
/**
* Show the form for creating a new resource.
- *
- * @return Response
+ * @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(Priority $priority,Department $department, Help_topic $topic, Form_name $form, Agents $agent, Sla_plan $sla)
- {
- try
- {
+ ================================================
+ | 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(Priority $priority, Department $department, Help_topic $topic, Form_name $form, Agents $agent, Sla_plan $sla) {
+ try {
$departments = $department->get();
$topics = $topic->get();
$forms = $form->get();
$agents = $agent->get();
$slas = $sla->get();
$priority = $priority->get();
-
- return view('themes.default1.admin.manage.helptopic.create',compact('priority','departments','topics','forms','agents','slas'));
- }
- catch(Exception $e)
- {
+ return view('themes.default1.admin.manage.helptopic.create', compact('priority', 'departments', 'topics', 'forms', 'agents', 'slas'));
+ } catch (Exception $e) {
return view('404');
-
}
}
/**
* Store a newly created resource in storage.
- *
- * @return Response
+ * @param type Help_topic $topic
+ * @param type HelptopicRequest $request
+ * @return type Response
*/
- public function store(Help_topic $topic, HelptopicRequest $request)
- {
- try
- {
+ public function store(Help_topic $topic, HelptopicRequest $request) {
+ try {
/* Check whether function success or not */
-
- if($topic->fill($request->input())->save()==true)
- {
+ if ($topic->fill($request->input())->save() == true) {
/* redirect to Index page with Success Message */
- return redirect('helptopic')->with('success','Helptopic Created Successfully');
- }
- else
- {
+ 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');
+ return redirect('helptopic')->with('fails', 'Helptopic can not Create');
}
- }
- catch(Exception $e)
- {
+ } catch (Exception $e) {
/* redirect to Index page with Fails Message */
- return redirect('helptopic')->with('fails','Helptopic can not Create');
+ return redirect('helptopic')->with('fails', 'Helptopic can not Create');
}
}
@@ -130,98 +104,79 @@ class HelptopicController extends Controller {
* @param int $id
* @return Response
*/
- public function show($id)
- {
+ public function show($id) {
//
}
/**
* Show the form for editing the specified resource.
- *
- * @param int $id
- * @return Response
+ * @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,Priority $priority,Department $department, Help_topic $topic, Form_name $form, Agents $agent, Sla_plan $sla)
- {
- try
- {
+ public function edit($id, Priority $priority, Department $department, Help_topic $topic, Form_name $form, Agents $agent, Sla_plan $sla) {
+ try {
$departments = $department->get();
$topics = $topic->whereId($id)->first();
$forms = $form->get();
$agents = $agent->get();
$slas = $sla->get();
$priority = $priority->get();
-
- return view('themes.default1.admin.manage.helptopic.edit',compact('priority','departments','topics','forms','agents','slas'));
- }
- catch(Exception $e)
- {
+ return view('themes.default1.admin.manage.helptopic.edit', compact('priority', 'departments', 'topics', 'forms', 'agents', 'slas'));
+ } catch (Exception $e) {
return view('404');
}
}
/**
* Update the specified resource in storage.
- *
- * @param int $id
- * @return Response
+ * @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
- {
+ 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)
- {
+ if ($topics->fill($request->input())->save() == true) {
/* redirect to Index page with Success Message */
- return redirect('helptopic')->with('success','Helptopic Updated Successfully');
- }
- else
- {
+ 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');
+ return redirect('helptopic')->with('fails', 'Helptopic can not Updated');
}
- }
- catch(Exception $e)
- {
+ } catch (Exception $e) {
/* redirect to Index page with Fails Message */
- return redirect('helptopic')->with('fails','Helptopic can not Create');
+ return redirect('helptopic')->with('fails', 'Helptopic can not Create');
}
}
/**
* Remove the specified resource from storage.
- *
- * @param int $id
- * @return Response
+ * @param type int $id
+ * @param type Help_topic $topic
+ * @return type Response
*/
- public function destroy($id, Help_topic $topic)
- {
- try
- {
+ public function destroy($id, Help_topic $topic) {
+ try {
$topics = $topic->whereId($id)->first();
-
/* Check whether function success or not */
-
- if($topics->delete()==true)
- {
+ if ($topics->delete() == true) {
/* redirect to Index page with Success Message */
- return redirect('helptopic')->with('success','Helptopic Deleted Successfully');
- }
- else
- {
+ 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');
+ return redirect('helptopic')->with('fails', 'Helptopic can not Delete');
}
- }
- catch(Exception $e)
- {
+ } catch (Exception $e) {
/* redirect to Index page with Fails Message */
- return redirect('helptopic')->with('fails','Helptopic can not Create');
+ return redirect('helptopic')->with('fails', 'Helptopic can not Create');
}
}
-
}
diff --git a/code/app/Http/Controllers/Admin/HomeController.php b/code/app/Http/Controllers/Admin/HomeController.php
index 19f5a3430..16d0251c3 100644
--- a/code/app/Http/Controllers/Admin/HomeController.php
+++ b/code/app/Http/Controllers/Admin/HomeController.php
@@ -1,25 +1,26 @@
-
+ */
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()
- {
+ public function __construct() {
$this->middleware('auth');
}
@@ -28,8 +29,7 @@ class HomeController extends Controller {
*
* @return Response
*/
- public function index()
- {
+ public function index() {
return view('themes/default1/admin/dashboard');
}
diff --git a/code/app/Http/Controllers/Admin/ProfileController.php b/code/app/Http/Controllers/Admin/ProfileController.php
index c9ff3299b..b33cf7261 100644
--- a/code/app/Http/Controllers/Admin/ProfileController.php
+++ b/code/app/Http/Controllers/Admin/ProfileController.php
@@ -1,43 +1,37 @@
-
+ */
class ProfileController extends Controller {
- /* Define constructor for Authentication Checking */
-
+ /**
+ * 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
- {
+ try {
$user = Auth::user();
if ($user) {
return view('themes.default1.admin.profile', compact('user'));
@@ -49,52 +43,54 @@ class ProfileController extends Controller {
}
}
+ /**
+ * 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 = 'dist/img';
$user->profile_pic = $name;
} elseif ($request->input('gender') == 0) {
-
$name = 'avatar2.png';
$destinationPath = 'dist/img';
$user->profile_pic = $name;
}
}
-
if (Input::file('profile_pic')) {
//$extension = Input::file('profile_pic')->getClientOriginalExtension();
$name = Input::file('profile_pic')->getClientOriginalName();
-
$destinationPath = 'dist/img';
$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();
@@ -102,7 +98,5 @@ class ProfileController extends Controller {
} else {
return redirect('guest')->with('fails', 'Password was not Updated');
}
-
}
-
}
diff --git a/code/app/Http/Controllers/Admin/SettingsController.php b/code/app/Http/Controllers/Admin/SettingsController.php
index ad52a7316..79be81791 100644
--- a/code/app/Http/Controllers/Admin/SettingsController.php
+++ b/code/app/Http/Controllers/Admin/SettingsController.php
@@ -1,72 +1,37 @@
-
+ */
class SettingsController extends Controller {
/**
@@ -88,11 +53,9 @@ class SettingsController extends Controller {
*
*/
public function getcompany(Company $company) {
- try
- {
+ try {
/* fetch the values of company from company table */
$companys = $company->whereId('1')->first();
-
/* Direct to Company Settings Page */
return view('themes.default1.admin.settings.company', compact('companys'));
} catch (Exception $e) {
@@ -103,29 +66,23 @@ class SettingsController extends Controller {
/**
* Update the specified resource in storage.
*
- * @param int $id
+ * @param type int $id
+ * @param type Company $company
+ * @param type CompanyRequest $request *
* @return Response
*/
public function postcompany($id, Company $company, CompanyRequest $request) {
- try
- {
+ 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;
- //echo $fileName;
-
Input::file('logo')->move($destinationPath, $fileName);
-
$companys->logo = $fileName;
}
-
/* 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');
@@ -137,29 +94,27 @@ class SettingsController extends Controller {
/* redirect to Index page with Fails Message */
return redirect('getcompany')->with('fails', 'Company can not Updated');
}
-
}
/**
- * @param int $id
- * @return Response
- * @param $system instance of System table
- *
* 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
- {
+ 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.settings.system', compact('systems', 'departments', 'timezones', 'time', 'date', 'date_time', 'log'));
} catch (Exception $e) {
@@ -169,21 +124,18 @@ class SettingsController extends Controller {
/**
* Update the specified resource in storage.
- *
- * @param int $id
- * @return Response
+ * @param type int $id
+ * @param type System $system
+ * @param type SystemRequest $request
+ * @return type Response
*/
public function postsystem($id, System $system, SystemRequest $request) {
- try
- {
+ try {
/* fetch the values of system request */
$systems = $system->whereId('1')->first();
-
/* fill the values to coompany table */
/* Check whether function success or not */
-
//dd($request);
-
if ($systems->fill($request->input())->save() == true) {
/* redirect to Index page with Success Message */
return redirect('getsystem')->with('success', 'System Updated Successfully');
@@ -195,29 +147,24 @@ class SettingsController extends Controller {
/* redirect to Index page with Fails Message */
return redirect('getsystem')->with('fails', 'System can not Updated');
}
-
}
/**
- * @param int $id
- * @return Response
- * @param $ticket instance of Ticket table
- *
* 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, Priority $priority) {
- try
- {
+ 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.settings.ticket', compact('tickets', 'slas', 'topics', 'priority'));
} catch (Exception $e) {
@@ -227,36 +174,26 @@ class SettingsController extends Controller {
/**
* Update the specified resource in storage.
- *
- * @param int $id
- * @return Response
+ * @param type int $id
+ * @param type Ticket $ticket
+ * @param type Request $request
+ * @return type Response
*/
public function postticket($id, Ticket $ticket, Request $request) {
- try
- {
+ 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');
@@ -268,30 +205,23 @@ class SettingsController extends Controller {
/* redirect to Index page with Fails Message */
return redirect('getticket')->with('fails', 'Ticket can not Updated');
}
-
}
/**
- * @param int $id
- * @return Response
- * @param $email instance of Email table
- *
* 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
- {
+ 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.settings.email', compact('emails', 'templates', 'emails1'));
} catch (Exception $e) {
@@ -301,32 +231,24 @@ class SettingsController extends Controller {
/**
* Update the specified resource in storage.
- *
- * @param int $id
- * @return Response
+ * @param type int $id
+ * @param type Email $email
+ * @param type EmailRequest $request
+ * @return type Response
*/
public function postemail($id, Email $email, EmailRequest $request) {
- try
- {
+ 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');
@@ -338,24 +260,17 @@ class SettingsController extends Controller {
/* redirect to Index page with Fails Message */
return redirect('getemail')->with('fails', 'Email can not Updated');
}
-
}
/**
- * @param int $id
- * @return Response
- * @param $access instance of Access table
- *
* get the form for Access setting page
- *
+ * @param type Access $access
+ * @return type Response
*/
-
public function getaccess(Access $access) {
- try
- {
+ try {
/* fetch the values of access from access table */
$accesses = $access->whereId('1')->first();
-
/* Direct to Access Settings Page */
return view('themes.default1.admin.settings.access', compact('accesses'));
} catch (Exception $e) {
@@ -365,30 +280,22 @@ class SettingsController extends Controller {
/**
* Update the specified resource in storage.
- *
- * @param int $id
- * @return Response
+ * @param type Access $access
+ * @param type Request $request
+ * @return type Response
*/
public function postaccess(Access $access, Request $request) {
- try
- {
+ 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');
@@ -400,24 +307,17 @@ class SettingsController extends Controller {
/* redirect to Index page with Fails Message */
return redirect('getaccess')->with('fails', 'Access can not Updated');
}
-
}
/**
- * @param int $id
- * @return Response
- * @param $responder instance of Responder table
- *
* get the form for Responder setting page
- *
+ * @param type Responder $responder
+ * @return type Response
*/
-
public function getresponder(Responder $responder) {
- try
- {
+ try {
/* fetch the values of responder from responder table */
$responders = $responder->whereId('1')->first();
-
/* Direct to Responder Settings Page */
return view('themes.default1.admin.settings.responder', compact('responders'));
} catch (Exception $e) {
@@ -427,30 +327,22 @@ class SettingsController extends Controller {
/**
* Update the specified resource in storage.
- *
- * @param int $id
- * @return Response
+ * @param type Responder $responder
+ * @param type Request $request
+ * @return type
*/
public function postresponder(Responder $responder, Request $request) {
- try
- {
+ 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->partcipants = $request->input('partcipants');
-
$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');
@@ -462,24 +354,17 @@ class SettingsController extends Controller {
/* redirect to Index page with Fails Message */
return redirect('getresponder')->with('fails', 'Responder can not Updated');
}
-
}
/**
- * @param int $id
- * @return Response
- * @param $alert instance of Alert table
- *
* get the form for Alert setting page
- *
+ * @param type Alert $alert
+ * @return type Response
*/
-
public function getalert(Alert $alert) {
- try
- {
+ try {
/* fetch the values of alert from alert table */
$alerts = $alert->whereId('1')->first();
-
/* Direct to Alert Settings Page */
return view('themes.default1.admin.settings.alert', compact('alerts'));
} catch (Exception $e) {
@@ -489,78 +374,47 @@ class SettingsController extends Controller {
/**
* Update the specified resource in storage.
- *
- * @param int $id
- * @return Response
+ * @param type $id
+ * @param type Alert $alert
+ * @param type Request $request
+ * @return type Response
*/
public function postalert($id, Alert $alert, Request $request) {
- try
- {
+ 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');
@@ -572,11 +426,9 @@ class SettingsController extends Controller {
/* redirect to Index page with Fails Message */
return redirect('getalert')->with('fails', 'Alert can not Updated');
}
-
}
public function getck() {
return view('themes.default1.ckeditor');
}
-
}
diff --git a/code/app/Http/Controllers/Admin/SlaController.php b/code/app/Http/Controllers/Admin/SlaController.php
index 37f9214e3..9ef11f2a7 100644
--- a/code/app/Http/Controllers/Admin/SlaController.php
+++ b/code/app/Http/Controllers/Admin/SlaController.php
@@ -1,97 +1,77 @@
+ */
class SlaController extends Controller {
- /* constructor for authentication */
-
- public function __construct()
- {
+ /**
+ * Create a new controller instance.
+ * @return type void
+ */
+ public function __construct() {
$this->middleware('auth');
$this->middleware('roles');
}
/**
* Display a listing of the resource.
- *
- * @return Response
+ * @param type Sla_plan $sla
+ * @return type Response
*/
- public function index(Sla_plan $sla)
- {
- try
- {
+ 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.manage.sla.index',compact('slas'));
- }
- catch(Exception $e)
- {
+ return view('themes.default1.admin.manage.sla.index', compact('slas'));
+ } catch (Exception $e) {
return view('404');
}
}
/**
* Show the form for creating a new resource.
- *
- * @return Response
+ * @return type Response
*/
- public function create()
- {
- try
- {
+ public function create() {
+ try {
/* Direct to Create Page */
return view('themes.default1.admin.manage.sla.create');
- }
- catch(Exception $e)
- {
+ } catch (Exception $e) {
return view('404');
}
}
/**
* Store a newly created resource in storage.
- *
- * @return Response
+ * @param type Sla_plan $sla
+ * @param type SlaRequest $request
+ * @return type Response
*/
- public function store(Sla_plan $sla, SlaRequest $request)
- {
- try
- {
+ 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)
-
- {
+ if ($sla->fill($request->input())->save() == true) {
/* redirect to Index page with Success Message */
- return redirect('sla')->with('success','SLA Plan Created Successfully');
- }
- else
- {
+ 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');
+ return redirect('sla')->with('fails', 'SLA Plan can not Create');
}
- }
- catch(Exception $e)
- {
+ } catch (Exception $e) {
/* redirect to Index page with Fails Message */
- return redirect('sla')->with('fails','SLA Plan can not Create');
+ return redirect('sla')->with('fails', 'SLA Plan can not Create');
}
-
}
/**
@@ -100,104 +80,79 @@ class SlaController extends Controller {
* @param int $id
* @return Response
*/
- public function show($id)
- {
+ public function show($id) {
//
}
/**
* Show the form for editing the specified resource.
- *
- * @param int $id
- * @return Response
+ * @param type int $id
+ * @param type Sla_plan $sla
+ * @return type Response
*/
- public function edit($id, Sla_plan $sla)
- {
- try
- {
+ 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.manage.sla.edit',compact('slas'));
- }
- catch(Exception $e)
- {
+ return view('themes.default1.admin.manage.sla.edit', compact('slas'));
+ } catch (Exception $e) {
return view('404');
}
}
/**
* Update the specified resource in storage.
- *
- * @param int $id
- * @return Response
+ * @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
- {
+ 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();
-
+ $slas->fill($request->except('transient', 'ticket_overdue'))->save();
/* Update transient checkox field */
- $slas->transient=$request->input('transient');
-
+ $slas->transient = $request->input('transient');
/* Update ticket_overdue checkox field */
- $slas->ticket_overdue=$request->input('ticket_overdue');
-
+ $slas->ticket_overdue = $request->input('ticket_overdue');
/* Check whether function success or not */
-
- if($slas->save()==true)
- {
+ if ($slas->save() == true) {
/* redirect to Index page with Success Message */
- return redirect('sla')->with('success','SLA Plan Updated Successfully');
- }
- else
- {
+ 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');
+ return redirect('sla')->with('fails', 'SLA Plan can not Update');
}
- }
- catch(Exception $e)
- {
+ } catch (Exception $e) {
/* redirect to Index page with Fails Message */
- return redirect('sla')->with('fails','SLA Plan can not Update');
+ return redirect('sla')->with('fails', 'SLA Plan can not Update');
}
-
}
/**
* Remove the specified resource from storage.
- *
- * @param int $id
- * @return Response
+ * @param type int $id
+ * @param type Sla_plan $sla
+ * @return type Response
*/
- public function destroy($id, Sla_plan $sla)
- {
- try
- {
+ 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)
- {
+ if ($slas->delete() == true) {
/* redirect to Index page with Success Message */
- return redirect('sla')->with('success','SLA Plan Deleted Successfully');
- }
- else
- {
+ 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');
+ return redirect('sla')->with('fails', 'SLA Plan can not Delete');
}
- }
- catch(Exception $e)
- {
+ } catch (Exception $e) {
/* redirect to Index page with Fails Message */
- return redirect('sla')->with('fails','SLA Plan can not Delete');
+ return redirect('sla')->with('fails', 'SLA Plan can not Delete');
}
-
}
}
diff --git a/code/app/Http/Controllers/Admin/TeamController.php b/code/app/Http/Controllers/Admin/TeamController.php
index 5d828a679..a6ee6d7df 100644
--- a/code/app/Http/Controllers/Admin/TeamController.php
+++ b/code/app/Http/Controllers/Admin/TeamController.php
@@ -1,42 +1,40 @@
-
+ */
class TeamController extends Controller {
-
/**
- * Display a listing of the resource.
- *
- * @return Response
+ * Create a new controller instance.
+ * @return type void
*/
- public function __construct()
- {
+ public function __construct() {
$this->middleware('auth');
$this->middleware('roles');
}
- public function index(Teams $team, Assign_team_agent $assign_team_agent)
- {
- try
- {
+ /**
+ * 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();
//dd($id);
@@ -45,62 +43,46 @@ class TeamController extends Controller {
// $assign_team_agent = $assign_team_agent->where('team_id',$i);
// dd($assign_team_agent);
// }
-
- return view('themes.default1.admin.agent.teams.index', compact('assign_team_agent','teams'));
- }
- catch(Exception $e)
- {
+ return view('themes.default1.admin.agent.teams.index', compact('assign_team_agent', 'teams'));
+ } catch (Exception $e) {
return view('404');
}
}
/**
* Show the form for creating a new resource.
- *
- * @return Response
+ * @param type User $user
+ * @return type Response
*/
- public function create(User $user)
- {
- try
- {
+ public function create(User $user) {
+ try {
$user = $user->get();
- return view('themes.default1.admin.agent.teams.create',compact('user'));
- }
- catch(Exception $e)
- {
+ return view('themes.default1.admin.agent.teams.create', compact('user'));
+ } catch (Exception $e) {
return view('404');
}
}
/**
* Store a newly created resource in storage.
- *
- * @return Response
+ * @param type Teams $team
+ * @param type TeamRequest $request
+ * @return type Response
*/
- public function store(Teams $team,TeamRequest $request)
- {
-
- try
- {
+ public function store(Teams $team, TeamRequest $request) {
+ try {
/* Check whether function success or not */
-
- if($team -> fill($request->input())->save()==true)
- {
+ if ($team->fill($request->input())->save() == true) {
/* redirect to Index page with Success Message */
- return redirect('teams')->with('success','Teams Created Successfully');
- }
- else
- {
+ 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');
+ return redirect('teams')->with('fails', 'Teams can not Create');
}
- }
- catch(Exception $e)
- {
+ } catch (Exception $e) {
/* redirect to Index page with Fails Message */
- return redirect('teams')->with('fails','Teams can not Create');
+ return redirect('teams')->with('fails', 'Teams can not Create');
}
-
}
/**
@@ -109,30 +91,27 @@ class TeamController extends Controller {
* @param int $id
* @return Response
*/
- public function show($id)
- {
+ public function show($id) {
//
}
/**
* Show the form for editing the specified resource.
- *
- * @param int $id
- * @return Response
+ * @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
- {
+ 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();
//$allagents = $agent->get();
-
-
/* Gettting member of the team */
- $agent_team = $assign_team_agent->where('team_id',$id)->get();
+ $agent_team = $assign_team_agent->where('team_id', $id)->get();
//dd($agent_team);
- $agent_id = $agent_team->lists('agent_id','agent_id');
+ $agent_id = $agent_team->lists('agent_id', 'agent_id');
// dd($agent_id);
//$id = $agent->lists('id');
//dd($id);
@@ -142,88 +121,63 @@ class TeamController extends Controller {
// echo $agent;
// //
// }
-
-
-
- return view('themes.default1.admin.agent.teams.edit', compact('agent_id','user','teams','allagents'));
- }
- catch(Exception $e)
- {
+ return view('themes.default1.admin.agent.teams.edit', compact('agent_id', 'user', 'teams', 'allagents'));
+ } catch (Exception $e) {
return view('404');
}
}
/**
* Update the specified resource in storage.
- *
- * @param int $id
- * @return Response
+ * @param type int $id
+ * @param type Teams $team
+ * @param type TeamUpdate $request
+ * @return type Response
*/
- public function update($id,Teams $team, TeamUpdate $request)
- {
- try
- {
+ 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
+ $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)
- {
+ if ($teams->fill($request->input())->save() == true) {
/* redirect to Index page with Success Message */
- return redirect('teams')->with('success','Teams Updated Successfully');
- }
- else
- {
+ 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');
+ return redirect('teams')->with('fails', 'Teams can not Update');
}
- }
- catch(Exception $e)
- {
+ } catch (Exception $e) {
/* redirect to Index page with Fails Message */
- return redirect('teams')->with('fails','Teams can not Update');
+ return redirect('teams')->with('fails', 'Teams can not Update');
}
-
}
/**
* Remove the specified resource from storage.
- *
- * @param int $id
- * @return Response
+ * @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();
-
+ 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)
- {
+ if ($teams->delete() == true) {
/* redirect to Index page with Success Message */
- return redirect('teams')->with('success','Teams Deleted Successfully');
- }
- else
- {
+ 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');
+ return redirect('teams')->with('fails', 'Teams can not Delete');
}
- }
- catch(Exception $e)
- {
+ } catch (Exception $e) {
/* redirect to Index page with Fails Message */
- return redirect('teams')->with('fails','Teams can not Delete');
+ return redirect('teams')->with('fails', 'Teams can not Delete');
}
-
}
-
}
diff --git a/code/app/Http/Controllers/Admin/TemplateController.php b/code/app/Http/Controllers/Admin/TemplateController.php
index 878f2a176..1c9df7ab0 100644
--- a/code/app/Http/Controllers/Admin/TemplateController.php
+++ b/code/app/Http/Controllers/Admin/TemplateController.php
@@ -1,91 +1,82 @@
-
+ */
class TemplateController extends Controller {
- /* constructor for authentication */
-
- public function __construct()
- {
+ /**
+ * Create a new controller instance.
+ * @return type void
+ */
+ public function __construct() {
$this->middleware('auth');
$this->middleware('roles');
}
/**
* Display a listing of the resource.
- *
- * @return Response
+ * @param type Template $template
+ * @return type Response
*/
- public function index(Template $template)
- {
- try
- {
+ public function index(Template $template) {
+ try {
$templates = $template->get();
- return view('themes.default1.admin.emails.template.index',compact('templates'));
- }
- catch(Exception $e)
- {
+ return view('themes.default1.admin.emails.template.index', compact('templates'));
+ } catch (Exception $e) {
return view('404');
}
}
/**
* Show the form for creating a new resource.
- *
- * @return Response
+ * @param type Languages $language
+ * @param type Template $template
+ * @return type Response
*/
- public function create(Languages $language, Template $template )
- {
- try
- {
+ public function create(Languages $language, Template $template) {
+ try {
$templates = $template->get();
$languages = $language->get();
- return view('themes.default1.admin.emails.template.create',compact('languages','templates'));
- }
- catch(Exception $e)
- {
+ return view('themes.default1.admin.emails.template.create', compact('languages', 'templates'));
+ } catch (Exception $e) {
return view('404');
}
}
/**
* Store a newly created resource in storage.
- *
- * @return Response
+ * @param type Template $template
+ * @param type TemplateRequest $request
+ * @return type Response
*/
- public function store(Template $template, TemplateRequest $request)
- {
- try
- {
+ public function store(Template $template, TemplateRequest $request) {
+ try {
/* Check whether function success or not */
-
- if($template->fill($request->input())->save()==true)
- {
+ if ($template->fill($request->input())->save() == true) {
/* redirect to Index page with Success Message */
- return redirect('template')->with('success','Teams Created Successfully');
- }
- else
- {
+ 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');
+ return redirect('template')->with('fails', 'Teams can not Create');
}
- }
- catch(Exception $e)
- {
+ } catch (Exception $e) {
/* redirect to Index page with Fails Message */
- return redirect('template')->with('fails','Teams can not Create');
+ return redirect('template')->with('fails', 'Teams can not Create');
}
-
}
/**
@@ -94,132 +85,100 @@ class TemplateController extends Controller {
* @param int $id
* @return Response
*/
- public function show($id)
- {
+ public function show($id) {
//
}
/**
* Show the form for editing the specified resource.
- *
- * @param int $id
- * @return Response
+ * @param type $id
+ * @param type Template $template
+ * @param type Languages $language
+ * @return type Response
*/
- public function edit($id, Template $template, Languages $language)
- {
- try
- {
+ public function edit($id, Template $template, Languages $language) {
+ try {
$templates = $template->whereId($id)->first();
$languages = $language->get();
- return view('themes.default1.admin.emails.template.edit',compact('templates','languages'));
- }
- catch(Exception $e)
- {
+ return view('themes.default1.admin.emails.template.edit', compact('templates', 'languages'));
+ } catch (Exception $e) {
return view('404');
}
}
/**
* Update the specified resource in storage.
- *
- * @param int $id
- * @return Response
+ * @param type int $id
+ * @param type Template $template
+ * @param type TemplateUdate $request
+ * @return type Response
*/
- public function update($id, Template $template, TemplateUdate $request)
- {
- try
- {
+ 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)
- {
+ if ($templates->fill($request->input())->save() == true) {
/* redirect to Index page with Success Message */
- return redirect('template')->with('success','Teams Updated Successfully');
- }
- else
- {
+ 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');
+ return redirect('template')->with('fails', 'Teams can not Update');
}
- }
- catch(Exception $e)
- {
+ } catch (Exception $e) {
/* redirect to Index page with Fails Message */
- return redirect('template')->with('fails','Teams can not Update');
+ return redirect('template')->with('fails', 'Teams can not Update');
}
-
}
/**
* Remove the specified resource from storage.
- *
- * @param int $id
- * @return Response
+ * @param type int $id
+ * @param type Template $template
+ * @return type Response
*/
- public function destroy($id, Template $template)
- {
- try
- {
+ public function destroy($id, Template $template) {
+ try {
$templates = $template->whereId($id)->first();
-
/* Check whether function success or not */
-
- if($templates->delete()==true)
- {
+ if ($templates->delete() == true) {
/* redirect to Index page with Success Message */
- return redirect('template')->with('success','Teams Deleted Successfully');
- }
- else
- {
+ 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');
+ return redirect('template')->with('fails', 'Teams can not Delete');
}
- }
- catch(Exception $e)
- {
+ } catch (Exception $e) {
/* redirect to Index page with Fails Message */
- return redirect('template')->with('fails','Teams can not Delete');
+ return redirect('template')->with('fails', 'Teams can not Delete');
}
-
}
/**
* Form for Email connection checking.
- *
- * @param
- * @return Response
+ * @param type Emails $email
+ * @return type Response
*/
- public function formDiagno(Emails $email)
- {
- try
- {
+ public function formDiagno(Emails $email) {
+ try {
$emails = $email->get();
return view('themes.default1.admin.emails.template.formDiagno', compact('emails'));
- }
- catch(Exception $e)
- {
+ } catch (Exception $e) {
return view('404');
}
}
-
- /*
- To Do function for Sending an Email
- */
-
- public function postDiagno(Request $request)
- {
+
+ /**
+ * function to send emails
+ * @param type Request $request
+ * @return type
+ */
+ public function postDiagno(Request $request) {
$email = $request->input('to');
$subject = $request->input('subject');
-
- $mail = Mail::send('themes.default1.admin.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','Activate Your Account ! Click on Link that send to your mail');
-
-
+ $mail = Mail::send('themes.default1.admin.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', 'Activate Your Account ! Click on Link that send to your mail');
}
}
diff --git a/code/app/Http/Controllers/Admin/ThreadController.php b/code/app/Http/Controllers/Admin/ThreadController.php
index 4629c1420..b71b7db05 100644
--- a/code/app/Http/Controllers/Admin/ThreadController.php
+++ b/code/app/Http/Controllers/Admin/ThreadController.php
@@ -1,36 +1,33 @@
-
+ */
class ThreadController extends Controller {
- /* get the values from ticket_thread Table and direct to view page */
-
- public function getTickets(Ticket_thread $thread, Priority $priority)
-
- {
- try
- {
+ /**
+ * 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.tickets.ticket', compact('threads','priorities'));
- }
- catch(Exception $e)
- {
+ return view('themes.default1.admin.tickets.ticket', compact('threads', 'priorities'));
+ } catch (Exception $e) {
return view('404');
}
}
diff --git a/code/app/Http/Controllers/Admin/WelcomeController.php b/code/app/Http/Controllers/Admin/WelcomeController.php
index 039180b1b..744ae69c4 100644
--- a/code/app/Http/Controllers/Admin/WelcomeController.php
+++ b/code/app/Http/Controllers/Admin/WelcomeController.php
@@ -1,25 +1,26 @@
-
+ */
class WelcomeController extends Controller {
- /*
- |--------------------------------------------------------------------------
- | Welcome Controller
- |--------------------------------------------------------------------------
- |
- | This controller renders the "marketing page" for the application and
- | is configured to only allow guests. Like most of the other sample
- | controllers, you are free to modify or remove it as you desire.
- |
- */
-
/**
* Create a new controller instance.
- *
* @return void
*/
- public function __construct()
- {
+ public function __construct() {
$this->middleware('guest');
}
@@ -28,8 +29,7 @@ class WelcomeController extends Controller {
*
* @return Response
*/
- public function index()
- {
+ public function index() {
return view('welcome');
}
diff --git a/code/app/Http/Controllers/Agent/MailController.php b/code/app/Http/Controllers/Agent/MailController.php
index efd7acba2..a0915cc52 100644
--- a/code/app/Http/Controllers/Agent/MailController.php
+++ b/code/app/Http/Controllers/Agent/MailController.php
@@ -1,25 +1,44 @@
-
+ */
class MailController extends Controller {
+ /**
+ * @var string
+ */
public $email = "";
+
+ /**
+ * @var string
+ */
public $stream = "";
- // public function fetchEmails(Emails $email)
- // {
- // $emails = $email->get();
- // $mailboxes = $emails;
- // return $mailboxes;
- // }
+ /**
+ * constructor
+ * Create a new controller instance.
+ * @param type TicketController $TicketController
+ */
+ public function __construct(TicketController $TicketController) {
+ $this->TicketController = $TicketController;
+ }
+ /**
+ * Decode Imap text
+ * @param type $str
+ * @return type string
+ */
function decode_imap_text($str) {
$result = '';
$decode_header = imap_mime_header_decode($str);
@@ -29,29 +48,75 @@ class MailController extends Controller {
return $result;
}
+ /**
+ * get Imap data
+ */
function getdata() {
+ /**
+ * fetching all the emails allowed to
+ * check for mails to read tickets
+ */
$email = new Emails;
$mailboxes = $email->get();
+ //check for any value in $mailbox
if (count($mailboxes) >= 0) {
foreach ($mailboxes as $current_mailbox) {
+ //checking for fetching status of the emails
if ($current_mailbox['fetching_status']) {
+ /**
+ *@imap_open requres three arguments for
+ * reading mails in each emails
+ *
+ * 1. Host
+ * 2. email address
+ * 3. password
+ */
$stream = @imap_open($current_mailbox['fetching_host'], $current_mailbox['email_address'], $current_mailbox['password']);
+ /**
+ * @var $testvar type string
+ */
$testvar = "";
+ // checking for any result in imap_open with value
if ($stream >= 0) {
- $emails = imap_search($stream, 'SINCE ' . date('d-M-Y', strtotime("-10 day")));
+ /**
+ * @imap_search requires two arguments to check
+ * from when to check for mails
+ *
+ * 1. result of @imap_open $stream
+ * 2. date in negative
+ */
+ $emails = imap_search($stream, 'SINCE ' . date('d-M-Y', strtotime("-1 day")));
+ // checking if $emails has received any value
if ($emails != false) {
+ // count for mails
if (count($emails) >= 0) {
rsort($emails);
foreach ($emails as $email_id) {
+ /**
+ * @imap_fetch_overview requires three arguments to check
+ * the overview of each mails
+ *
+ * 1. result of @imap_open $stream
+ * 2. emails numbers $emails_id
+ * 3. and a 0 value
+ */
$overview = imap_fetch_overview($stream, $email_id, 0);
$var = $overview[0]->seen ? 'read' : 'unread';
- if ($var == 'unread') {
+ // check for unread messages
+ if ($var == 'read') {
$testvar = 'set';
-
+ /**
+ * fetching overview details fo each mails
+ *
+ * 1. from address
+ * 2. subject
+ * 3. date and time
+ */
$from = $this->decode_imap_text($overview[0]->from);
$subject = $this->decode_imap_text($overview[0]->subject);
$datetime = $overview[0]->date;
+ // separate date and time
$date_time = explode(" ", $datetime);
$date = $date_time[1] . "-" . $date_time[2] . "-" . $date_time[3] . " " . $date_time[4];
@@ -68,26 +133,31 @@ class MailController extends Controller {
// {
// echo "fail";
// }
-
$emailadd = explode('&', $from);
$username = $emailadd[0];
$emailadd = substr($emailadd[1], 3);
$date = date('Y-m-d H:i:s', strtotime($date));
-
$system = "Email";
$phone = "";
- $helptopic = $this->default_helptopic();
- $sla = $this->default_sla();
-
+ $helptopic = $this->TicketController->default_helptopic();
+ $sla = $this->TicketController->default_sla();
$structure = imap_fetchstructure($stream, $email_id);
// $image1 = $structure->parts[0]->parts[1]->parameters[0]->value;
// $image = $structure->parts[1]->parameters[0]->value;
// echo '';
// echo '
';
// dd($structure);
- //=================================================
- // HTML
- //=================================================
+
+ /**
+ * There are 5 types of mail readable formats
+ *
+ * 1. Html
+ * 2. Alternative
+ * 3. Related
+ * 4. Mixed
+ */
+
+ // checking if the format is Html
if ($structure->subtype == 'HTML') {
$body2 = imap_fetchbody($stream, $email_id, 1);
if ($body2 == null) {
@@ -98,10 +168,7 @@ class MailController extends Controller {
// echo $body;
// echo "0";
}
-
- //=================================================
- // ALTERNATIVE
- //=================================================
+ // checking if the format is Alternative
if ($structure->subtype == 'ALTERNATIVE') {
if (isset($structure->parts)) {
$body2 = imap_fetchbody($stream, $email_id, 1.2);
@@ -113,10 +180,7 @@ class MailController extends Controller {
// echo $body[0];
}
}
-
- //=================================================
- // RELATED
- //=================================================
+ // checking if the format is related
if ($structure->subtype == 'RELATED') {
if (isset($structure->parts)) {
$parts = $structure->parts;
@@ -126,10 +190,8 @@ class MailController extends Controller {
$body2 = imap_fetchbody($stream, $email_id, 1);
}
$body = quoted_printable_decode($body2);
-
foreach ($parts as $part) {
if ($parts[$i]) {
-
}
$i++;
if (isset($parts[$i])) {
@@ -142,7 +204,6 @@ class MailController extends Controller {
if (strtolower($object->attribute) == 'filename') {
$filename = $object->value;
}
-
}
}
if ($parts[$i]->ifparameters == 1) {
@@ -150,7 +211,6 @@ class MailController extends Controller {
if (strtolower($object->attribute) == 'name') {
$name = $object->value;
}
-
}
}
$body = str_replace($imageid, $filename, $body);
@@ -170,10 +230,7 @@ class MailController extends Controller {
}
}
}
-
- //=================================================
- // MIXED
- //=================================================
+ //checking if the format is mixed
elseif ($structure->subtype == 'MIXED') {
if (isset($structure->parts)) {
$parts = $structure->parts;
@@ -188,7 +245,6 @@ class MailController extends Controller {
$body = quoted_printable_decode($body2);
}
}
-
// subtype = RELATED
if ($parts[0]->subtype == 'RELATED') {
if (isset($parts[0]->parts)) {
@@ -203,7 +259,6 @@ class MailController extends Controller {
$name = "";
foreach ($parts as $part) {
if ($parts[0]) {
-
}
$i++;
if (isset($parts[$i])) {
@@ -249,8 +304,8 @@ class MailController extends Controller {
// $ticket->body = $body2;
// $ticket->date = $datetime;
// $ticket->save();
-
- if ($this->create_user($emailadd, $username, $subject, $body, $phone, $helptopic, $sla, $system) == true) {
+ $priority = '1';
+ if ($this->TicketController->create_user($emailadd, $username, $subject, $body, $phone, $helptopic, $sla, $priority, $system) == true) {
$thread_id = Ticket_Thread::whereRaw('id = (select max(`id`) from ticket_thread)')->first();
$thread_id = $thread_id->id;
if ($this->get_attachment($structure, $stream, $email_id, $thread_id) == true) {
@@ -270,10 +325,16 @@ class MailController extends Controller {
}
}
- //======================================
- // ATTACHMENT |Incomplete
- //======================================
+ /**
+ * Get attachments data from mail
+ * @param type $structure
+ * @param type $stream
+ * @param type $email_id
+ * @param type $thread_id
+ * @return type bool
+ */
public function get_attachment($structure, $stream, $email_id, $thread_id) {
+ // checking if the mails has attachments
if (isset($structure->parts) && count($structure->parts)) {
for ($i = 0; $i < count($structure->parts); $i++) {
$attachments[$i] = array(
@@ -281,7 +342,7 @@ class MailController extends Controller {
'filename' => '',
'name' => '',
'attachment' => '');
-
+ // checking for files
if ($structure->parts[$i]->ifdparameters) {
foreach ($structure->parts[$i]->dparameters as $object) {
if (strtolower($object->attribute) == 'filename') {
@@ -290,6 +351,7 @@ class MailController extends Controller {
}
}
}
+ // checking for files
if ($structure->parts[$i]->ifparameters) {
foreach ($structure->parts[$i]->parameters as $object) {
if (strtolower($object->attribute) == 'name') {
@@ -298,8 +360,12 @@ class MailController extends Controller {
}
}
}
+ /**
+ * All over again checking for the availability of attachment
+ */
if ($attachments[$i]['is_attachment']) {
$attachments[$i]['attachment'] = imap_fetchbody($stream, $email_id, $i + 1);
+ // decoding if encoded in base64_encode format else quoted_printable_encode
if ($structure->parts[$i]->encoding == 3) {
$attachments[$i]['attachment'] = base64_decode($attachments[$i]['attachment']);
} elseif ($structure->parts[$i]->encoding == 4) {
@@ -307,15 +373,19 @@ class MailController extends Controller {
}
}
}
+ // calling the save method to save each attachments
if ($this->save_attcahments($attachments, $thread_id) == true) {
return true;
}
}
}
- //=====================================
- // SAVE ATTACHMENT | Incomplete
- //=====================================
+ /**
+ * Function to save attachments
+ * @param type $attachments
+ * @param type $thread_id
+ * @return type bool
+ */
public function save_attcahments($attachments, $thread_id) {
if (count($attachments) != 0) {
foreach ($attachments as $at) {
@@ -324,7 +394,6 @@ class MailController extends Controller {
$filename = $at['filename'];
$ext = pathinfo($filename, PATHINFO_EXTENSION);
$tmpName = $at['filename'];
- // echo '
';
$fp = fopen($tmpName, 'r');
$content = fread($fp, filesize($tmpName));
$content2 = file_put_contents($at['filename'], $at['attachment']);
@@ -334,300 +403,11 @@ class MailController extends Controller {
$ticket_Thread->name = $filename;
$ticket_Thread->size = $filesize;
$ticket_Thread->type = $ext;
- $ticket_Thread->content = $fp; //$content;
+ $ticket_Thread->content = $fp;
$ticket_Thread->save();
}
}
}
return true;
}
-
- // // public function part($part)
- // // {
- // // $structure = $part->parts;
- // // return $structure;
- // // }
- // // public function fetchdata()
- // // {
- // // $tickets = Tickets::all();
- // // foreach ($tickets as $ticket)
- // // {
- // // echo $ticket->body.'