Second commit of version
This commit is contained in:
@@ -1,210 +0,0 @@
|
||||
<?php
|
||||
namespace App\Http\Controllers\Admin;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\AgentRequest;
|
||||
use App\Http\Requests\AgentUpdate;
|
||||
use App\Model\Agent\Assign_team_agent;
|
||||
use App\Model\Agent\Department;
|
||||
use App\Model\Agent\Groups;
|
||||
use App\Model\Agent\Teams;
|
||||
use App\Model\Utility\Timezones;
|
||||
use App\User;
|
||||
use DB;
|
||||
|
||||
/**
|
||||
* AgentController
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class AgentController extends Controller {
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->middleware('auth');
|
||||
$this->middleware('roles');
|
||||
}
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
* @param type Assign_team_agent $team_assign_agent
|
||||
* @param type Timezones $timezone
|
||||
* @param type Groups $group
|
||||
* @param type Department $department
|
||||
* @param type Teams $team
|
||||
* @return type Response
|
||||
*/
|
||||
public function create(Assign_team_agent $team_assign_agent, Timezones $timezone, Groups $group, Department $department, Teams $team) {
|
||||
try {
|
||||
$team = $team->get();
|
||||
//$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) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
* @param type User $user
|
||||
* @param type AgentRequest $request
|
||||
* @param type Assign_team_agent $team_assign_agent
|
||||
* @return type Response
|
||||
*/
|
||||
public function store(User $user, AgentRequest $request, Assign_team_agent $team_assign_agent) {
|
||||
try {
|
||||
//$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]);
|
||||
}
|
||||
/* 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');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
return redirect('agents')->with('fails', 'Agent can not Create');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return Response
|
||||
*/
|
||||
public function show($id) {
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
* @param type int $id
|
||||
* @param type User $user
|
||||
* @param type Assign_team_agent $team_assign_agent
|
||||
* @param type Timezones $timezone
|
||||
* @param type Groups $group
|
||||
* @param type Department $department
|
||||
* @param type Teams $team
|
||||
* @return type Response
|
||||
*/
|
||||
public function edit($id, User $user, Assign_team_agent $team_assign_agent, Timezones $timezone, Groups $group, Department $department, Teams $team) {
|
||||
try {
|
||||
$user = $user->whereId($id)->first();
|
||||
$team = $team->get();
|
||||
$teams1 = $team->lists('name', 'id');
|
||||
$timezones = $timezone->get();
|
||||
$groups = $group->get();
|
||||
$departments = $department->get();
|
||||
// $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 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 {
|
||||
//$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');
|
||||
//$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->role=$role;
|
||||
//==============================================
|
||||
$table = $team_assign_agent->where('agent_id', $id);
|
||||
$table->delete();
|
||||
$requests = $request->input('team_id');
|
||||
foreach ($requests as $req) {
|
||||
DB::insert('insert into team_assign_agent (team_id, agent_id) values (?,?)', [$req, $id]);
|
||||
}
|
||||
//Todo For success and failure conditions
|
||||
//$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');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
* @param type int $id
|
||||
* @param type User $user
|
||||
* @param type Assign_team_agent $team_assign_agent
|
||||
* @return type Response
|
||||
*/
|
||||
public function destroy($id, User $user, Assign_team_agent $team_assign_agent) {
|
||||
try {
|
||||
/* Becouse of foreign key we delete team_assign_agent first */
|
||||
$team_assign_agent = $team_assign_agent->where('agent_id', $id);
|
||||
$team_assign_agent->delete();
|
||||
$user = $user->whereId($id)->first();
|
||||
if ($user->delete()) {
|
||||
return redirect('agents')->with('success', 'Agent Deleted sucessfully');
|
||||
} else {
|
||||
return redirect('agents')->with('fails', 'Agent can not Delete ');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
return redirect('agents')->with('fails', 'Agent can not Delete if the team Excist');
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,155 +0,0 @@
|
||||
<?php
|
||||
namespace App\Http\Controllers\Admin;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\BanlistRequest;
|
||||
use App\Http\Requests\BanRequest;
|
||||
use App\Model\Email\Banlist;
|
||||
use App\User;
|
||||
|
||||
/**
|
||||
* BanlistController
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class BanlistController extends Controller {
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* @return type void
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->middleware('auth');
|
||||
$this->middleware('roles');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
* @param type Banlist $ban
|
||||
* @return type Response
|
||||
*/
|
||||
public function index(Banlist $ban) {
|
||||
try {
|
||||
$bans = $ban->get();
|
||||
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 type Response
|
||||
*/
|
||||
public function create() {
|
||||
try {
|
||||
return view('themes.default1.admin.emails.banlist.create');
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
* @param type banlist $ban
|
||||
* @param type BanRequest $request
|
||||
* @param type User $user
|
||||
* @return type Response
|
||||
*/
|
||||
public function store(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->ban = 1;
|
||||
$use->save();
|
||||
$ban->create($request->input())->save();
|
||||
return redirect('banlist')->with('success', 'Email Banned sucessfully');
|
||||
} else {
|
||||
$ban->create($request->input())->save();
|
||||
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');
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// return redirect('banlist')->with('fails','Email can not Ban');
|
||||
// }
|
||||
} catch (Exception $e) {
|
||||
return redirect('banlist')->with('fails', 'Email can not Ban');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return Response
|
||||
*/
|
||||
public function show($id) {
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
* @param type int $id
|
||||
* @param type Banlist $ban
|
||||
* @return type Response
|
||||
*/
|
||||
public function edit($id, Banlist $ban) {
|
||||
try {
|
||||
$bans = $ban->whereId($id)->first();
|
||||
return view('themes.default1.admin.emails.banlist.edit', compact('bans'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
* @param type int $id
|
||||
* @param type Banlist $ban
|
||||
* @param type BanlistRequest $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function update($id, 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');
|
||||
} else {
|
||||
return redirect('banlist')->with('fails', 'Banned Email not Updated');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
return redirect('banlist')->with('fails', 'Banned Email not Updated');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
* @param type int $id
|
||||
* @param type Banlist $ban
|
||||
* @return type Response
|
||||
*/
|
||||
public function destroy($id, Banlist $ban) {
|
||||
try {
|
||||
$bans = $ban->whereId($id)->first();
|
||||
/* Success and Falure condition */
|
||||
if ($bans->delete() == true) {
|
||||
return redirect('banlist')->with('success', 'Banned Email Deleted sucessfully');
|
||||
} else {
|
||||
return redirect('banlist')->with('fails', 'Banned Email can not Delete');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
return redirect('banlist')->with('fails', 'Banned Email can not Delete');
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,17 +0,0 @@
|
||||
<?php
|
||||
namespace App\Http\Controllers\Admin;
|
||||
use Illuminate\Foundation\Bus\DispatchesCommands;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
|
||||
/**
|
||||
* Controller
|
||||
*
|
||||
* @package Controllers
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
abstract class Controller extends BaseController {
|
||||
|
||||
use DispatchesCommands,
|
||||
ValidatesRequests;
|
||||
}
|
@@ -1,190 +0,0 @@
|
||||
<?php
|
||||
namespace App\Http\Controllers\Admin;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\DepartmentRequest;
|
||||
use App\Http\Requests\DepartmentUpdate;
|
||||
use App\Model\Agent\Department;
|
||||
use App\Model\Agent\Groups;
|
||||
use App\Model\Agent\Group_assign_department;
|
||||
use App\Model\Agent\Teams;
|
||||
use App\Model\Email\Emails;
|
||||
use App\Model\Email\Template;
|
||||
use App\Model\Manage\Sla_plan;
|
||||
use App\User;
|
||||
use DB;
|
||||
|
||||
/**
|
||||
* DepartmentController
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class DepartmentController extends Controller {
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->middleware('auth');
|
||||
$this->middleware('roles');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get index page
|
||||
* @param type Department $department
|
||||
* @return type Response
|
||||
*/
|
||||
public function index(Department $department) {
|
||||
try {
|
||||
$departments = $department->get();
|
||||
return view('themes.default1.admin.agent.departments.index', compact('departments'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
* @param type User $user
|
||||
* @param type Group_assign_department $group_assign_department
|
||||
* @param type Department $department
|
||||
* @param type Sla_plan $sla
|
||||
* @param type Template $template
|
||||
* @param type Emails $email
|
||||
* @param type Groups $group
|
||||
* @return type Response
|
||||
*/
|
||||
public function create(User $user, Group_assign_department $group_assign_department, Department $department, Sla_plan $sla, Template $template, Emails $email, Groups $group) {
|
||||
try {
|
||||
$slas = $sla->get();
|
||||
$user = $user->where('role', 'agent')->get();
|
||||
$emails = $email->get();
|
||||
//$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) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
* @param type Department $department
|
||||
* @param type DepartmentRequest $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function store(Department $department, DepartmentRequest $request) {
|
||||
try {
|
||||
$department->fill($request->except('group_id'))->save();
|
||||
$requests = $request->input('group_id');
|
||||
$id = $department->id;
|
||||
foreach ($requests as $req) {
|
||||
DB::insert('insert into group_assign_department(group_id, department_id) values (?,?)', [$req, $id]);
|
||||
}
|
||||
/* Succes And Failure condition */
|
||||
/* Check Whether the function Success or Fail */
|
||||
if ($department->save() == true) {
|
||||
return redirect('departments')->with('success', 'Department Created sucessfully');
|
||||
} else {
|
||||
return redirect('departments')->with('fails', 'Department can not Create');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
return redirect('departments')->with('fails', 'Department can not Create');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return Response
|
||||
*/
|
||||
public function show($id) {
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
* @param type int $id
|
||||
* @param type User $user
|
||||
* @param type Group_assign_department $group_assign_department
|
||||
* @param type Template $template
|
||||
* @param type Teams $team
|
||||
* @param type Department $department
|
||||
* @param type Sla_plan $sla
|
||||
* @param type Emails $email
|
||||
* @param type Groups $group
|
||||
* @return type Response
|
||||
*/
|
||||
public function edit($id, User $user, Group_assign_department $group_assign_department, Template $template, Teams $team, Department $department, Sla_plan $sla, Emails $email, Groups $group) {
|
||||
try {
|
||||
$slas = $sla->get();
|
||||
$user = $user->where('role', 'agent')->get();
|
||||
$emails = $email->get();
|
||||
//$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) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
* @param type int $id
|
||||
* @param type Group_assign_department $group_assign_department
|
||||
* @param type Department $department
|
||||
* @param type DepartmentUpdate $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function update($id, Group_assign_department $group_assign_department, Department $department, DepartmentUpdate $request) {
|
||||
try {
|
||||
$table = $group_assign_department->where('department_id', $id);
|
||||
$table->delete();
|
||||
$requests = $request->input('group_id');
|
||||
foreach ($requests as $req) {
|
||||
DB::insert('insert into group_assign_department (group_id, department_id) values (?,?)', [$req, $id]);
|
||||
}
|
||||
$departments = $department->whereId($id)->first();
|
||||
if ($departments->fill($request->except('group_access'))->save()) {
|
||||
return redirect('departments')->with('success', 'Department Updated sucessfully');
|
||||
} else {
|
||||
return redirect('departments')->with('fails', 'Department not Updated');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
return redirect('departments')->with('fails', 'Department not Updated');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
* @param type int $id
|
||||
* @param type Department $department
|
||||
* @param type Group_assign_department $group_assign_department
|
||||
* @return type Response
|
||||
*/
|
||||
public function destroy($id, Department $department, Group_assign_department $group_assign_department) {
|
||||
try {
|
||||
/* Becouse of foreign key we delete group_assign_department first */
|
||||
$group_assign_department = $group_assign_department->where('department_id', $id);
|
||||
$group_assign_department->delete();
|
||||
$departments = $department->whereId($id)->first();
|
||||
/* Check the function is Success or Fail */
|
||||
if ($departments->delete() == true) {
|
||||
return redirect('departments')->with('success', 'Department Deleted sucessfully');
|
||||
} else {
|
||||
return redirect('departments')->with('fails', 'Department can not Delete');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
return redirect('departments')->with('fails', 'Department can not Delete');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -1,161 +0,0 @@
|
||||
<?php
|
||||
namespace App\Http\Controllers\Admin;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\EmailsEditRequest;
|
||||
use App\Http\Requests\EmailsRequest;
|
||||
use App\Model\Agent\Department;
|
||||
use App\Model\Email\Emails;
|
||||
use App\Model\Manage\Help_topic;
|
||||
use App\Model\Utility\MailboxProtocol;
|
||||
use App\Model\Utility\Priority;
|
||||
use Crypt;
|
||||
|
||||
/**
|
||||
* EmailsController
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class EmailsController extends Controller {
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* @return type
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->middleware('auth');
|
||||
$this->middleware('roles');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
* @param type Emails $emails
|
||||
* @return type Response
|
||||
*/
|
||||
public function index(Emails $emails) {
|
||||
try {
|
||||
$emails = $emails->get();
|
||||
return view('themes.default1.admin.emails.emails.index', compact('emails'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
* @param type Department $department
|
||||
* @param type Help_topic $help
|
||||
* @param type Priority $priority
|
||||
* @param type MailboxProtocol $mailbox_protocol
|
||||
* @return type Response
|
||||
*/
|
||||
public function create(Department $department, Help_topic $help, 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('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
* @param type Emails $email
|
||||
* @param type EmailsRequest $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function store(Emails $email, EmailsRequest $request) {
|
||||
try {
|
||||
$password = $request->input('password');
|
||||
$encrypted = Crypt::encrypt($password);
|
||||
$email->password = $encrypted;
|
||||
if ($email->fill($request->except('password'))->save() == true) {
|
||||
return redirect('emails')->with('success', 'Email Created sucessfully');
|
||||
} else {
|
||||
return redirect('emails')->with('fails', 'Email can not Create');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
return redirect('emails')->with('fails', 'Email can not Create');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return Response
|
||||
*/
|
||||
public function show($id) {
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
* @param type int $id
|
||||
* @param type Department $department
|
||||
* @param type Help_topic $help
|
||||
* @param type Emails $email
|
||||
* @param type Priority $priority
|
||||
* @param type MailboxProtocol $mailbox_protocol
|
||||
* @return type Response
|
||||
*/
|
||||
public function edit($id, Department $department, Help_topic $help, Emails $email, 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('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
* @param type $id
|
||||
* @param type Emails $email
|
||||
* @param type EmailsEditRequest $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function update($id, Emails $email, EmailsEditRequest $request) {
|
||||
$password = $request->input('password');
|
||||
$encrypted = Crypt::encrypt($password);
|
||||
//echo $encrypted;
|
||||
//$value = Crypt::decrypt($encrypted);
|
||||
//echo $value;
|
||||
try {
|
||||
$emails = $email->whereId($id)->first();
|
||||
$emails->password = $encrypted;
|
||||
$emails->fill($request->except('password'))->save();
|
||||
return redirect('emails')->with('success', 'Email Updated sucessfully');
|
||||
} catch (Exception $e) {
|
||||
return redirect('emails')->with('fails', 'Email not updated');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
* @param type int $id
|
||||
* @param type Emails $email
|
||||
* @return type Response
|
||||
*/
|
||||
public function destroy($id, Emails $email) {
|
||||
try {
|
||||
$emails = $email->whereId($id)->first();
|
||||
if ($emails->delete() == true) {
|
||||
return redirect('emails')->with('success', 'Email Deleted sucessfully');
|
||||
} else {
|
||||
return redirect('emails')->with('fails', 'Email can not Delete ');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
return redirect('emails')->with('fails', 'Email can not Delete ');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -1,161 +0,0 @@
|
||||
<?php
|
||||
namespace App\Http\Controllers\Admin;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\FormRequest;
|
||||
use App\Model\Manage\Forms;
|
||||
use App\Model\Utility\Form_type;
|
||||
use App\Model\Utility\Form_visibility;
|
||||
|
||||
/**
|
||||
* FormController
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class FormController extends Controller {
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* @return type void
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->middleware('auth');
|
||||
$this->middleware('roles');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
* @param type Forms $form
|
||||
* @return type Response
|
||||
*/
|
||||
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('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
* @param type Form_visibility $visibility
|
||||
* @param type Form_type $type
|
||||
* @return type Response
|
||||
*/
|
||||
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('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
* @param type Forms $form
|
||||
* @param type FormRequest $request
|
||||
* @return type Response
|
||||
*/
|
||||
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) {
|
||||
/* Redirect to Index page with Success Message */
|
||||
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');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
/* Redirect to Index page with Fail Message */
|
||||
return redirect('form')->with('fails', 'Form can not Create');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return Response
|
||||
*/
|
||||
public function show($id) {
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
* @param type int $id
|
||||
* @param type 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 {
|
||||
/* 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('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
* @param type int $id
|
||||
* @param type Forms $form
|
||||
* @param type FormRequest $request
|
||||
* @return type Response
|
||||
*/
|
||||
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) {
|
||||
/* redirect to Index page with Success Message */
|
||||
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');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
/* Redirect to Index page with Fail Message */
|
||||
return redirect('form')->with('fails', 'Form can not Create');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
* @param type int $id
|
||||
* @param type Forms $form
|
||||
* @return type Response
|
||||
*/
|
||||
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) {
|
||||
/* redirect to Index page with Success Message */
|
||||
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');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
/* Redirect to Index page with Fail Message */
|
||||
return redirect('form')->with('fails', 'Form can not Create');
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,203 +0,0 @@
|
||||
<?php
|
||||
namespace App\Http\Controllers\Admin;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\GroupRequest;
|
||||
use App\Model\Agent\Department;
|
||||
use App\Model\Agent\Groups;
|
||||
use App\Model\Agent\Group_assign_department;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Input;
|
||||
|
||||
/**
|
||||
* GroupController
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class GroupController extends Controller {
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* @return type void
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->middleware('auth');
|
||||
$this->middleware('roles');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
* @param type Groups $group
|
||||
* @param type Department $department
|
||||
* @param type Group_assign_department $group_assign_department
|
||||
* @return type Response
|
||||
*/
|
||||
public function index(Groups $group, Department $department, Group_assign_department $group_assign_department) {
|
||||
try {
|
||||
$groups = $group->get();
|
||||
$departments = $department->lists('id');
|
||||
return view('themes.default1.admin.agent.groups.index', compact('departments', 'group_assign_department', 'groups'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
* @return type Response
|
||||
*/
|
||||
public function create() {
|
||||
try {
|
||||
return view('themes.default1.admin.agent.groups.create');
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
* @param type Groups $group
|
||||
* @param type GroupRequest $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function store(Groups $group, GroupRequest $request) {
|
||||
try {
|
||||
/* Check Whether function success or not */
|
||||
if ($group->fill($request->input())->save() == true) {
|
||||
/* redirect to Index page with Success Message */
|
||||
return redirect('groups')->with('success', 'Groups Created Successfully');
|
||||
} else {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('groups')->with('fails', 'Groups can not Create');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('groups')->with('fails', 'Groups can not Create');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return Response
|
||||
*/
|
||||
public function show($id, Groups $group, Request $request) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
* @param type int $id
|
||||
* @param type Groups $group
|
||||
* @return type Response
|
||||
*/
|
||||
public function edit($id, Groups $group) {
|
||||
try {
|
||||
$groups = $group->whereId($id)->first();
|
||||
return view('themes.default1.admin.agent.groups.edit', compact('groups'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
* @param type int $id
|
||||
* @param type Groups $group
|
||||
* @param type Request $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function update($id, Groups $group, Request $request) {
|
||||
try {
|
||||
$var = $group->whereId($id)->first();
|
||||
//Updating Name
|
||||
// $name = $request->Input('name');
|
||||
// $var->name = $name;
|
||||
//Updating Status
|
||||
$status = $request->Input('group_status');
|
||||
$var->group_status = $status;
|
||||
//Updating can_create_ticket field
|
||||
$createTicket = $request->Input('can_create_ticket');
|
||||
$var->can_create_ticket = $createTicket;
|
||||
//Updating can_edit_ticket field
|
||||
$editTicket = $request->Input('can_edit_ticket');
|
||||
$var->can_edit_ticket = $editTicket;
|
||||
//Updating can_post_ticket field
|
||||
$postTicket = $request->Input('can_post_ticket');
|
||||
$var->can_post_ticket = $postTicket;
|
||||
//Updating can_close_ticket field
|
||||
$closeTicket = $request->Input('can_close_ticket');
|
||||
$var->can_close_ticket = $closeTicket;
|
||||
//Updating can_assign_ticket field
|
||||
$assignTicket = $request->Input('can_assign_ticket');
|
||||
$var->can_assign_ticket = $assignTicket;
|
||||
//Updating can_trasfer_ticket field
|
||||
$trasferTicket = $request->Input('can_trasfer_ticket');
|
||||
$var->can_trasfer_ticket = $trasferTicket;
|
||||
//Updating can_delete_ticket field
|
||||
$deleteTicket = $request->Input('can_delete_ticket');
|
||||
$var->can_delete_ticket = $deleteTicket;
|
||||
//Updating can_ban_email field
|
||||
$banEmail = $request->Input('can_ban_email');
|
||||
$var->can_ban_email = $banEmail;
|
||||
//Updating can_manage_canned field
|
||||
$manageCanned = $request->Input('can_manage_canned');
|
||||
$var->can_manage_canned = $manageCanned;
|
||||
//Updating can_manage_faq field
|
||||
$manageFaq = $request->Input('can_manage_faq');
|
||||
$var->can_manage_faq = $manageFaq;
|
||||
//Updating can_view_agent_stats field
|
||||
$viewAgentStats = $request->Input('can_view_agent_stats');
|
||||
$var->can_view_agent_stats = $viewAgentStats;
|
||||
//Updating department_access field
|
||||
$departmentAccess = $request->Input('department_access');
|
||||
$var->department_access = $departmentAccess;
|
||||
//Updating admin_notes field
|
||||
$adminNotes = $request->Input('admin_notes');
|
||||
$var->admin_notes = $adminNotes;
|
||||
/* Check whether function success or not */
|
||||
if ($var->save() == true) {
|
||||
/* redirect to Index page with Success Message */
|
||||
return redirect('groups')->with('success', 'Group Updated Successfully');
|
||||
} else {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('groups')->with('fails', 'Group can not Update');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('groups')->with('fails', 'Groups can not Create');
|
||||
}
|
||||
}
|
||||
|
||||
// public function delete($id, Groups $group)
|
||||
// {
|
||||
// return view('')
|
||||
// }
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
* @param type int $id
|
||||
* @param type Groups $group
|
||||
* @param type Group_assign_department $group_assign_department
|
||||
* @return type Response
|
||||
*/
|
||||
public function destroy($id, Groups $group, Group_assign_department $group_assign_department) {
|
||||
try {
|
||||
$group_assign_department->where('group_id', $id)->delete();
|
||||
$groups = $group->whereId($id)->first();
|
||||
/* Check whether function success or not */
|
||||
if ($groups->delete() == true) {
|
||||
/* redirect to Index page with Success Message */
|
||||
return redirect('groups')->with('success', 'Group Deleted Successfully');
|
||||
} else {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('groups')->with('fails', 'Group can not Delete');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('groups')->with('fails', 'Groups can not Create');
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,182 +0,0 @@
|
||||
<?php
|
||||
namespace App\Http\Controllers\Admin;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\HelptopicRequest;
|
||||
use App\Http\Requests\HelptopicUpdate;
|
||||
use App\Model\Agent\Agents;
|
||||
use App\Model\Agent\Department;
|
||||
use App\Model\Form\Form_name;
|
||||
use App\Model\Manage\Help_topic;
|
||||
use App\Model\Manage\Sla_plan;
|
||||
use App\Model\Utility\Priority;
|
||||
|
||||
/**
|
||||
* HelptopicController
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class HelptopicController extends Controller {
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* @return type vodi
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->middleware('auth');
|
||||
$this->middleware('roles');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
* @param type Help_topic $topic
|
||||
* @return type Response
|
||||
*/
|
||||
public function index(Help_topic $topic) {
|
||||
try {
|
||||
$topics = $topic->get();
|
||||
return view('themes.default1.admin.manage.helptopic.index', compact('topics'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
* @param type Priority $priority
|
||||
* @param type Department $department
|
||||
* @param type Help_topic $topic
|
||||
* @param type Form_name $form
|
||||
* @param type Agents $agent
|
||||
* @param type Sla_plan $sla
|
||||
* @return type Response
|
||||
*/
|
||||
/*
|
||||
================================================
|
||||
| Route to Create view file passing Model Values
|
||||
| 1.Department Model
|
||||
| 2.Help_topic Model
|
||||
| 3.Agents Model
|
||||
| 4.Sla_plan Model
|
||||
| 5.Forms Model
|
||||
================================================
|
||||
*/
|
||||
public function create(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('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
* @param type Help_topic $topic
|
||||
* @param type HelptopicRequest $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function store(Help_topic $topic, HelptopicRequest $request) {
|
||||
try {
|
||||
/* Check whether function success or not */
|
||||
if ($topic->fill($request->input())->save() == true) {
|
||||
/* redirect to Index page with Success Message */
|
||||
return redirect('helptopic')->with('success', 'Helptopic Created Successfully');
|
||||
} else {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('helptopic')->with('fails', 'Helptopic can not Create');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('helptopic')->with('fails', 'Helptopic can not Create');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return Response
|
||||
*/
|
||||
public function show($id) {
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
* @param type $id
|
||||
* @param type Priority $priority
|
||||
* @param type Department $department
|
||||
* @param type Help_topic $topic
|
||||
* @param type Form_name $form
|
||||
* @param type Agents $agent
|
||||
* @param type Sla_plan $sla
|
||||
* @return type Response
|
||||
*/
|
||||
public function edit($id, 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('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
* @param type $id
|
||||
* @param type Help_topic $topic
|
||||
* @param type HelptopicUpdate $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function update($id, Help_topic $topic, HelptopicUpdate $request) {
|
||||
try {
|
||||
$topics = $topic->whereId($id)->first();
|
||||
/* Check whether function success or not */
|
||||
if ($topics->fill($request->input())->save() == true) {
|
||||
/* redirect to Index page with Success Message */
|
||||
return redirect('helptopic')->with('success', 'Helptopic Updated Successfully');
|
||||
} else {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('helptopic')->with('fails', 'Helptopic can not Updated');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('helptopic')->with('fails', 'Helptopic can not Create');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
* @param type int $id
|
||||
* @param type Help_topic $topic
|
||||
* @return type Response
|
||||
*/
|
||||
public function destroy($id, Help_topic $topic) {
|
||||
try {
|
||||
$topics = $topic->whereId($id)->first();
|
||||
/* Check whether function success or not */
|
||||
if ($topics->delete() == true) {
|
||||
/* redirect to Index page with Success Message */
|
||||
return redirect('helptopic')->with('success', 'Helptopic Deleted Successfully');
|
||||
} else {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('helptopic')->with('fails', 'Helptopic can not Delete');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('helptopic')->with('fails', 'Helptopic can not Create');
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,36 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
/**
|
||||
* -----------------------------------------------
|
||||
* HelptopicController
|
||||
* -----------------------------------------------
|
||||
* This controller renders your application's "dashboard" for users that
|
||||
* are authenticated. Of course, you are free to change or remove the
|
||||
* controller as you wish. It is just here to get your app started!
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class HomeController extends Controller {
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->middleware('auth');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the application dashboard to the user.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function index() {
|
||||
return view('themes/default1/admin/dashboard');
|
||||
}
|
||||
|
||||
}
|
@@ -1,102 +0,0 @@
|
||||
<?php
|
||||
namespace App\Http\Controllers\Admin;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\ProfilePassword;
|
||||
use App\Http\Requests\ProfileRequest;
|
||||
use App\User;
|
||||
use Auth;
|
||||
use Hash;
|
||||
use Input;
|
||||
|
||||
/**
|
||||
* ProfileController
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class ProfileController extends Controller {
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* @return type void
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->middleware('auth');
|
||||
$this->middleware('roles');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get profile page
|
||||
* @return type Response
|
||||
*/
|
||||
public function getProfile() {
|
||||
try {
|
||||
$user = Auth::user();
|
||||
if ($user) {
|
||||
return view('themes.default1.admin.profile', compact('user'));
|
||||
} else {
|
||||
return redirect('404');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
return redirect('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Post profile page
|
||||
* @param type int $id
|
||||
* @param type ProfileRequest $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function postProfile($id, ProfileRequest $request) {
|
||||
$user = Auth::user();
|
||||
$user->gender = $request->input('gender');
|
||||
$user->save();
|
||||
if ($user->profile_pic == 'avatar5.png' || $user->profile_pic == 'avatar2.png') {
|
||||
if ($request->input('gender') == 1) {
|
||||
$name = 'avatar5.png';
|
||||
$destinationPath = '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();
|
||||
return redirect('guest')->with('success', 'Password Updated sucessfully');
|
||||
} else {
|
||||
return redirect('guest')->with('fails', 'Password was not Updated');
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,434 +0,0 @@
|
||||
<?php
|
||||
namespace App\Http\Controllers\Admin;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\CompanyRequest;
|
||||
use App\Http\Requests\EmailRequest;
|
||||
use App\Http\Requests\SystemRequest;
|
||||
use App\Model\Agent\Department;
|
||||
use App\Model\Email\Emails;
|
||||
use App\Model\Email\Template;
|
||||
use App\Model\Manage\Help_topic;
|
||||
use App\Model\Manage\Sla_plan;
|
||||
use App\Model\Settings\Access;
|
||||
use App\Model\Settings\Alert;
|
||||
use App\Model\Settings\Company;
|
||||
use App\Model\Settings\Email;
|
||||
use App\Model\Settings\Responder;
|
||||
use App\Model\Settings\System;
|
||||
use App\Model\Settings\Ticket;
|
||||
use App\Model\Utility\Date_format;
|
||||
use App\Model\Utility\Date_time_format;
|
||||
use App\Model\Utility\Logs;
|
||||
use App\Model\Utility\Priority;
|
||||
use App\Model\Utility\Timezones;
|
||||
use App\Model\Utility\Time_format;
|
||||
use Illuminate\Http\Request;
|
||||
use Input;
|
||||
|
||||
/**
|
||||
* SettingsController
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class SettingsController extends Controller {
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->middleware('auth');
|
||||
$this->middleware('roles');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
* @return Response
|
||||
* @param $compant instance of company table
|
||||
*
|
||||
* get the form for company setting page
|
||||
*
|
||||
*/
|
||||
public function getcompany(Company $company) {
|
||||
try {
|
||||
/* fetch the values of company from company table */
|
||||
$companys = $company->whereId('1')->first();
|
||||
/* Direct to Company Settings Page */
|
||||
return view('themes.default1.admin.settings.company', compact('companys'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type Company $company
|
||||
* @param type CompanyRequest $request *
|
||||
* @return Response
|
||||
*/
|
||||
public function postcompany($id, Company $company, CompanyRequest $request) {
|
||||
try {
|
||||
/* fetch the values of company request */
|
||||
$companys = $company->whereId('1')->first();
|
||||
if (Input::file('logo')) {
|
||||
$name = Input::file('logo')->getClientOriginalName();
|
||||
$destinationPath = 'dist';
|
||||
$fileName = rand(0000, 9999) . '.' . $name;
|
||||
Input::file('logo')->move($destinationPath, $fileName);
|
||||
$companys->logo = $fileName;
|
||||
}
|
||||
/* Check whether function success or not */
|
||||
if ($companys->fill($request->except('logo'))->save() == true) {
|
||||
/* redirect to Index page with Success Message */
|
||||
return redirect('getcompany')->with('success', 'Company Updated Successfully');
|
||||
} else {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('getcompany')->with('fails', 'Company can not Updated');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('getcompany')->with('fails', 'Company can not Updated');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get the form for System setting page
|
||||
* @param type System $system
|
||||
* @param type Department $department
|
||||
* @param type Timezones $timezone
|
||||
* @param type Date_format $date
|
||||
* @param type Date_time_format $date_time
|
||||
* @param type Time_format $time
|
||||
* @param type Logs $log
|
||||
* @return type Response
|
||||
*/
|
||||
public function getsystem(System $system, Department $department, Timezones $timezone, Date_format $date, Date_time_format $date_time, Time_format $time, Logs $log) {
|
||||
try {
|
||||
/* fetch the values of system from system table */
|
||||
$systems = $system->whereId('1')->first();
|
||||
/* Fetch the values from Department table */
|
||||
$departments = $department->get();
|
||||
/* Fetch the values from Timezones table */
|
||||
$timezones = $timezone->get();
|
||||
/* Direct to System Settings Page */
|
||||
return view('themes.default1.admin.settings.system', compact('systems', 'departments', 'timezones', 'time', 'date', 'date_time', 'log'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
* @param type int $id
|
||||
* @param type System $system
|
||||
* @param type SystemRequest $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function postsystem($id, System $system, SystemRequest $request) {
|
||||
try {
|
||||
/* fetch the values of system request */
|
||||
$systems = $system->whereId('1')->first();
|
||||
/* fill the values to coompany table */
|
||||
/* Check whether function success or not */
|
||||
//dd($request);
|
||||
if ($systems->fill($request->input())->save() == true) {
|
||||
/* redirect to Index page with Success Message */
|
||||
return redirect('getsystem')->with('success', 'System Updated Successfully');
|
||||
} else {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('getsystem')->with('fails', 'System can not Updated');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('getsystem')->with('fails', 'System can not Updated');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get the form for Ticket setting page
|
||||
* @param type Ticket $ticket
|
||||
* @param type Sla_plan $sla
|
||||
* @param type Help_topic $topic
|
||||
* @param type Priority $priority
|
||||
* @return type Response
|
||||
*/
|
||||
public function getticket(Ticket $ticket, Sla_plan $sla, Help_topic $topic, Priority $priority) {
|
||||
try {
|
||||
/* fetch the values of ticket from ticket table */
|
||||
$tickets = $ticket->whereId('1')->first();
|
||||
/* Fetch the values from SLA Plan table */
|
||||
$slas = $sla->get();
|
||||
/* Fetch the values from Help_topic table */
|
||||
$topics = $topic->get();
|
||||
/* Direct to Ticket Settings Page */
|
||||
return view('themes.default1.admin.settings.ticket', compact('tickets', 'slas', 'topics', 'priority'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
* @param type int $id
|
||||
* @param type Ticket $ticket
|
||||
* @param type Request $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function postticket($id, Ticket $ticket, Request $request) {
|
||||
try {
|
||||
/* fetch the values of ticket request */
|
||||
$tickets = $ticket->whereId('1')->first();
|
||||
/* fill the values to coompany table */
|
||||
$tickets->fill($request->except('captcha', 'claim_response', 'assigned_ticket', 'answered_ticket', 'agent_mask', 'html', 'client_update'))->save();
|
||||
/* insert checkbox to Database */
|
||||
$tickets->captcha = $request->input('captcha');
|
||||
$tickets->claim_response = $request->input('claim_response');
|
||||
$tickets->assigned_ticket = $request->input('assigned_ticket');
|
||||
$tickets->answered_ticket = $request->input('answered_ticket');
|
||||
$tickets->agent_mask = $request->input('agent_mask');
|
||||
$tickets->html = $request->input('html');
|
||||
$tickets->client_update = $request->input('client_update');
|
||||
/* Check whether function success or not */
|
||||
if ($tickets->save() == true) {
|
||||
/* redirect to Index page with Success Message */
|
||||
return redirect('getticket')->with('success', 'Ticket Updated Successfully');
|
||||
} else {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('getticket')->with('fails', 'Ticket can not Updated');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('getticket')->with('fails', 'Ticket can not Updated');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get the form for Email setting page
|
||||
* @param type Email $email
|
||||
* @param type Template $template
|
||||
* @param type Emails $email1
|
||||
* @return type Response
|
||||
*/
|
||||
public function getemail(Email $email, Template $template, Emails $email1) {
|
||||
try {
|
||||
/* fetch the values of email from Email table */
|
||||
$emails = $email->whereId('1')->first();
|
||||
/* Fetch the values from Template table */
|
||||
$templates = $template->get();
|
||||
/* Fetch the values from Emails table */
|
||||
$emails1 = $email1->get();
|
||||
/* Direct to Email Settings Page */
|
||||
return view('themes.default1.admin.settings.email', compact('emails', 'templates', 'emails1'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
* @param type int $id
|
||||
* @param type Email $email
|
||||
* @param type EmailRequest $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function postemail($id, Email $email, EmailRequest $request) {
|
||||
try {
|
||||
/* fetch the values of email request */
|
||||
$emails = $email->whereId('1')->first();
|
||||
/* fill the values to email table */
|
||||
$emails->fill($request->except('email_fetching', 'all_emails', 'email_collaborator', 'strip', 'attachment'))->save();
|
||||
/* insert checkboxes to database */
|
||||
$emails->email_fetching = $request->input('email_fetching');
|
||||
$emails->all_emails = $request->input('all_emails');
|
||||
$emails->email_collaborator = $request->input('email_collaborator');
|
||||
$emails->strip = $request->input('strip');
|
||||
$emails->attachment = $request->input('attachment');
|
||||
/* Check whether function success or not */
|
||||
if ($emails->save() == true) {
|
||||
/* redirect to Index page with Success Message */
|
||||
return redirect('getemail')->with('success', 'Email Updated Successfully');
|
||||
} else {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('getemail')->with('fails', 'Email can not Updated');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('getemail')->with('fails', 'Email can not Updated');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get the form for Access setting page
|
||||
* @param type Access $access
|
||||
* @return type Response
|
||||
*/
|
||||
public function getaccess(Access $access) {
|
||||
try {
|
||||
/* fetch the values of access from access table */
|
||||
$accesses = $access->whereId('1')->first();
|
||||
/* Direct to Access Settings Page */
|
||||
return view('themes.default1.admin.settings.access', compact('accesses'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
* @param type Access $access
|
||||
* @param type Request $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function postaccess(Access $access, Request $request) {
|
||||
try {
|
||||
/* fetch the values of access request */
|
||||
$accesses = $access->whereId('1')->first();
|
||||
/* fill the values to access table */
|
||||
$accesses->fill($request->except('password_reset', 'bind_agent_ip', 'reg_require', 'quick_access'))->save();
|
||||
/* insert checkbox value to DB */
|
||||
$accesses->password_reset = $request->input('password_reset');
|
||||
$accesses->bind_agent_ip = $request->input('bind_agent_ip');
|
||||
$accesses->reg_require = $request->input('reg_require');
|
||||
$accesses->quick_access = $request->input('quick_access');
|
||||
/* Check whether function success or not */
|
||||
if ($accesses->save() == true) {
|
||||
/* redirect to Index page with Success Message */
|
||||
return redirect('getaccess')->with('success', 'Access Updated Successfully');
|
||||
} else {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('getaccess')->with('fails', 'Access can not Updated');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('getaccess')->with('fails', 'Access can not Updated');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get the form for Responder setting page
|
||||
* @param type Responder $responder
|
||||
* @return type Response
|
||||
*/
|
||||
public function getresponder(Responder $responder) {
|
||||
try {
|
||||
/* fetch the values of responder from responder table */
|
||||
$responders = $responder->whereId('1')->first();
|
||||
/* Direct to Responder Settings Page */
|
||||
return view('themes.default1.admin.settings.responder', compact('responders'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
* @param type Responder $responder
|
||||
* @param type Request $request
|
||||
* @return type
|
||||
*/
|
||||
public function postresponder(Responder $responder, Request $request) {
|
||||
try {
|
||||
/* fetch the values of responder request */
|
||||
$responders = $responder->whereId('1')->first();
|
||||
/* insert Checkbox value to DB */
|
||||
$responders->new_ticket = $request->input('new_ticket');
|
||||
$responders->agent_new_ticket = $request->input('agent_new_ticket');
|
||||
$responders->submitter = $request->input('submitter');
|
||||
$responders->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');
|
||||
} else {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('getresponder')->with('fails', 'Responder can not Updated');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('getresponder')->with('fails', 'Responder can not Updated');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get the form for Alert setting page
|
||||
* @param type Alert $alert
|
||||
* @return type Response
|
||||
*/
|
||||
public function getalert(Alert $alert) {
|
||||
try {
|
||||
/* fetch the values of alert from alert table */
|
||||
$alerts = $alert->whereId('1')->first();
|
||||
/* Direct to Alert Settings Page */
|
||||
return view('themes.default1.admin.settings.alert', compact('alerts'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
* @param type $id
|
||||
* @param type Alert $alert
|
||||
* @param type Request $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function postalert($id, Alert $alert, Request $request) {
|
||||
try {
|
||||
/* fetch the values of alert request */
|
||||
$alerts = $alert->whereId('1')->first();
|
||||
/* Insert Checkbox to DB */
|
||||
$alerts->assignment_status = $request->input('assignment_status');
|
||||
$alerts->ticket_status = $request->input('ticket_status');
|
||||
$alerts->overdue_department_member = $request->input('overdue_department_member');
|
||||
$alerts->sql_error = $request->input('sql_error');
|
||||
$alerts->excessive_failure = $request->input('excessive_failure');
|
||||
$alerts->overdue_status = $request->input('overdue_status');
|
||||
$alerts->overdue_assigned_agent = $request->input('overdue_assigned_agent');
|
||||
$alerts->overdue_department_manager = $request->input('overdue_department_manager');
|
||||
$alerts->internal_status = $request->input('internal_status');
|
||||
$alerts->internal_last_responder = $request->input('internal_last_responder');
|
||||
$alerts->internal_assigned_agent = $request->input('internal_assigned_agent');
|
||||
$alerts->internal_department_manager = $request->input('internal_department_manager');
|
||||
$alerts->assignment_assigned_agent = $request->input('assignment_assigned_agent');
|
||||
$alerts->assignment_team_leader = $request->input('assignment_team_leader');
|
||||
$alerts->assignment_team_member = $request->input('assignment_team_member');
|
||||
$alerts->system_error = $request->input('system_error');
|
||||
$alerts->transfer_department_member = $request->input('transfer_department_member');
|
||||
$alerts->transfer_department_manager = $request->input('transfer_department_manager');
|
||||
$alerts->transfer_assigned_agent = $request->input('transfer_assigned_agent');
|
||||
$alerts->transfer_status = $request->input('transfer_status');
|
||||
$alerts->message_organization_accmanager = $request->input('message_organization_accmanager');
|
||||
$alerts->message_department_manager = $request->input('message_department_manager');
|
||||
$alerts->message_assigned_agent = $request->input('message_assigned_agent');
|
||||
$alerts->message_last_responder = $request->input('message_last_responder');
|
||||
$alerts->message_status = $request->input('message_status');
|
||||
$alerts->ticket_organization_accmanager = $request->input('ticket_organization_accmanager');
|
||||
$alerts->ticket_department_manager = $request->input('ticket_department_manager');
|
||||
$alerts->ticket_department_member = $request->input('ticket_department_member');
|
||||
$alerts->ticket_admin_email = $request->input('ticket_admin_email');
|
||||
/* fill the values to coompany table */
|
||||
/* Check whether function success or not */
|
||||
if ($alerts->save() == true) {
|
||||
/* redirect to Index page with Success Message */
|
||||
return redirect('getalert')->with('success', 'Alert Updated Successfully');
|
||||
} else {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('getalert')->with('fails', 'Alert can not Updated');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('getalert')->with('fails', 'Alert can not Updated');
|
||||
}
|
||||
}
|
||||
|
||||
public function getck() {
|
||||
return view('themes.default1.ckeditor');
|
||||
}
|
||||
}
|
@@ -1,158 +0,0 @@
|
||||
<?php namespace App\Http\Controllers\Admin;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\SlaRequest;
|
||||
use App\Http\Requests\SlaUpdate;
|
||||
use App\Model\Manage\Sla_plan;
|
||||
|
||||
/**
|
||||
* SlaController
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class SlaController extends Controller {
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* @return type void
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->middleware('auth');
|
||||
$this->middleware('roles');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
* @param type Sla_plan $sla
|
||||
* @return type Response
|
||||
*/
|
||||
public function index(Sla_plan $sla) {
|
||||
try {
|
||||
/* Declare a Variable $slas to store all Values From Sla_plan Table */
|
||||
$slas = $sla->get();
|
||||
/* Listing the values From Sla_plan Table */
|
||||
return view('themes.default1.admin.manage.sla.index', compact('slas'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
* @return type Response
|
||||
*/
|
||||
public function create() {
|
||||
try {
|
||||
/* Direct to Create Page */
|
||||
return view('themes.default1.admin.manage.sla.create');
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
* @param type Sla_plan $sla
|
||||
* @param type SlaRequest $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function store(Sla_plan $sla, SlaRequest $request) {
|
||||
try {
|
||||
/* Fill the request values to Sla_plan Table */
|
||||
/* Check whether function success or not */
|
||||
if ($sla->fill($request->input())->save() == true) {
|
||||
/* redirect to Index page with Success Message */
|
||||
return redirect('sla')->with('success', 'SLA Plan Created Successfully');
|
||||
} else {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('sla')->with('fails', 'SLA Plan can not Create');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('sla')->with('fails', 'SLA Plan can not Create');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return Response
|
||||
*/
|
||||
public function show($id) {
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
* @param type int $id
|
||||
* @param type Sla_plan $sla
|
||||
* @return type Response
|
||||
*/
|
||||
public function edit($id, Sla_plan $sla) {
|
||||
try {
|
||||
/* Direct to edit page along values of perticular field using Id */
|
||||
$slas = $sla->whereId($id)->first();
|
||||
$slas->get();
|
||||
return view('themes.default1.admin.manage.sla.edit', compact('slas'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
* @param type int $id
|
||||
* @param type Sla_plan $sla
|
||||
* @param type SlaUpdate $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function update($id, Sla_plan $sla, SlaUpdate $request) {
|
||||
try {
|
||||
/* Fill values to selected field using Id except Check box */
|
||||
$slas = $sla->whereId($id)->first();
|
||||
$slas->fill($request->except('transient', 'ticket_overdue'))->save();
|
||||
/* Update transient checkox field */
|
||||
$slas->transient = $request->input('transient');
|
||||
/* Update ticket_overdue checkox field */
|
||||
$slas->ticket_overdue = $request->input('ticket_overdue');
|
||||
/* Check whether function success or not */
|
||||
if ($slas->save() == true) {
|
||||
/* redirect to Index page with Success Message */
|
||||
return redirect('sla')->with('success', 'SLA Plan Updated Successfully');
|
||||
} else {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('sla')->with('fails', 'SLA Plan can not Update');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('sla')->with('fails', 'SLA Plan can not Update');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
* @param type int $id
|
||||
* @param type Sla_plan $sla
|
||||
* @return type Response
|
||||
*/
|
||||
public function destroy($id, Sla_plan $sla) {
|
||||
try {
|
||||
/* Delete a perticular field from the database by delete() using Id */
|
||||
$slas = $sla->whereId($id)->first();
|
||||
/* Check whether function success or not */
|
||||
if ($slas->delete() == true) {
|
||||
/* redirect to Index page with Success Message */
|
||||
return redirect('sla')->with('success', 'SLA Plan Deleted Successfully');
|
||||
} else {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('sla')->with('fails', 'SLA Plan can not Delete');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('sla')->with('fails', 'SLA Plan can not Delete');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -1,183 +0,0 @@
|
||||
<?php
|
||||
namespace App\Http\Controllers\Admin;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\TeamRequest;
|
||||
use App\Http\Requests\TeamUpdate;
|
||||
use App\Model\Agent\Assign_team_agent;
|
||||
use App\Model\Agent\Teams;
|
||||
use App\User;
|
||||
|
||||
/**
|
||||
* TeamController
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class TeamController extends Controller {
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* @return type void
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->middleware('auth');
|
||||
$this->middleware('roles');
|
||||
}
|
||||
|
||||
/**
|
||||
* get Index page
|
||||
* @param type Teams $team
|
||||
* @param type Assign_team_agent $assign_team_agent
|
||||
* @return type Response
|
||||
*/
|
||||
public function index(Teams $team, Assign_team_agent $assign_team_agent) {
|
||||
try {
|
||||
$teams = $team->get();
|
||||
/* find out the Number of Members in the Team */
|
||||
$id = $teams->lists('id');
|
||||
$assign_team_agent = $assign_team_agent->get();
|
||||
//dd($id);
|
||||
// foreach($id as $i)
|
||||
// {
|
||||
// $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('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
* @param type User $user
|
||||
* @return type Response
|
||||
*/
|
||||
public function create(User $user) {
|
||||
try {
|
||||
$user = $user->get();
|
||||
return view('themes.default1.admin.agent.teams.create', compact('user'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
* @param type Teams $team
|
||||
* @param type TeamRequest $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function store(Teams $team, TeamRequest $request) {
|
||||
try {
|
||||
/* Check whether function success or not */
|
||||
if ($team->fill($request->input())->save() == true) {
|
||||
/* redirect to Index page with Success Message */
|
||||
return redirect('teams')->with('success', 'Teams Created Successfully');
|
||||
} else {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('teams')->with('fails', 'Teams can not Create');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('teams')->with('fails', 'Teams can not Create');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return Response
|
||||
*/
|
||||
public function show($id) {
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
* @param type $id
|
||||
* @param type User $user
|
||||
* @param type Assign_team_agent $assign_team_agent
|
||||
* @param type Teams $team
|
||||
* @return type Response
|
||||
*/
|
||||
public function edit($id, User $user, Assign_team_agent $assign_team_agent, Teams $team) {
|
||||
try {
|
||||
$user = $user->whereId($id)->first();
|
||||
$teams = $team->whereId($id)->first();
|
||||
//$allagents = $agent->get();
|
||||
/* Gettting member of the team */
|
||||
$agent_team = $assign_team_agent->where('team_id', $id)->get();
|
||||
//dd($agent_team);
|
||||
$agent_id = $agent_team->lists('agent_id', 'agent_id');
|
||||
// dd($agent_id);
|
||||
//$id = $agent->lists('id');
|
||||
//dd($id);
|
||||
// foreach($agent_id as $aaaaa)
|
||||
// {
|
||||
// $agent = $agent->where('id',$aaaaa)->first();
|
||||
// echo $agent;
|
||||
// //
|
||||
// }
|
||||
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 type int $id
|
||||
* @param type Teams $team
|
||||
* @param type TeamUpdate $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function update($id, Teams $team, TeamUpdate $request) {
|
||||
try {
|
||||
$teams = $team->whereId($id)->first();
|
||||
//updating check box
|
||||
$alert = $request->input('assign_alert');
|
||||
$teams->assign_alert = $alert;
|
||||
$teams->save(); //saving check box
|
||||
//updating whole field
|
||||
/* Check whether function success or not */
|
||||
if ($teams->fill($request->input())->save() == true) {
|
||||
/* redirect to Index page with Success Message */
|
||||
return redirect('teams')->with('success', 'Teams Updated Successfully');
|
||||
} else {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('teams')->with('fails', 'Teams can not Update');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('teams')->with('fails', 'Teams can not Update');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
* @param type int $id
|
||||
* @param type Teams $team
|
||||
* @param type Assign_team_agent $assign_team_agent
|
||||
* @return type Response
|
||||
*/
|
||||
public function destroy($id, Teams $team, Assign_team_agent $assign_team_agent) {
|
||||
try {
|
||||
$assign_team_agent->where('team_id', $id)->delete();
|
||||
$teams = $team->whereId($id)->first();
|
||||
/* Check whether function success or not */
|
||||
if ($teams->delete() == true) {
|
||||
/* redirect to Index page with Success Message */
|
||||
return redirect('teams')->with('success', 'Teams Deleted Successfully');
|
||||
} else {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('teams')->with('fails', 'Teams can not Delete');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('teams')->with('fails', 'Teams can not Delete');
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,184 +0,0 @@
|
||||
<?php
|
||||
namespace App\Http\Controllers\Admin;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\TemplateRequest;
|
||||
use App\Http\Requests\TemplateUdate;
|
||||
use App\Model\Email\Emails;
|
||||
use App\Model\Email\Template;
|
||||
use App\Model\Utility\Languages;
|
||||
use Illuminate\Http\Request;
|
||||
use Mail;
|
||||
|
||||
/**
|
||||
* TemplateController
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class TemplateController extends Controller {
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* @return type void
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->middleware('auth');
|
||||
$this->middleware('roles');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
* @param type Template $template
|
||||
* @return type Response
|
||||
*/
|
||||
public function index(Template $template) {
|
||||
try {
|
||||
$templates = $template->get();
|
||||
return view('themes.default1.admin.emails.template.index', compact('templates'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
* @param type Languages $language
|
||||
* @param type Template $template
|
||||
* @return type Response
|
||||
*/
|
||||
public function create(Languages $language, Template $template) {
|
||||
try {
|
||||
$templates = $template->get();
|
||||
$languages = $language->get();
|
||||
return view('themes.default1.admin.emails.template.create', compact('languages', 'templates'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
* @param type Template $template
|
||||
* @param type TemplateRequest $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function store(Template $template, TemplateRequest $request) {
|
||||
try {
|
||||
/* Check whether function success or not */
|
||||
if ($template->fill($request->input())->save() == true) {
|
||||
/* redirect to Index page with Success Message */
|
||||
return redirect('template')->with('success', 'Teams Created Successfully');
|
||||
} else {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('template')->with('fails', 'Teams can not Create');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('template')->with('fails', 'Teams can not Create');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return Response
|
||||
*/
|
||||
public function show($id) {
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
* @param type $id
|
||||
* @param type Template $template
|
||||
* @param type Languages $language
|
||||
* @return type Response
|
||||
*/
|
||||
public function edit($id, Template $template, Languages $language) {
|
||||
try {
|
||||
$templates = $template->whereId($id)->first();
|
||||
$languages = $language->get();
|
||||
return view('themes.default1.admin.emails.template.edit', compact('templates', 'languages'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
* @param type int $id
|
||||
* @param type Template $template
|
||||
* @param type TemplateUdate $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function update($id, Template $template, TemplateUdate $request) {
|
||||
try {
|
||||
//TODO validation
|
||||
$templates = $template->whereId($id)->first();
|
||||
/* Check whether function success or not */
|
||||
if ($templates->fill($request->input())->save() == true) {
|
||||
/* redirect to Index page with Success Message */
|
||||
return redirect('template')->with('success', 'Teams Updated Successfully');
|
||||
} else {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('template')->with('fails', 'Teams can not Update');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('template')->with('fails', 'Teams can not Update');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
* @param type int $id
|
||||
* @param type Template $template
|
||||
* @return type Response
|
||||
*/
|
||||
public function destroy($id, Template $template) {
|
||||
try {
|
||||
$templates = $template->whereId($id)->first();
|
||||
/* Check whether function success or not */
|
||||
if ($templates->delete() == true) {
|
||||
/* redirect to Index page with Success Message */
|
||||
return redirect('template')->with('success', 'Teams Deleted Successfully');
|
||||
} else {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('template')->with('fails', 'Teams can not Delete');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('template')->with('fails', 'Teams can not Delete');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Form for Email connection checking.
|
||||
* @param type Emails $email
|
||||
* @return type Response
|
||||
*/
|
||||
public function formDiagno(Emails $email) {
|
||||
try {
|
||||
$emails = $email->get();
|
||||
return view('themes.default1.admin.emails.template.formDiagno', compact('emails'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* function to send emails
|
||||
* @param type Request $request
|
||||
* @return type
|
||||
*/
|
||||
public function postDiagno(Request $request) {
|
||||
$email = $request->input('to');
|
||||
$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');
|
||||
}
|
||||
}
|
@@ -1,34 +0,0 @@
|
||||
<?php
|
||||
namespace App\Http\Controllers\Admin;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Model\Priority;
|
||||
use App\Model\Ticket_thread;
|
||||
|
||||
/**
|
||||
* ThreadController
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class ThreadController extends Controller {
|
||||
|
||||
/**
|
||||
* get the values from ticket_thread Table and direct to view page
|
||||
* @param type Ticket_thread $thread
|
||||
* @param type Priority $priority
|
||||
* @return type Response
|
||||
*/
|
||||
public function getTickets(Ticket_thread $thread, Priority $priority) {
|
||||
try {
|
||||
/* get the values of Ticket_thread from Ticket_thread Table */
|
||||
$threads = $thread->get();
|
||||
/* get the values of priority from Priority Table */
|
||||
$priorities = $priority->get();
|
||||
/* Direct to view page */
|
||||
return view('themes.default1.admin.tickets.ticket', compact('threads', 'priorities'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,36 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
/**
|
||||
* --------------------------------------------
|
||||
* WelcomeController
|
||||
* --------------------------------------------
|
||||
* 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.
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class WelcomeController extends Controller {
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->middleware('guest');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the application welcome screen to the user.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function index() {
|
||||
return view('welcome');
|
||||
}
|
||||
|
||||
}
|
@@ -1,413 +0,0 @@
|
||||
<?php namespace App\Http\Controllers\Agent;
|
||||
use App;
|
||||
use App\Http\Controllers\Agent\TicketController;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Model\Email\Emails;
|
||||
use App\Model\Ticket\Ticket_attachments;
|
||||
use App\Model\Ticket\Ticket_Thread;
|
||||
|
||||
/**
|
||||
* MailController
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class MailController extends Controller {
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $email = "";
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $stream = "";
|
||||
|
||||
/**
|
||||
* 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);
|
||||
foreach ($decode_header AS $obj) {
|
||||
$result .= htmlspecialchars(rtrim($obj->text, "\t"));
|
||||
}
|
||||
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) {
|
||||
/**
|
||||
* @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';
|
||||
// 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];
|
||||
|
||||
//=======================================================================
|
||||
// check user
|
||||
//=======================================================================
|
||||
// $subject = $subject;
|
||||
// $match = '/^[[A-Z]{4}-[0-9]{4}-[0-9]{7}]][A-z0-9]$/';
|
||||
// if(preg_match($match, $subject))
|
||||
// {
|
||||
// echo "success";
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// 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->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 '<img src="'.$image1.'">';
|
||||
// echo '<img src="'.$image.'">';
|
||||
// dd($structure);
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
$body2 = imap_fetchbody($stream, $email_id, 1);
|
||||
}
|
||||
$body = quoted_printable_decode($body2);
|
||||
// $body = explode("---Reply above this line---", $body);
|
||||
// echo $body;
|
||||
// echo "0";
|
||||
}
|
||||
// checking if the format is Alternative
|
||||
if ($structure->subtype == 'ALTERNATIVE') {
|
||||
if (isset($structure->parts)) {
|
||||
$body2 = imap_fetchbody($stream, $email_id, 1.2);
|
||||
if ($body2 == null) {
|
||||
$body2 = imap_fetchbody($stream, $email_id, 1);
|
||||
}
|
||||
$body = quoted_printable_decode($body2);
|
||||
// $body = explode("---Reply above this line---", $body);
|
||||
// echo $body[0];
|
||||
}
|
||||
}
|
||||
// checking if the format is related
|
||||
if ($structure->subtype == 'RELATED') {
|
||||
if (isset($structure->parts)) {
|
||||
$parts = $structure->parts;
|
||||
$i = 0;
|
||||
$body2 = imap_fetchbody($stream, $email_id, 1.2);
|
||||
if ($body2 == null) {
|
||||
$body2 = imap_fetchbody($stream, $email_id, 1);
|
||||
}
|
||||
$body = quoted_printable_decode($body2);
|
||||
foreach ($parts as $part) {
|
||||
if ($parts[$i]) {
|
||||
}
|
||||
$i++;
|
||||
if (isset($parts[$i])) {
|
||||
if ($parts[$i]->ifid == 1) {
|
||||
$id = $parts[$i]->id;
|
||||
$imageid = substr($id, 1, -1);
|
||||
$imageid = "cid:" . $imageid;
|
||||
if ($parts[$i]->ifdparameters == 1) {
|
||||
foreach ($parts[$i]->dparameters as $object) {
|
||||
if (strtolower($object->attribute) == 'filename') {
|
||||
$filename = $object->value;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($parts[$i]->ifparameters == 1) {
|
||||
foreach ($parts[$i]->parameters as $object) {
|
||||
if (strtolower($object->attribute) == 'name') {
|
||||
$name = $object->value;
|
||||
}
|
||||
}
|
||||
}
|
||||
$body = str_replace($imageid, $filename, $body);
|
||||
|
||||
// $ticket_Thread = new Ticket_attachments;
|
||||
// // $ticket_Thread->thread_id = $thread_id;
|
||||
// $ticket_Thread->name = $filename;
|
||||
// // $ticket_Thread->size = $filesize;
|
||||
// // $ticket_Thread->type = $ext;
|
||||
// $ticket_Thread->content = '<img src="'.$name.'">';
|
||||
// $ticket_Thread->save();
|
||||
// // $body = explode("---Reply above this line---", $body);
|
||||
// echo $body[0];
|
||||
// echo "2";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//checking if the format is mixed
|
||||
elseif ($structure->subtype == 'MIXED') {
|
||||
if (isset($structure->parts)) {
|
||||
$parts = $structure->parts;
|
||||
|
||||
// subtype = ALTERNATIVE
|
||||
if ($parts[0]->subtype == 'ALTERNATIVE') {
|
||||
if (isset($structure->parts)) {
|
||||
$body2 = imap_fetchbody($stream, $email_id, 1.2);
|
||||
if ($body2 == null) {
|
||||
$body2 = imap_fetchbody($stream, $email_id, 1);
|
||||
}
|
||||
$body = quoted_printable_decode($body2);
|
||||
}
|
||||
}
|
||||
// subtype = RELATED
|
||||
if ($parts[0]->subtype == 'RELATED') {
|
||||
if (isset($parts[0]->parts)) {
|
||||
$parts = $parts[0]->parts;
|
||||
$i = 0;
|
||||
|
||||
$body2 = imap_fetchbody($stream, $email_id, 1.1);
|
||||
if ($body2 == null) {
|
||||
$body2 = imap_fetchbody($stream, $email_id, 1);
|
||||
}
|
||||
$body = quoted_printable_decode($body2);
|
||||
$name = "";
|
||||
foreach ($parts as $part) {
|
||||
if ($parts[0]) {
|
||||
}
|
||||
$i++;
|
||||
if (isset($parts[$i])) {
|
||||
if ($parts[$i]->ifid == 1) {
|
||||
$id = $parts[$i]->id;
|
||||
$imageid = substr($id, 1, -1);
|
||||
$imageid = "cid:" . $imageid;
|
||||
if ($parts[$i]->ifdparameters == 1) {
|
||||
foreach ($parts[$i]->dparameters as $object) {
|
||||
if (strtolower($object->attribute) == 'filename') {
|
||||
$filename = $object->value;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($parts[$i]->ifparameters == 1) {
|
||||
foreach ($parts[$i]->parameters as $object) {
|
||||
if (strtolower($object->attribute) == 'name') {
|
||||
$name = $object->value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$body = str_replace($imageid, $name, $body);
|
||||
// $body = explode("---Reply above this line---", $body);
|
||||
// echo $body[0];
|
||||
// echo '3'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// dd($structure);
|
||||
}
|
||||
// $ticket = new Tickets;
|
||||
// $ticket->name = $from;
|
||||
// $ticket->subject = $subject;
|
||||
// $ticket->body = $body2;
|
||||
// $ticket->date = $datetime;
|
||||
// $ticket->save();
|
||||
// $ticket = new Ticket_Thread;
|
||||
// $ticket->name = $from;
|
||||
// $ticket->subject = $subject;
|
||||
// $ticket->body = $body2;
|
||||
// $ticket->date = $datetime;
|
||||
// $ticket->save();
|
||||
$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) {
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
imap_close($stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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(
|
||||
'is_attachment' => false,
|
||||
'filename' => '',
|
||||
'name' => '',
|
||||
'attachment' => '');
|
||||
// checking for files
|
||||
if ($structure->parts[$i]->ifdparameters) {
|
||||
foreach ($structure->parts[$i]->dparameters as $object) {
|
||||
if (strtolower($object->attribute) == 'filename') {
|
||||
$attachments[$i]['is_attachment'] = true;
|
||||
$attachments[$i]['filename'] = $object->value;
|
||||
}
|
||||
}
|
||||
}
|
||||
// checking for files
|
||||
if ($structure->parts[$i]->ifparameters) {
|
||||
foreach ($structure->parts[$i]->parameters as $object) {
|
||||
if (strtolower($object->attribute) == 'name') {
|
||||
$attachments[$i]['is_attachment'] = true;
|
||||
$attachments[$i]['name'] = $object->value;
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 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) {
|
||||
$attachments[$i]['attachment'] = quoted_printable_decode($attachments[$i]['attachment']);
|
||||
}
|
||||
}
|
||||
}
|
||||
// calling the save method to save each attachments
|
||||
if ($this->save_attcahments($attachments, $thread_id) == true) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
if ($at['is_attachment'] == 1) {
|
||||
$str = str_shuffle('abcdefghijjklmopqrstuvwxyz');
|
||||
$filename = $at['filename'];
|
||||
$ext = pathinfo($filename, PATHINFO_EXTENSION);
|
||||
$tmpName = $at['filename'];
|
||||
$fp = fopen($tmpName, 'r');
|
||||
$content = fread($fp, filesize($tmpName));
|
||||
$content2 = file_put_contents($at['filename'], $at['attachment']);
|
||||
$filesize = $content2;
|
||||
$ticket_Thread = new Ticket_attachments;
|
||||
$ticket_Thread->thread_id = $thread_id;
|
||||
$ticket_Thread->name = $filename;
|
||||
$ticket_Thread->size = $filesize;
|
||||
$ticket_Thread->type = $ext;
|
||||
$ticket_Thread->content = $fp;
|
||||
$ticket_Thread->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@@ -1,182 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Agent;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\OrganizationRequest;
|
||||
|
||||
/* include organization model */
|
||||
use App\Http\Requests\OrganizationUpdate;
|
||||
|
||||
/* Define OrganizationRequest to validate the create form */
|
||||
use App\Model\Agent_panel\Organization;
|
||||
|
||||
/* Define OrganizationUpdate to validate the create form */
|
||||
|
||||
/**
|
||||
* OrganizationController
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class OrganizationController extends Controller {
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* constructor to check
|
||||
* 1. authentication
|
||||
* 2. user roles
|
||||
* 3. roles must be agent
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->middleware('auth');
|
||||
$this->middleware('role.agent');
|
||||
$this->middleware('roles');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @param type Organization $org
|
||||
* @return type Response
|
||||
*/
|
||||
public function index(Organization $org) {
|
||||
try {
|
||||
/* get all values of table organization */
|
||||
$orgs = $org->get();
|
||||
return view('themes.default1.agent.organization.index', compact('orgs'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function create() {
|
||||
try {
|
||||
return view('themes.default1.agent.organization.create');
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
* @param type Organization $org
|
||||
* @param type OrganizationRequest $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function store(Organization $org, OrganizationRequest $request) {
|
||||
try {
|
||||
/* Insert the all input request to organization table */
|
||||
/* Check whether function success or not */
|
||||
|
||||
if ($org->fill($request->input())->save() == true) {
|
||||
/* redirect to Index page with Success Message */
|
||||
return redirect('organizations')->with('success', 'Organization Created Successfully');
|
||||
} else {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('organizations')->with('fails', 'Organization can not Create');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('organizations')->with('fails', 'Organization can not Create');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param type $id
|
||||
* @param type Organization $org
|
||||
* @return type Response
|
||||
*/
|
||||
public function show($id, Organization $org) {
|
||||
try {
|
||||
/* select the field by id */
|
||||
$orgs = $org->whereId($id)->first();
|
||||
/* To view page */
|
||||
return view('themes.default1.agent.organization.show', compact('orgs'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param type $id
|
||||
* @param type Organization $org
|
||||
* @return type Response
|
||||
*/
|
||||
public function edit($id, Organization $org) {
|
||||
try {
|
||||
/* select the field by id */
|
||||
$orgs = $org->whereId($id)->first();
|
||||
|
||||
/* To view page */
|
||||
return view('themes.default1.agent.organization.edit', compact('orgs'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param type $id
|
||||
* @param type Organization $org
|
||||
* @param type OrganizationUpdate $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function update($id, Organization $org, OrganizationUpdate $request) {
|
||||
try {
|
||||
/* select the field by id */
|
||||
$orgs = $org->whereId($id)->first();
|
||||
/* update the organization table */
|
||||
/* Check whether function success or not */
|
||||
if ($orgs->fill($request->input())->save() == true) {
|
||||
/* redirect to Index page with Success Message */
|
||||
return redirect('organizations')->with('success', 'Organization Updated Successfully');
|
||||
} else {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('organizations')->with('fails', 'Organization can not Update');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('organizations')->with('fails', 'Organization can not Update');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param type int $id
|
||||
* @return type Response
|
||||
*/
|
||||
public function destroy($id) {
|
||||
try {
|
||||
/* select the field by id */
|
||||
$orgs = $org->whereId($id)->first();
|
||||
/* Delete the field selected from the table */
|
||||
/* Check whether function success or not */
|
||||
if ($orgs->delete() == true) {
|
||||
/* redirect to Index page with Success Message */
|
||||
return redirect('organizations')->with('success', 'Organization Deleted Successfully');
|
||||
} else {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('organizations')->with('fails', 'Organization can not Delete');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('organizations')->with('fails', 'Organization can not Delete');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -1,578 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Agent;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\CreateTicketRequest;
|
||||
use App\Http\Requests\TicketRequest;
|
||||
use App\Model\Email\Banlist;
|
||||
use App\Model\Ticket\Tickets;
|
||||
use App\Model\Ticket\Ticket_Thread;
|
||||
use App\User;
|
||||
use Auth;
|
||||
use Hash;
|
||||
use Input;
|
||||
use Mail;
|
||||
use PDF;
|
||||
|
||||
/**
|
||||
* TicketController
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class TicketController extends Controller {
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* @return type response
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->middleware('auth');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the ticket list page
|
||||
* @return type response
|
||||
*/
|
||||
public function ticket_list() {
|
||||
return view('themes.default1.agent.ticket.ticket');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the Open ticket list page
|
||||
* @return type response
|
||||
*/
|
||||
public function open_ticket_list() {
|
||||
return view('themes.default1.agent.ticket.open');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the answered ticket list page
|
||||
* @return type response
|
||||
*/
|
||||
public function answered_ticket_list() {
|
||||
return view('themes.default1.agent.ticket.answered');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the Myticket list page
|
||||
* @return type response
|
||||
*/
|
||||
public function myticket_ticket_list() {
|
||||
return view('themes.default1.agent.ticket.myticket');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the Overdue ticket list page
|
||||
* @return type response
|
||||
*/
|
||||
public function overdue_ticket_list() {
|
||||
return view('themes.default1.agent.ticket.overdue');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the Closed ticket list page
|
||||
* @return type response
|
||||
*/
|
||||
public function closed_ticket_list() {
|
||||
return view('themes.default1.agent.ticket.closed');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the New ticket page
|
||||
* @return type response
|
||||
*/
|
||||
public function newticket() {
|
||||
return view('themes.default1.agent.ticket.new');
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the data of new ticket and show the New ticket page with result
|
||||
* @param type CreateTicketRequest $request
|
||||
* @return type response
|
||||
*/
|
||||
public function post_newticket(CreateTicketRequest $request) {
|
||||
$email = $request->input('email');
|
||||
$fullname = $request->input('fullname');
|
||||
$notice = $request->input('notice');
|
||||
$helptopic = $request->input('helptopic');
|
||||
$dept = $request->input('dept');
|
||||
$sla = $request->input('sla');
|
||||
$duedate = $request->input('duedate');
|
||||
$assignto = $request->input('assignto');
|
||||
$subject = $request->input('subject');
|
||||
$body = $request->input('body');
|
||||
$priority = $request->input('priority');
|
||||
$phone = "";
|
||||
$system = "";
|
||||
//create user
|
||||
if ($this->create_user($email, $fullname, $subject, $body, $phone, $helptopic, $sla, $priority, $system)) {
|
||||
return Redirect('newticket')->with('success', 'success');
|
||||
} else {
|
||||
return Redirect('newticket')->with('fails', 'fails');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the ticket thread details
|
||||
* @param type $id
|
||||
* @return type response
|
||||
*/
|
||||
public function thread($id) {
|
||||
$tickets = Tickets::where('id', '=', $id)->first();
|
||||
$thread = Ticket_Thread::where('ticket_id', '=', $id)->first();
|
||||
return view('themes.default1.agent.ticket.timeline', compact('tickets'), compact('thread'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Replying a ticket
|
||||
* @param type Ticket_Thread $thread
|
||||
* @param type TicketRequest $request
|
||||
* @return type bool
|
||||
*/
|
||||
public function reply(Ticket_Thread $thread, TicketRequest $request) {
|
||||
$thread->ticket_id = $request->input('ticket_ID');
|
||||
$thread->poster = 'support';
|
||||
$thread->body = $request->input('ReplyContent');
|
||||
$thread->save();
|
||||
$ticket_id = $request->input('ticket_ID');
|
||||
$tickets = Tickets::where('id', '=', $ticket_id)->first();
|
||||
$thread = Ticket_Thread::where('ticket_id', '=', $ticket_id)->first();
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ticket edit and save ticket data
|
||||
* @param type $ticket_id
|
||||
* @param type Ticket_Thread $thread
|
||||
* @return type bool
|
||||
*/
|
||||
public function ticket_edit_post($ticket_id, Ticket_Thread $thread) {
|
||||
$threads = $thread->where('ticket_id', '=', $ticket_id)->first();
|
||||
if (Input::get('subject') != null && Input::get('body') != null) {
|
||||
$threads->title = Input::get('subject');
|
||||
$threads->body = Input::get('body');
|
||||
if ($threads->save()) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Print Ticket Details
|
||||
* @param type $id
|
||||
* @return type respponse
|
||||
*/
|
||||
public function ticket_print($id) {
|
||||
$tickets = Tickets::where('id', '=', $id)->first();
|
||||
$thread = Ticket_Thread::where('ticket_id', '=', $id)->first();
|
||||
$html = view('themes.default1.agent.ticket.pdf', compact('id', 'tickets', 'thread'))->render();
|
||||
return PDF::load($html)->show();
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates Ticket Number
|
||||
* @param type $ticket_number
|
||||
* @return type integer
|
||||
*/
|
||||
public function ticket_number($ticket_number) {
|
||||
$number = $ticket_number;
|
||||
$number = explode('-', $number);
|
||||
$number1 = $number[0];
|
||||
if ($number1 == 'ZZZZ') {
|
||||
$number1 = 'AAAA';
|
||||
}
|
||||
$number2 = $number[1];
|
||||
if ($number2 == '9999') {
|
||||
$number2 = '0000';
|
||||
}
|
||||
$number3 = $number[2];
|
||||
if ($number3 == '9999999') {
|
||||
$number3 = '0000000';
|
||||
}
|
||||
$number1++;
|
||||
$number2++;
|
||||
$number3++;
|
||||
$number2 = sprintf('%04s', $number2);
|
||||
$number3 = sprintf('%07s', $number3);
|
||||
$array = array($number1, $number2, $number3);
|
||||
$number = implode('-', $array);
|
||||
return $number;
|
||||
}
|
||||
|
||||
/**
|
||||
* check email for dublicate entry
|
||||
* @param type $email
|
||||
* @return type bool
|
||||
*/
|
||||
public function check_email($email) {
|
||||
$check = User::where('email', '=', $email)->first();
|
||||
if ($check == true) {
|
||||
return $check;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create User while creating ticket
|
||||
* @param type $emailadd
|
||||
* @param type $username
|
||||
* @param type $subject
|
||||
* @param type $body
|
||||
* @param type $phone
|
||||
* @param type $helptopic
|
||||
* @param type $sla
|
||||
* @param type $priority
|
||||
* @param type $system
|
||||
* @return type bool
|
||||
*/
|
||||
public function create_user($emailadd, $username, $subject, $body, $phone, $helptopic, $sla, $priority, $system) {
|
||||
// define global variables
|
||||
$email;
|
||||
$username;
|
||||
// check emails
|
||||
$checkemail = $this->check_email($emailadd);
|
||||
|
||||
if ($checkemail == false) {
|
||||
// Generate password
|
||||
$password = $this->generateRandomString();
|
||||
// create user
|
||||
$user = new User;
|
||||
$user->user_name = $username;
|
||||
$user->email = $emailadd;
|
||||
$user->password = Hash::make($password);
|
||||
// mail user his/her password
|
||||
if ($user->save()) {
|
||||
$user_id = $user->id;
|
||||
if (Mail::send('emails.pass', ['password' => $password, 'name' => $username], function ($message) use ($emailadd, $username) {
|
||||
$message->to($emailadd, $username)->subject('password');
|
||||
})) {
|
||||
// need to do something here....
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$username = $checkemail->username;
|
||||
$user_id = $checkemail->id;
|
||||
}
|
||||
$ticket_number = $this->check_ticket($user_id, $subject, $body, $helptopic, $sla, $priority);
|
||||
// send ticket create details to user
|
||||
if (Mail::send('emails.Ticket_Create', ['name' => $username, 'ticket_number' => $ticket_number], function ($message) use ($emailadd, $username, $ticket_number) {
|
||||
$message->to($emailadd, $username)->subject('[~' . $ticket_number . ']');
|
||||
})) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Default helptopic
|
||||
* @return type string
|
||||
*/
|
||||
public function default_helptopic() {
|
||||
$helptopic = "1";
|
||||
return $helptopic;
|
||||
}
|
||||
|
||||
/**
|
||||
* Default SLA plan
|
||||
* @return type string
|
||||
*/
|
||||
public function default_sla() {
|
||||
$sla = "1";
|
||||
return $sla;
|
||||
}
|
||||
|
||||
/**
|
||||
* Default Priority
|
||||
* @return type string
|
||||
*/
|
||||
public function default_priority() {
|
||||
$priority = "1";
|
||||
return $prioirty;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the response of the ticket
|
||||
* @param type $user_id
|
||||
* @param type $subject
|
||||
* @param type $body
|
||||
* @param type $helptopic
|
||||
* @param type $sla
|
||||
* @param type $priority
|
||||
* @return type string
|
||||
*/
|
||||
public function check_ticket($user_id, $subject, $body, $helptopic, $sla, $priority) {
|
||||
$read_ticket_number = substr($subject, 0, 6);
|
||||
if ($read_ticket_number == 'Re: [~') {
|
||||
$separate = explode("]", $subject);
|
||||
$new_subject = substr($separate[0], 6, 20);
|
||||
$find_number = Tickets::where('ticket_number', '=', $new_subject)->first();
|
||||
$thread_body = explode("---Reply above this line---", $body);
|
||||
$body = $thread_body[0];
|
||||
if (count($find_number) > 0) {
|
||||
$id = $find_number->id;
|
||||
$ticket_number = $find_number->ticket_number;
|
||||
if (isset($id)) {
|
||||
if ($this->ticket_thread($subject, $body, $id, $user_id)) {
|
||||
return $ticket_number;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$ticket_number = $this->create_ticket($user_id, $subject, $body, $helptopic, $sla, $priority);
|
||||
return $ticket_number;
|
||||
}
|
||||
} else {
|
||||
$ticket_number = $this->create_ticket($user_id, $subject, $body, $helptopic, $sla, $priority);
|
||||
return $ticket_number;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create Ticket
|
||||
* @param type $user_id
|
||||
* @param type $subject
|
||||
* @param type $body
|
||||
* @param type $helptopic
|
||||
* @param type $sla
|
||||
* @param type $priority
|
||||
* @return type string
|
||||
*/
|
||||
public function create_ticket($user_id, $subject, $body, $helptopic, $sla, $priority) {
|
||||
$max_number = Tickets::whereRaw('id = (select max(`id`) from tickets)')->get();
|
||||
foreach ($max_number as $number) {
|
||||
$ticket_number = $number->ticket_number;
|
||||
}
|
||||
$ticket = new Tickets;
|
||||
$ticket->ticket_number = $this->ticket_number($ticket_number);
|
||||
$ticket->user_id = $user_id;
|
||||
$ticket->help_topic_id = $helptopic;
|
||||
$ticket->sla = $sla;
|
||||
$ticket->status = '1';
|
||||
$ticket->priority_id = $priority;
|
||||
$ticket->save();
|
||||
$ticket_number = $ticket->ticket_number;
|
||||
$id = $ticket->id;
|
||||
if ($this->ticket_thread($subject, $body, $id, $user_id) == true) {
|
||||
return $ticket_number;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate Ticket Thread
|
||||
* @param type $subject
|
||||
* @param type $body
|
||||
* @param type $id
|
||||
* @param type $user_id
|
||||
* @return type
|
||||
*/
|
||||
public function ticket_thread($subject, $body, $id, $user_id) {
|
||||
$thread = new Ticket_Thread;
|
||||
$thread->user_id = $user_id;
|
||||
$thread->ticket_id = $id;
|
||||
$thread->poster = 'client';
|
||||
$thread->title = $subject;
|
||||
$thread->body = $body;
|
||||
if ($thread->save()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a random string for password
|
||||
* @param type $length
|
||||
* @return type string
|
||||
*/
|
||||
public function generateRandomString($length = 10) {
|
||||
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
$charactersLength = strlen($characters);
|
||||
$randomString = '';
|
||||
for ($i = 0; $i < $length; $i++) {
|
||||
$randomString .= $characters[rand(0, $charactersLength - 1)];
|
||||
}
|
||||
return $randomString;
|
||||
}
|
||||
|
||||
/**
|
||||
* function to Ticket Close
|
||||
* @param type $id
|
||||
* @param type Tickets $ticket
|
||||
* @return type string
|
||||
*/
|
||||
public function close($id, Tickets $ticket) {
|
||||
$ticket_status = $ticket->where('id', '=', $id)->first();
|
||||
$ticket_status->status = 3;
|
||||
$ticket_status->save();
|
||||
return "your ticket" . $ticket_status->ticket_number . " has been closed";
|
||||
}
|
||||
|
||||
/**
|
||||
* function to Ticket resolved
|
||||
* @param type $id
|
||||
* @param type Tickets $ticket
|
||||
* @return type string
|
||||
*/
|
||||
public function resolve($id, Tickets $ticket) {
|
||||
$ticket_status = $ticket->where('id', '=', $id)->first();
|
||||
$ticket_status->status = 2;
|
||||
$ticket_status->save();
|
||||
return "your ticket" . $ticket_status->ticket_number . " has been resolved";
|
||||
}
|
||||
|
||||
/**
|
||||
* function to Open Ticket
|
||||
* @param type $id
|
||||
* @param type Tickets $ticket
|
||||
* @return type
|
||||
*/
|
||||
public function open($id, Tickets $ticket) {
|
||||
$ticket_status = $ticket->where('id', '=', $id)->first();
|
||||
$ticket_status->status = 1;
|
||||
$ticket_status->save();
|
||||
return "your ticket" . $ticket_status->ticket_number . " has been opened";
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to delete ticket
|
||||
* @param type $id
|
||||
* @param type Tickets $ticket
|
||||
* @return type string
|
||||
*/
|
||||
public function delete($id, Tickets $ticket) {
|
||||
$ticket_delete = $ticket->where('id', '=', $id)->first();
|
||||
$ticket_delete->is_deleted = 0;
|
||||
$ticket_delete->status = 5;
|
||||
$ticket_delete->save();
|
||||
return "your ticket" . $ticket_delete->ticket_number . " has been delete";
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to ban an email
|
||||
* @param type $id
|
||||
* @param type Tickets $ticket
|
||||
* @return type string
|
||||
*/
|
||||
public function ban($id, Tickets $ticket) {
|
||||
$ticket_ban = $ticket->where('id', '=', $id)->first();
|
||||
$ban_email = $ticket_ban->user_id;
|
||||
$user = User::where('id', '=', $ban_email)->first();
|
||||
$user->is_ban = 1;
|
||||
$user->save();
|
||||
$Email = $user->email;
|
||||
$ban = Banlist::where('email_address', '=', $Email)->first();
|
||||
if ($ban == null) {
|
||||
$banlist = new Banlist;
|
||||
$banlist->ban_status = 1;
|
||||
$banlist->email_address = $user->email;
|
||||
$banlist->save();
|
||||
}
|
||||
return "the user has been banned";
|
||||
}
|
||||
|
||||
/**
|
||||
* function to assign ticket
|
||||
* @param type $id
|
||||
* @return type bool
|
||||
*/
|
||||
public function assign($id) {
|
||||
$UserEmail = Input::get('user');
|
||||
// $UserEmail = 'sujitprasad12@yahoo.in';
|
||||
$user = User::where('email', '=', $UserEmail)->first();
|
||||
$user_id = $user->id;
|
||||
$ticket = Tickets::where('id', '=', $id)->first();
|
||||
$ticket->assigned_to = $user_id;
|
||||
$ticket->save();
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to post internal note
|
||||
* @param type $id
|
||||
* @return type bool
|
||||
*/
|
||||
public function InternalNote($id) {
|
||||
$InternalContent = Input::get('InternalContent');
|
||||
$thread = Ticket_Thread::where('ticket_id', '=', $id)->first();
|
||||
$NewThread = new Ticket_Thread;
|
||||
$NewThread->ticket_id = $thread->ticket_id;
|
||||
$NewThread->user_id = Auth::user()->id;
|
||||
$NewThread->thread_type = 'M';
|
||||
$NewThread->poster = Auth::user()->role;
|
||||
$NewThread->title = $thread->title;
|
||||
$NewThread->body = $InternalContent;
|
||||
$NewThread->save();
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to surrender a ticket
|
||||
* @param type $id
|
||||
* @return type bool
|
||||
*/
|
||||
public function surrender($id) {
|
||||
$ticket = Tickets::where('id', '=', $id)->first();
|
||||
$ticket->assigned_to = 0;
|
||||
$ticket->save();
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* function to search
|
||||
* @return type
|
||||
*/
|
||||
// public function search() {
|
||||
// $product = Input::get('type');
|
||||
// $word = Input::get('name_startsWith');
|
||||
|
||||
// if ($product == 'product') {
|
||||
// $starts_with = strtoupper($word);
|
||||
// $rows = DB::table('users')->select('user_name')->where('name', 'LIKE', $starts_with . '%')->get();
|
||||
// $data = array();
|
||||
// foreach ($rows as $row) {
|
||||
// array_push($data, $row->name);
|
||||
// }
|
||||
// print_r(json_encode($data));
|
||||
// }
|
||||
|
||||
// if ($product == 'product_table') {
|
||||
// $row_num = Input::get('row_num');
|
||||
// $starts_with = strtoupper($word);
|
||||
// $rows = DB::table('product')->select('name', 'description', 'cost_price')->where('name', 'LIKE', $starts_with . '%')->get();
|
||||
// $data = array();
|
||||
// foreach ($rows as $row) {
|
||||
// $name = $row->name . '|' . $row->description . '|' . $row->cost_price . '|' . $row_num;
|
||||
// array_push($data, $name);
|
||||
// }
|
||||
// print_r(json_encode($data));
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* shows trashed tickets
|
||||
* @return type response
|
||||
*/
|
||||
public function trash() {
|
||||
return view('themes.default1.agent.ticket.trash');
|
||||
}
|
||||
|
||||
/**
|
||||
* shows unassigned tickets
|
||||
* @return type
|
||||
*/
|
||||
public function unassigned() {
|
||||
return view('themes.default1.agent.ticket.unassigned');
|
||||
}
|
||||
|
||||
/**
|
||||
* shows tickets assigned to Auth::user()
|
||||
* @return type
|
||||
*/
|
||||
public function myticket() {
|
||||
return view('themes.default1.agent.ticket.myticket');
|
||||
}
|
||||
|
||||
}
|
@@ -1,263 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Agent;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
/* Include Sys_user Model */
|
||||
use App\Http\Requests\ProfilePassword;
|
||||
|
||||
/* For validation include Sys_userRequest in create */
|
||||
use App\Http\Requests\ProfileRequest;
|
||||
|
||||
/* For validation include Sys_userUpdate in update */
|
||||
use App\Http\Requests\Sys_userRequest;
|
||||
|
||||
/* include guest_note model */
|
||||
use App\Http\Requests\Sys_userUpdate;
|
||||
|
||||
/* include User Model */
|
||||
/* include Help_topic Model */
|
||||
|
||||
/* Profile validator */
|
||||
|
||||
/* Profile Password validator */
|
||||
use App\User;
|
||||
|
||||
/* include ticket_thred model */
|
||||
use Auth;
|
||||
|
||||
/* include tickets model */
|
||||
use Hash;
|
||||
|
||||
/* TicketRequest to validate the ticket response */
|
||||
|
||||
/* Validate post check ticket */
|
||||
use Input;
|
||||
|
||||
/**
|
||||
* UserController
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class UserController extends Controller {
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* constructor to check
|
||||
* 1. authentication
|
||||
* 2. user roles
|
||||
* 3. roles must be agent
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->middleware('auth');
|
||||
$this->middleware('role.agent');
|
||||
$this->middleware('roles');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
* @param type User $user
|
||||
* @return type Response
|
||||
*/
|
||||
public function index(User $user) {
|
||||
try {
|
||||
/* get all values in Sys_user */
|
||||
$users = $user->where('role', '=', 'user')->get();
|
||||
return view('themes.default1.agent.user.index', compact('users'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
* @return type Response
|
||||
*/
|
||||
public function create() {
|
||||
try {
|
||||
return view('themes.default1.agent.user.create');
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
* @param type User $user
|
||||
* @param type Sys_userRequest $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function store(User $user, Sys_userRequest $request) {
|
||||
try {
|
||||
/* insert the input request to sys_user table */
|
||||
/* Check whether function success or not */
|
||||
$user->email = $request->input('email');
|
||||
$user->user_name = $request->input('full_name');
|
||||
$user->phone_number = $request->input('phone');
|
||||
$user->role = 'user';
|
||||
if ($user->save() == true) {
|
||||
/* redirect to Index page with Success Message */
|
||||
return redirect('user')->with('success', 'User Created Successfully');
|
||||
} else {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('user')->with('fails', 'User can not Create');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('user')->with('fails', 'User can not Create');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
* @param type int $id
|
||||
* @param type User $user
|
||||
* @return type Response
|
||||
*/
|
||||
public function show($id, User $user) {
|
||||
try {
|
||||
/* select the field where id = $id(request Id) */
|
||||
$users = $user->whereId($id)->first();
|
||||
return view('themes.default1.agent.user.show', compact('users'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
* @param type int $id
|
||||
* @param type User $user
|
||||
* @return type Response
|
||||
*/
|
||||
public function edit($id, User $user) {
|
||||
try {
|
||||
/* select the field where id = $id(request Id) */
|
||||
$users = $user->whereId($id)->first();
|
||||
return view('themes.default1.agent.user.edit', compact('users'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
* @param type int $id
|
||||
* @param type User $user
|
||||
* @param type Sys_userUpdate $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function update($id, User $user, Sys_userUpdate $request) {
|
||||
try {
|
||||
/* select the field where id = $id(request Id) */
|
||||
$users = $user->whereId($id)->first();
|
||||
/* Update the value by selected field */
|
||||
/* Check whether function success or not */
|
||||
if ($users->fill($request->input())->save() == true) {
|
||||
/* redirect to Index page with Success Message */
|
||||
return redirect('user')->with('success', 'User Updated Successfully');
|
||||
} else {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('user')->with('fails', 'User can not Update');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('user')->with('fails', 'User can not Update');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
* @param type int $id
|
||||
* @param type User $user
|
||||
* @return type Response
|
||||
*/
|
||||
public function destroy($id, User $user) {
|
||||
try {
|
||||
/* select the field where id = $id(request Id) */
|
||||
$users = $user->whereId($id)->first();
|
||||
/* delete the selected field */
|
||||
/* Check whether function success or not */
|
||||
if ($users->delete() == true) {
|
||||
/* redirect to Index page with Success Message */
|
||||
return redirect('user')->with('success', 'User Deleted Successfully');
|
||||
} else {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('user')->with('fails', 'User can not Delete');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('user')->with('fails', 'User can not Delete');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get profile page
|
||||
* @return type Response
|
||||
*/
|
||||
public function getProfile() {
|
||||
$user = Auth::user();
|
||||
return view('themes.default1.agent.user.profile', compact('user'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
* @param type int $id
|
||||
* @param type ProfilePassword $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function postProfilePassword($id, ProfilePassword $request) {
|
||||
$user = Auth::user();
|
||||
//echo $user->password;
|
||||
if (Hash::check($request->input('old_password'), $user->getAuthPassword())) {
|
||||
$user->password = Hash::make($request->input('new_password'));
|
||||
$user->save();
|
||||
return redirect('guest')->with('success', 'Password Updated sucessfully');
|
||||
} else {
|
||||
return redirect('guest')->with('fails', 'Password was not Updated');
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,140 +0,0 @@
|
||||
<?php
|
||||
namespace App\Http\Controllers\Auth;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\LoginRequest;
|
||||
use App\Http\Requests\RegisterRequest;
|
||||
use App\User;
|
||||
/* include User Model */
|
||||
use Hash;
|
||||
/* Include RegisterRequest */
|
||||
use Illuminate\Contracts\Auth\Guard;
|
||||
/* Register validation */
|
||||
use Illuminate\Contracts\Auth\Registrar;
|
||||
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;
|
||||
/* Include login validator */
|
||||
use Mail;
|
||||
|
||||
/**
|
||||
* ---------------------------------------------------
|
||||
* AuthController
|
||||
* ---------------------------------------------------
|
||||
* This controller handles the registration of new users, as well as the
|
||||
* authentication of existing users. By default, this controller uses
|
||||
* a simple trait to add these behaviors. Why don't you explore it?
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class AuthController extends Controller {
|
||||
|
||||
use AuthenticatesAndRegistersUsers;
|
||||
/* to redirect after login */
|
||||
protected $redirectTo = '/';
|
||||
/* Direct After Logout */
|
||||
protected $redirectAfterLogout = '/';
|
||||
protected $loginPath = '/auth/login';
|
||||
|
||||
/**
|
||||
* Create a new authentication controller instance.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Auth\Guard $auth
|
||||
* @param \Illuminate\Contracts\Auth\Registrar $registrar
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Guard $auth, Registrar $registrar) {
|
||||
$this->auth = $auth;
|
||||
$this->registrar = $registrar;
|
||||
$this->middleware('guest', ['except' => 'getLogout']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the form for registration
|
||||
* @return type Response
|
||||
*/
|
||||
public function getRegister() {
|
||||
return view('auth.register');
|
||||
}
|
||||
|
||||
/**
|
||||
* Post registration form
|
||||
* @param type User $user
|
||||
* @param type RegisterRequest $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function postRegister(User $user, RegisterRequest $request) {
|
||||
$password = Hash::make($request->input('password'));
|
||||
$user->password = $password;
|
||||
$name = $request->input('full_name');
|
||||
$user->name = $name;
|
||||
$user->email = $request->input('email');
|
||||
// $user->first_name = $request->input('first_name');
|
||||
// $user->last_nmae = $request->input('last_nmae');
|
||||
// $user->phone_number = $request->input('phone_number');
|
||||
// $user->company = $request->input('company');
|
||||
$user->role = 'user';
|
||||
$code = str_random(60);
|
||||
$user->remember_token = $code;
|
||||
$user->save();
|
||||
// send mail for successful registration
|
||||
$mail = Mail::send('auth.activate', array('link' => url('getmail', $code), 'username' => $name), function ($message) use ($user) {
|
||||
$message->to($user->email, $user->full_name)->subject('active your account');
|
||||
});
|
||||
return redirect('guest')->with('success', 'Activate Your Account ! Click on Link that send to your mail');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get mail function
|
||||
* @param type $token
|
||||
* @param type User $user
|
||||
* @return type Response
|
||||
*/
|
||||
public function getMail($token, User $user) {
|
||||
$user = $user->where('remember_token', $token)->where('active', 0)->first();
|
||||
if ($user) {
|
||||
$user->active = 1;
|
||||
$user->save();
|
||||
return redirect('auth/login');
|
||||
} else {
|
||||
return redirect('auth/login');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get login page
|
||||
* @return type Response
|
||||
*/
|
||||
public function getLogin() {
|
||||
return view('auth.login');
|
||||
}
|
||||
|
||||
/**
|
||||
* Post of login page
|
||||
* @param type LoginRequest $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function postLogin(LoginRequest $request) {
|
||||
// $email = $request->input('email');
|
||||
// $password = Hash::make($request->input('password'));
|
||||
// $remember = $request->input('remember');
|
||||
// dd([$email,$password,$remember]);
|
||||
$credentials = $request->only('email', 'password');
|
||||
if ($this->auth->attempt($credentials, $request->has('remember'))) {
|
||||
return redirect()->intended($this->redirectPath());
|
||||
}
|
||||
return redirect($this->loginPath())
|
||||
->withInput($request->only('email', 'remember'))
|
||||
->withErrors([
|
||||
'email' => $this->getFailedLoginMessage(),
|
||||
'password' => $this->getFailedLoginMessage(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Failed login message
|
||||
* @return type string
|
||||
*/
|
||||
protected function getFailedLoginMessage() {
|
||||
return 'This Field do not match our records.';
|
||||
}
|
||||
}\
|
@@ -1,33 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Contracts\Auth\Guard;
|
||||
use Illuminate\Contracts\Auth\PasswordBroker;
|
||||
use Illuminate\Foundation\Auth\ResetsPasswords;
|
||||
|
||||
/**
|
||||
* PasswordController
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class PasswordController extends Controller {
|
||||
|
||||
use ResetsPasswords;
|
||||
|
||||
/**
|
||||
* Create a new password controller instance.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Auth\Guard $auth
|
||||
* @param \Illuminate\Contracts\Auth\PasswordBroker $passwords
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Guard $auth, PasswordBroker $passwords) {
|
||||
$this->auth = $auth;
|
||||
$this->passwords = $passwords;
|
||||
$this->middleware('guest');
|
||||
}
|
||||
}
|
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Requests;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Model\Agent\Teams;
|
||||
use App\Model\Agent\Assign_team_agent;
|
||||
use DB;
|
||||
|
||||
class CheckController extends Controller {
|
||||
|
||||
public function getcheck(Teams $team, Assign_team_agent $team_assign_agent) {
|
||||
$table = $team_assign_agent->where('agent_id', 1)->first();
|
||||
$teams = $team->lists('id', 'name');
|
||||
|
||||
$assign = $team_assign_agent->where('agent_id', 1)->lists('team_id');
|
||||
|
||||
|
||||
return view('themes.check', compact('teams', 'assign', 'table'));
|
||||
}
|
||||
|
||||
public function postcheck($id, Assign_team_agent $team_assign_agent, Request $request) {
|
||||
$table = $team_assign_agent->where('agent_id', 1);
|
||||
$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]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Foundation\Bus\DispatchesCommands;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
|
||||
abstract class Controller extends BaseController {
|
||||
|
||||
use DispatchesCommands,
|
||||
ValidatesRequests;
|
||||
}
|
@@ -1,22 +0,0 @@
|
||||
<?php
|
||||
namespace App\Http\Controllers\Error;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
/**
|
||||
* ErrorController
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class ErrorController extends Controller {
|
||||
|
||||
/**
|
||||
* Display a Error Page of 404.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function error404() {
|
||||
return view('404');
|
||||
}
|
||||
}
|
@@ -1,102 +0,0 @@
|
||||
<?php
|
||||
namespace App\Http\Controllers\Guest;
|
||||
use App\Http\Controllers\Controller;
|
||||
/* include help topic model */
|
||||
use App\Model\Form\Form_details;
|
||||
/* Include form_name model */
|
||||
use App\Model\Form\Form_name;
|
||||
/* include form_detals model */
|
||||
/* Include form_value model */
|
||||
use App\Model\Manage\Help_topic;
|
||||
use App\User;
|
||||
use Form;
|
||||
use Illuminate\Http\Request;
|
||||
/* Validate form TicketForm using */
|
||||
use Input;
|
||||
|
||||
/**
|
||||
* FormController
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class FormController extends Controller {
|
||||
|
||||
/**
|
||||
* This Function to get the form for the ticket
|
||||
* @param type Form_name $name
|
||||
* @param type Form_details $details
|
||||
* @param type Help_topic $topics
|
||||
* @return type Response
|
||||
*/
|
||||
public function getForm(Form_name $name, Form_details $details, Help_topic $topics) {
|
||||
// name of the form where status==1
|
||||
$name = $name->where('status', 1)->get();
|
||||
//get label and the type from form_detail table where form_name_id of form_detail
|
||||
// equal to form_name table's id
|
||||
$ids = $name->where('id', 2);
|
||||
foreach ($ids as $i) {
|
||||
$id = $i->id;
|
||||
}
|
||||
//get form_name_id from form_detail and save to detail_form_name_id
|
||||
$detail_form_name_id = $details->where('form_name_id', $id)->get();
|
||||
$count = count($detail_form_name_id);
|
||||
// foreach($detail_form_name_id as $details)
|
||||
// {
|
||||
// echo $details->label;
|
||||
// }
|
||||
return view('themes.default1.client.guest-user.form', compact('name', 'detail_form_name_id', 'topics'));
|
||||
}
|
||||
|
||||
/**
|
||||
* This Function to post the form for the ticket
|
||||
* @param type Form_name $name
|
||||
* @param type Form_details $details
|
||||
* @return type string
|
||||
*/
|
||||
public function postForm(Form_name $name, Form_details $details) {
|
||||
$name = $name->where('status', 1)->get();
|
||||
$ids = $name->where('id', 2);
|
||||
foreach ($ids as $i) {
|
||||
$id = $i->id;
|
||||
//echo $id;
|
||||
}
|
||||
$field = $details->where('form_name_id', $id)->get();
|
||||
$var = " ";
|
||||
foreach ($field as $key) {
|
||||
$type = $key->type;
|
||||
$label = $key->label;
|
||||
$var .= "," . $type . "-" . $label;
|
||||
}
|
||||
return $var;
|
||||
// foreach($outs as $out)
|
||||
// {
|
||||
// return $out;
|
||||
// }
|
||||
// $var=" ";
|
||||
// foreach ($field as $key) {
|
||||
// $field=$key->field_name;
|
||||
// $id=$key->form_id;
|
||||
// $var.=",".$field;
|
||||
// }
|
||||
// return $var;
|
||||
// // $var=$field.$id;
|
||||
// // return
|
||||
// // return Response::json(array(
|
||||
// // 'field' => $field,
|
||||
// // 'id' => $id
|
||||
// // ));
|
||||
}
|
||||
|
||||
/**
|
||||
* Posted form
|
||||
* @param type Request $request
|
||||
* @param type User $user
|
||||
*/
|
||||
public function postedForm(Request $request, User $user) {
|
||||
$user->name = $request->input('Name');
|
||||
$user->email = $request->input('Email');
|
||||
$user->save();
|
||||
}
|
||||
}
|
@@ -1,210 +0,0 @@
|
||||
<?php
|
||||
namespace App\Http\Controllers\Guest;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\CheckTicket;
|
||||
use App\Http\Requests\ProfilePassword;
|
||||
use App\Http\Requests\ProfileRequest;
|
||||
use App\Http\Requests\TicketRequest;
|
||||
use App\Model\Manage\Help_topic;
|
||||
use App\Model\Ticket\Tickets;
|
||||
use App\Model\Ticket\Ticket_Thread;
|
||||
use App\User;
|
||||
use Auth;
|
||||
use Hash;
|
||||
use Input;
|
||||
|
||||
/**
|
||||
* GuestController
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class GuestController extends Controller {
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* @return type void
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->middleware('auth');
|
||||
$this->middleware('role.user');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get profile
|
||||
* @return type Response
|
||||
*/
|
||||
public function getProfile() {
|
||||
$user = Auth::user();
|
||||
return view('themes.default1.client.guest-user.profile', compact('user'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Save profile data
|
||||
* @param type $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');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Ticket page
|
||||
* @param type Help_topic $topic
|
||||
* @return type Response
|
||||
*/
|
||||
public function getTicket(Help_topic $topic) {
|
||||
$topics = $topic->get();
|
||||
return view('themes.default1.client.guest-user.form', compact('topics'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get my ticket
|
||||
* @param type Tickets $tickets
|
||||
* @param type Ticket_Thread $thread
|
||||
* @param type User $user
|
||||
* @return type Response
|
||||
*/
|
||||
public function getMyticket(Tickets $tickets, Ticket_Thread $thread, User $user) {
|
||||
$id = Auth::user()->id;
|
||||
/* Get the user where id == $id */
|
||||
$user = $user->whereId($id)->first();
|
||||
/* Get the all tickets which belongs to the current user */
|
||||
$tickets = $tickets->where('user_id', $user->id)->get();
|
||||
//dd($tickets);
|
||||
/* get the ticket's id == ticket_id of thread */
|
||||
$ticket = $tickets->where('user_id', $user->id)->first();
|
||||
/* get the thread of the selected ticket */
|
||||
$thread = $thread->where('ticket_id', $ticket->id)->first();
|
||||
return view('themes.default1.agent.ticket.ticket', compact('thread', 'tickets'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get ticket-thread
|
||||
* @param type Ticket_Thread $thread
|
||||
* @param type Tickets $tickets
|
||||
* @param type User $user
|
||||
* @return type Response
|
||||
*/
|
||||
public function thread(Ticket_Thread $thread, Tickets $tickets, User $user) {
|
||||
$user_id = Auth::user()->id;
|
||||
//dd($user_id);
|
||||
/* get the ticket's id == ticket_id of thread */
|
||||
$tickets = $tickets->where('user_id', '=', $user_id)->first();
|
||||
//dd($ticket);
|
||||
$thread = $thread->where('ticket_id', $tickets->id)->first();
|
||||
//dd($thread);
|
||||
// $tickets = $tickets->whereId($id)->first();
|
||||
return view('themes.default1.agent.ticket.timeline', compact('thread', 'tickets'));
|
||||
}
|
||||
|
||||
/**
|
||||
* ticket Edit
|
||||
* @return
|
||||
*/
|
||||
public function ticketEdit() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Post porfile password
|
||||
* @param type $id
|
||||
* @param type ProfilePassword $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function postProfilePassword($id, ProfilePassword $request) {
|
||||
$user = Auth::user();
|
||||
//echo $user->password;
|
||||
if (Hash::check($request->input('old_password'), $user->getAuthPassword())) {
|
||||
$user->password = Hash::make($request->input('new_password'));
|
||||
$user->save();
|
||||
return redirect('guest')->with('success', 'Password Updated sucessfully');
|
||||
} else {
|
||||
return redirect('guest')->with('fails', 'Password was not Updated');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ticekt reply
|
||||
* @param type Ticket_Thread $thread
|
||||
* @param type TicketRequest $request
|
||||
* @return type Response
|
||||
*/
|
||||
public function reply(Ticket_Thread $thread, TicketRequest $request) {
|
||||
$thread->ticket_id = $request->input('ticket_ID');
|
||||
$thread->title = $request->input('To');
|
||||
$thread->user_id = Auth::user()->id;
|
||||
$thread->body = $request->input('ReplyContent');
|
||||
$thread->poster = 'user';
|
||||
$thread->save();
|
||||
$ticket_id = $request->input('ticket_ID');
|
||||
$tickets = Tickets::where('id', '=', $ticket_id)->first();
|
||||
$thread = Ticket_Thread::where('ticket_id', '=', $ticket_id)->first();
|
||||
// return 'success';
|
||||
return Redirect("thread/" . $ticket_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Checked ticket
|
||||
* @param type Tickets $ticket
|
||||
* @param type User $user
|
||||
* @return type response
|
||||
*/
|
||||
public function getCheckTicket(Tickets $ticket, User $user) {
|
||||
return view('themes.default1.client.guest-user.newticket', compact('ticket'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Post Check ticket
|
||||
* @param type CheckTicket $request
|
||||
* @param type User $user
|
||||
* @param type Tickets $ticket
|
||||
* @param type Ticket_Thread $thread
|
||||
* @return type Response
|
||||
*/
|
||||
public function PostCheckTicket(CheckTicket $request, User $user, Tickets $ticket, Ticket_Thread $thread) {
|
||||
try {
|
||||
$user = $user->where('email', $request->input('email'))->first();
|
||||
$tickets = $ticket->where('ticket_number', $request->input('ticket_number'))->first();
|
||||
if ($user && $tickets) {
|
||||
//$user = $user->where('email',$request->input('email'))->first();
|
||||
$user_id = $user->id;
|
||||
//$ticket = $ticket->where('user_id',$user_id)->first();
|
||||
//$ticket_number = $ticket->ticket_number;
|
||||
$thread = $thread->where('user_id', $user_id)->first();
|
||||
return view('themes.default1.client.guest-user.checkticket', compact('user', 'tickets', 'thread'));
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
return redirect('checkticket')->with('fails', 'Enter valid Inputs');
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,28 +0,0 @@
|
||||
<?php
|
||||
namespace App\Http\Controllers\Guest;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Model\Settings\System;
|
||||
|
||||
/**
|
||||
* OuthouseController
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class OuthouseController extends Controller {
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function get(System $note) {
|
||||
$notes = $note->get();
|
||||
foreach ($notes as $note) {
|
||||
$content = $note->content;
|
||||
}
|
||||
return view('themes.default1.client.guest-user.guest', compact('heading', 'content'));
|
||||
}
|
||||
|
||||
}
|
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
class HomeController extends Controller {
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Home Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller renders your application's "dashboard" for users that
|
||||
| are authenticated. Of course, you are free to change or remove the
|
||||
| controller as you wish. It is just here to get your app started!
|
||||
|
|
||||
*/
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->middleware('auth');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the application dashboard to the user.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function index() {
|
||||
return view('themes/default1/admin/dashboard');
|
||||
}
|
||||
|
||||
}
|
@@ -1,392 +0,0 @@
|
||||
<?php
|
||||
namespace App\Http\Controllers\Installer;
|
||||
|
||||
// /**
|
||||
// * |=======================================================================
|
||||
// * |Class: InstallController
|
||||
// * |=======================================================================
|
||||
// *
|
||||
// * Class to perform the first install operation without this the database
|
||||
// * settings could not be started
|
||||
// *
|
||||
// * @package epaper-pdf
|
||||
// * @subpackage Controller
|
||||
// * @author Ladybird <info@ladybirdweb.com>
|
||||
// *
|
||||
// */
|
||||
class InstallController extends Controller {
|
||||
|
||||
// /**
|
||||
// * Get Licence (step 1)
|
||||
// *
|
||||
// * validating licence agreement
|
||||
// */
|
||||
// public function licence(){
|
||||
// if(Config::get('database.install')=='%0%')
|
||||
// {
|
||||
// return View::make('themes/ep-install/default1/display/view1');
|
||||
// }
|
||||
// else{
|
||||
// return Redirect::route('account-sign-In');
|
||||
// }
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Post Licencecheck
|
||||
// *
|
||||
// * Validating licence agreement
|
||||
// */
|
||||
// public function licencecheck() {
|
||||
// $accept = (Input::has('accept1')) ? true : false;
|
||||
// if ($accept == 'accept') {
|
||||
// Session::put('step1','step1');
|
||||
// return Redirect::route('prerequisites');
|
||||
// } else {
|
||||
// return Redirect::route('licence')->with('fails', 'Failed! first accept the licence agreeement');
|
||||
// }
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Get prerequisites (step 2)
|
||||
// *
|
||||
// * Checking the extensions enabled required for installing the e-paper pdf
|
||||
// * without which the project cannot be executed properly
|
||||
// *
|
||||
// */
|
||||
// public function prerequisites() {
|
||||
// if(Config::get('database.install')=='%0%')
|
||||
// {
|
||||
// if(Session::get('step1')=='step1'){
|
||||
// return View::make('themes/ep-install/default1/display/view2');
|
||||
// } else {
|
||||
// return Redirect::route('licence');
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// return Redirect::route('account-sign-In');
|
||||
// }
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Post Prerequisitescheck
|
||||
// *
|
||||
// * checking prerequisites
|
||||
// */
|
||||
// public function prerequisitescheck() {
|
||||
// Session::put('step2','step2');
|
||||
// return Redirect::route('localization');
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Get Localization (step 3)
|
||||
// *
|
||||
// * Requesting user recomended settings for installation
|
||||
// */
|
||||
// public function localization() {
|
||||
// if(Config::get('database.install')=='%0%')
|
||||
// {
|
||||
// if(Session::get('step2')=='step2'){
|
||||
// return View::make('themes/ep-install/default1/display/view3');
|
||||
// } else {
|
||||
// return Redirect::route('prerequisites');
|
||||
// }
|
||||
// }
|
||||
// else{
|
||||
// return Redirect::route('account-sign-In');
|
||||
// }
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Post localizationcheck
|
||||
// *
|
||||
// * checking prerequisites
|
||||
// */
|
||||
// public function localizationcheck() {
|
||||
|
||||
// Session::put('step3','step3');
|
||||
|
||||
// Session::put('language', Input::get('language'));
|
||||
// Session::put('timezone', Input::get('timezone'));
|
||||
// Session::put('date', Input::get('date'));
|
||||
// Session::put('datetime', Input::get('datetime'));
|
||||
|
||||
// return Redirect::route('configuration');
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Get Configuration (step 4)
|
||||
// *
|
||||
// * checking prerequisites
|
||||
// */
|
||||
// public function configuration() {
|
||||
// if(Config::get('database.install')=='%0%')
|
||||
// {
|
||||
// if(Session::get('step3')=='step3'){
|
||||
// return View::make('themes/ep-install/default1/display/view4');
|
||||
// } else {
|
||||
// return Redirect::route('localization');
|
||||
// }
|
||||
// }
|
||||
// else{
|
||||
// return Redirect::route('account-sign-In');
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Post configurationcheck
|
||||
// *
|
||||
// * checking prerequisites
|
||||
// */
|
||||
// public function configurationcheck() {
|
||||
|
||||
// Session::put('step4','step4');
|
||||
|
||||
// Session::put('default', Input::get('default'));
|
||||
// Session::put('host', Input::get('host'));
|
||||
// Session::put('databasename', Input::get('databasename'));
|
||||
// Session::put('username', Input::get('username'));
|
||||
// Session::put('password', Input::get('password'));
|
||||
|
||||
// return Redirect::route('database');
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Get database
|
||||
// *
|
||||
// * checking prerequisites
|
||||
// */
|
||||
// public function database() {
|
||||
// if(Config::get('database.install')=='%0%')
|
||||
// {
|
||||
// if(Session::get('step4')=='step4'){
|
||||
// return View::make('themes/ep-install/default1/display/view5');
|
||||
// } else {
|
||||
// return Redirect::route('configuration');
|
||||
// }
|
||||
// }
|
||||
// else{
|
||||
// return Redirect::route('account-sign-In');
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Get account
|
||||
// *
|
||||
// * checking prerequisites
|
||||
// */
|
||||
// public function account() {
|
||||
// if(Config::get('database.install')=='%0%')
|
||||
// {
|
||||
// if(Session::get('step4')=='step4'){
|
||||
// return View::make('themes/ep-install/default1/display/view6');
|
||||
// } else {
|
||||
// return Redirect::route('configuration');
|
||||
// }
|
||||
// }
|
||||
// else{
|
||||
// return Redirect::route('account-sign-In');
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Post accountcheck
|
||||
// *
|
||||
// * checking prerequisites
|
||||
// */
|
||||
// public function accountcheck() {
|
||||
// // validation check
|
||||
// $validator = Validator::make(Input::all(), array(
|
||||
// 'firstname' => 'required|max:20',
|
||||
// 'Lastname' => 'required|max:20',
|
||||
// 'email' => 'required|max:50|email',
|
||||
// 'username' => 'required|max:50|min:3',
|
||||
// 'password' => 'required|min:6',
|
||||
// 'confirmpassword' => 'required|same:password'
|
||||
// ));
|
||||
// if ($validator->fails()) {
|
||||
// return Redirect::route('account')
|
||||
// ->withErrors($validator);
|
||||
// } else {
|
||||
|
||||
// // config/database.php management
|
||||
// $default = Input::get('default');
|
||||
// $host = Input::get('host');
|
||||
// $database = Input::get('databasename');
|
||||
// $dbusername = Input::get('dbusername');
|
||||
// $dbpassword = Input::get('dbpassword');
|
||||
|
||||
// // set default value
|
||||
// $path0 = app_path('config/database.php');
|
||||
// $content0 = File::get($path0);
|
||||
// $content0 = str_replace('%default%', $default, $content0);
|
||||
// File::put($path0, $content0);
|
||||
|
||||
// // set host,databasename,username,password
|
||||
// if($default=='mysql')
|
||||
// {
|
||||
// $path = app_path('config/database.php');
|
||||
// $content = File::get($path);
|
||||
// $content = str_replace('%host%', $host, $content);
|
||||
// File::put($path, $content);
|
||||
|
||||
// $path1 = app_path('config/database.php');
|
||||
// $content1 = File::get($path1);
|
||||
// $content1 = str_replace('%database%', $database, $content1);
|
||||
// File::put($path1, $content1);
|
||||
|
||||
// $path2 = app_path('config/database.php');
|
||||
// $content2 = File::get($path2);
|
||||
// $content2 = str_replace('%username%', $dbusername, $content2);
|
||||
// File::put($path2, $content2);
|
||||
|
||||
// $path3 = app_path('config/database.php');
|
||||
// $content3 = File::get($path3);
|
||||
// $content3 = str_replace('%password%', $dbpassword, $content3);
|
||||
// File::put($path3, $content3);
|
||||
// }
|
||||
// elseif($default=='pgsql')
|
||||
// {
|
||||
// $path = app_path('config/database.php');
|
||||
// $content = File::get($path);
|
||||
// $content = str_replace('%host1%', $host, $content);
|
||||
// File::put($path, $content);
|
||||
|
||||
// $path1 = app_path('config/database.php');
|
||||
// $content1 = File::get($path1);
|
||||
// $content1 = str_replace('%database1%', $database, $content1);
|
||||
// File::put($path1, $content1);
|
||||
|
||||
// $path2 = app_path('config/database.php');
|
||||
// $content2 = File::get($path2);
|
||||
// $content2 = str_replace('%username1%', $username, $content2);
|
||||
// File::put($path2, $content2);
|
||||
|
||||
// $path3 = app_path('config/database.php');
|
||||
// $content3 = File::get($path3);
|
||||
// $content3 = str_replace('%password1%', $password, $content3);
|
||||
// File::put($path3, $content3);
|
||||
// }
|
||||
// elseif($default=='sqlsrv')
|
||||
// {
|
||||
// $path = app_path('config/database.php');
|
||||
// $content = File::get($path);
|
||||
// $content = str_replace('%host2%', $host, $content);
|
||||
// File::put($path, $content);
|
||||
|
||||
// $path1 = app_path('config/database.php');
|
||||
// $content1 = File::get($path1);
|
||||
// $content1 = str_replace('%database2%', $database, $content1);
|
||||
// File::put($path1, $content1);
|
||||
|
||||
// $path2 = app_path('config/database.php');
|
||||
// $content2 = File::get($path2);
|
||||
// $content2 = str_replace('%username2%', $username, $content2);
|
||||
// File::put($path2, $content2);
|
||||
|
||||
// $path3 = app_path('config/database.php');
|
||||
// $content3 = File::get($path3);
|
||||
// $content3 = str_replace('%password2%', $password, $content3);
|
||||
// File::put($path3, $content3);
|
||||
// }
|
||||
|
||||
// // migrate database
|
||||
// Artisan::call('migrate', array('--force' => true));
|
||||
// Artisan::call('db:seed', array('--force' => true));
|
||||
|
||||
// // create user
|
||||
// $firstname = Input::get('firstname');
|
||||
// $lastname = Input::get('lastname');
|
||||
// $email = Input::get('email');
|
||||
// $username = Input::get('username');
|
||||
// $password = Input::get('password');
|
||||
|
||||
// $language = Input::get('language');
|
||||
// $timezone = Input::get('timezone');
|
||||
// $date = Input::get('date');
|
||||
// $datetime = Input::get('datetime');
|
||||
|
||||
// $user = User::create(array(
|
||||
// 'firstname' => $firstname,
|
||||
// 'lastname' => $lastname,
|
||||
// 'email' => $email,
|
||||
// 'username' => $username,
|
||||
// 'password' => Hash::make($password),
|
||||
// 'authority' => 'admin',
|
||||
// 'active' => 1
|
||||
// ));
|
||||
|
||||
// // set option values
|
||||
// $dateformat = Option::where('option_name','=','date_format')->first();
|
||||
// $dateformat->option_value = $date;
|
||||
// $dateformat->save();
|
||||
|
||||
// $datetimeformat = Option::where('option_name','=','date_time_format')->first();
|
||||
// $datetimeformat->option_value = $datetime;
|
||||
// $datetimeformat->save();
|
||||
|
||||
// $timezonestring = Option::where('option_name','=','timezone_string')->first();
|
||||
// $timezonestring->option_value = $timezone;
|
||||
// $timezonestring->save();
|
||||
|
||||
// $language1 = Option::where('option_name','=','language')->first();
|
||||
// $language1->option_value = $language;
|
||||
// $language1->save();
|
||||
|
||||
// if ($user) {
|
||||
|
||||
// Session::put('step6','step6');
|
||||
|
||||
// return Redirect::route('final');
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Get finalize
|
||||
// *
|
||||
// * checking prerequisites
|
||||
// */
|
||||
// public function finalize() {
|
||||
// if(Session::get('step6')=='step6'){
|
||||
|
||||
// $var = "http://".$_SERVER['HTTP_HOST']."/epeper-pdf";
|
||||
|
||||
// $siteurl = Option::where('option_name','=','siteurl')->first();
|
||||
// $siteurl->option_value = $var ;
|
||||
// $siteurl->save();
|
||||
|
||||
// $value='1';
|
||||
// $install = app_path('config/database.php');
|
||||
// $datacontent = File::get($install);
|
||||
// $datacontent = str_replace('%0%', $value, $datacontent);
|
||||
// File::put($install, $datacontent);
|
||||
// try {
|
||||
// return View::make('themes/ep-install/default1/display/view7');
|
||||
// } catch (Exception $e) {
|
||||
// return Redirect::route('npl');
|
||||
// }
|
||||
// } else {
|
||||
// return Redirect::route('account');
|
||||
// }
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Post finalcheck
|
||||
// *
|
||||
// * checking prerequisites
|
||||
// */
|
||||
// public function finalcheck() {
|
||||
// try
|
||||
// {
|
||||
// return Redirect::route('account-sign-In');
|
||||
// }
|
||||
// catch (Exception $e) {
|
||||
// return Redirect::Route('account-sign-out');
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
Reference in New Issue
Block a user