Initial code of commit

This commit is contained in:
sujitprasad
2015-05-01 13:33:56 +05:30
parent 16ea6e1984
commit ef834c58dc
1332 changed files with 141189 additions and 0 deletions

18
code/.env.example Normal file
View File

@@ -0,0 +1,18 @@
APP_ENV=local
APP_DEBUG=true
APP_KEY=SomeRandomString
DB_HOST=localhost
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync
MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null

3
code/.gitattributes vendored Normal file
View File

@@ -0,0 +1,3 @@
* text=auto
*.css linguist-vendored
*.less linguist-vendored

3
code/.gitignore vendored Normal file
View File

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

View File

@@ -0,0 +1,7 @@
<?php namespace App\Commands;
abstract class Command {
//
}

View File

@@ -0,0 +1,32 @@
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Foundation\Inspiring;
class Inspire extends Command {
/**
* The console command name.
*
* @var string
*/
protected $name = 'inspire';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Display an inspiring quote';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$this->comment(PHP_EOL.Inspiring::quote().PHP_EOL);
}
}

View File

@@ -0,0 +1,29 @@
<?php namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel {
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
'App\Console\Commands\Inspire',
];
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
$schedule->command('inspire')
->hourly();
}
}

View File

@@ -0,0 +1,7 @@
<?php namespace App\Events;
abstract class Event {
//
}

View File

@@ -0,0 +1,50 @@
<?php namespace App\Exceptions;
use Exception;
// use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Bugsnag\BugsnagLaravel\BugsnagExceptionHandler as ExceptionHandler;
class Handler extends ExceptionHandler {
/**
* A list of the exception types that should not be reported.
*
* @var array
*/
protected $dontReport = [
'Symfony\Component\HttpKernel\Exception\HttpException',
];
/**
* Report or log an exception.
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @param \Exception $e
* @return void
*/
public function report(Exception $e) {
return parent::report($e);
}
/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $e
* @return \Illuminate\Http\Response
*/
public function render($request, Exception $e) {
if ($e instanceof \Symfony\Component\HttpKernel\Exception\HttpException) {
return redirect('404');
} elseif ($e instanceof \Illuminate\View\Engines\handleViewException) {
return redirect('404');
} elseif ($e instanceof \Illuminate\Database\QueryException) {
return redirect('404');
} elseif ($e) {
return redirect('404');
}
return parent::render($request, $e);
}
}

View File

View File

@@ -0,0 +1,270 @@
<?php namespace App\Http\Controllers\Admin;
//use App\Http\Requests\AgentRequest;
use App\Http\Controllers\Controller;
use App\Http\Requests\AgentRequest;
/* include update request for update validation */
use App\Http\Requests\AgentUpdate;
use Illuminate\Http\Request;
use App\Model\Agent\Agents;
use App\Model\Utility\Timezones;
use App\Model\Agent\Groups;
use App\Model\Agent\Department;
use App\Model\Agent\Teams;
use App\Model\Agent\Assign_team_agent;
use DB;
use App\User;
use Auth;
class AgentController extends Controller {
/**
* Display a listing of the resource.
*
* @return Response
*/
public function __construct()
{
$this->middleware('auth');
$this->middleware('roles');
}
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.
*
* @return 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.
*
* @return 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 int $id
* @return 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 int $id
* @return 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 int $id
* @return 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');
}
}
}

View File

@@ -0,0 +1,191 @@
<?php namespace App\Http\Controllers\Admin;
use App\Http\Requests\BanRequest;
use App\Http\Controllers\Controller;
/* include banlist Request for update function validation */
use App\Http\Requests\BanlistRequest;
use Illuminate\Http\Request;
use App\Model\Email\Banlist;
use App\User;
class BanlistController extends Controller {
/* constructor for authentication */
public function __construct()
{
$this->middleware('auth');
$this->middleware('roles');
}
/**
* Display a listing of the resource.
*
* @return 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 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.
*
* @return 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 int $id
* @return 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 int $id
* @return 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 int $id
* @return 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');
}
}
}

View File

@@ -0,0 +1,11 @@
<?php namespace App\Http\Controllers\Admin;
use Illuminate\Foundation\Bus\DispatchesCommands;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
abstract class Controller extends BaseController {
use DispatchesCommands, ValidatesRequests;
}

View File

@@ -0,0 +1,230 @@
<?php namespace App\Http\Controllers\Admin;
use App\Http\Requests\DepartmentRequest;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
/* include DepartmentUpdate Request for validation */
use App\Http\Requests\DepartmentUpdate;
use App\Model\Manage\Sla_plan;
use App\Model\Agent\Agents;
use App\Model\Email\Emails;
use App\Model\Agent\Groups;
use App\Model\Agent\Department;
use App\Model\Email\Template;
/* Include Teams model */
use App\Model\Agent\Teams;
/* Use Group_assign_department */
use App\Model\Agent\Group_assign_department;
use DB;
use App\User;
class DepartmentController extends Controller {
/**
* Display a listing of the resource.
*
* @return Response
*/
public function __construct()
{
$this->middleware('auth');
$this->middleware('roles');
}
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.
*
* @return 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.
*
* @return 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 int $id
* @return 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 int $id
* @return 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 int $id
* @return 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');
}
}
}

View File

@@ -0,0 +1,181 @@
<?php namespace App\Http\Controllers\Admin;
use App\Http\Requests\EmailsRequest;
use App\Http\Requests\EmailsEditRequest;
use App\Http\Controllers\Controller;
/* Include Priority Model */
use App\Model\Utility\Priority;
/* Include Mailbox Protocol */
use App\Model\Utility\MailboxProtocol;
use Illuminate\Http\Request;
use App\Model\Email\Emails;
use App\Model\Manage\Help_topic;
use App\Model\Agent\Department;
use Crypt;
class EmailsController extends Controller {
/* constructor for authentication */
public function __construct()
{
$this->middleware('auth');
$this->middleware('roles');
}
/**
* Display a listing of the resource.
*
* @return 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.
*
* @return 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.
*
* @return 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 int $id
* @return 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 int $id
* @return 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 int $id
* @return 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 ');
}
}
}

View File

@@ -0,0 +1,198 @@
<?php namespace App\Http\Controllers\Admin;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
/* Include Forms Model */
use App\Model\Manage\Forms;
/* Include Form_visibility model */
use App\Model\Utility\Form_visibility;
/* Include Form_type model */
use App\Model\Utility\Form_type;
/* Include FormRequest for validation */
use App\Http\Requests\FormRequest;
class FormController extends Controller {
/* constructor for authentication */
public function __construct()
{
$this->middleware('auth');
$this->middleware('roles');
}
/**
* Display a listing of the resource.
*
* @return 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.
*
* @return 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.
*
* @return 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 int $id
* @return 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 int $id
* @return 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 int $id
* @return 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');
}
}
}

View File

@@ -0,0 +1,245 @@
<?php namespace App\Http\Controllers\Admin;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Validator;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Input;
use Illuminate\Database\Eloquent\Model;
use App\Http\Requests\GroupRequest;
use App\Model\Agent\Groups;
use App\Model\Agent\Group_assign_department;
use App\Model\Agent\Department;
class GroupController extends Controller {
/* constructor for authentication */
public function __construct()
{
$this->middleware('auth');
$this->middleware('roles');
}
/**
* Display a listing of the resource.
*
* @return 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 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.
*
* @return 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 int $id
* @return 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 int $id
* @return 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 int $id
* @return 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');
}
}
}

View File

@@ -0,0 +1,227 @@
<?php namespace App\Http\Controllers\Admin;
use App\Http\Requests;
/* my own Request to Validate The create form */
use App\Http\Requests\HelptopicRequest;
/* Include HelptopicUpdate for update validation*/
use App\Http\Requests\HelptopicUpdate;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
/*Using Department Model*/
use App\Model\Agent\Department;
/*Using Help_topic Model*/
use App\Model\Manage\Help_topic;
/*Using Agents Model*/
use App\Model\Agent\Agents;
/*Using Sla_plan Model*/
use App\Model\Manage\Sla_plan;
/*Using Forms Model*/
use App\Model\Form\Form_name;
/* Include Priority Model */
use App\Model\Utility\Priority;
class HelptopicController extends Controller {
/* constructor for authentication */
public function __construct()
{
$this->middleware('auth');
$this->middleware('roles');
}
/**
* Display a listing of the resource.
*
* @return 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.
*
* @return 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.
*
* @return 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 int $id
* @return 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 int $id
* @return 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 int $id
* @return 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');
}
}
}

View File

@@ -0,0 +1,36 @@
<?php namespace App\Http\Controllers\Admin;
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');
}
}

View File

@@ -0,0 +1,108 @@
<?php namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Http\Requests\ProfilePassword;
/* include guest_note model */
use App\Http\Requests\ProfileRequest;
/* include User Model */
/* include Help_topic Model */
/* Profile validator */
use App\User;
/* Profile Password validator */
/* include ticket_thred model */
use Auth;
/* include tickets model */
/* TicketRequest to validate the ticket response */
use Hash;
/* Validate post check ticket */
use Input;
class ProfileController extends Controller {
/* Define constructor for Authentication Checking */
public function __construct() {
$this->middleware('auth');
$this->middleware('roles');
}
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');
}
}
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');
}
}
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');
}
}
}

View File

@@ -0,0 +1,582 @@
<?php namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Http\Requests\CompanyRequest;
/* include CompanyRequest for company validation */
use App\Http\Requests\EmailRequest;
/* include Company Model */
use App\Http\Requests\SystemRequest;
/* include System Model */
use App\Model\Agent\Department;
/* Include SystemRequest for system validation */
use App\Model\Email\Emails;
/* include Ticket Model */
use App\Model\Email\Template;
/* include Email Model */
use App\Model\Manage\Help_topic;
/* Include EmailRequest for email settings validation */
use App\Model\Manage\Sla_plan;
/* include Access Model */
use App\Model\Settings\Access;
/* include Responder Model */
use App\Model\Settings\Alert;
/* include Alert Model */
use App\Model\Settings\Company;
/* include Department Model */
use App\Model\Settings\Email;
/* include Timezones Model */
use App\Model\Settings\Responder;
/* include Sla_plan Model */
use App\Model\Settings\System;
/* include Help_topic Model */
use App\Model\Settings\Ticket;
/* include Template Model */
use App\Model\Utility\Date_format;
/* include Emails Model */
use App\Model\Utility\Date_time_format;
/* Include date_format model*/
use App\Model\Utility\Logs;
/* Include Date_time_format model*/
use App\Model\Utility\Priority;
/* Include Time_format model*/
use App\Model\Utility\Timezones;
/* Include Logs Model */
use App\Model\Utility\Time_format;
/* Include Priority Model */
use Illuminate\Http\Request;
use Input;
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 int $id
* @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;
//echo $fileName;
Input::file('logo')->move($destinationPath, $fileName);
$companys->logo = $fileName;
}
/* Check whether function success or not */
if ($companys->fill($request->except('logo'))->save() == true) {
/* redirect to Index page with Success Message */
return redirect('getcompany')->with('success', 'Company Updated Successfully');
} 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');
}
}
/**
* @param int $id
* @return Response
* @param $system instance of System table
*
* get the form for System setting page
*
*/
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 int $id
* @return 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');
}
}
/**
* @param int $id
* @return Response
* @param $ticket instance of Ticket table
*
* get the form for Ticket setting page
*
*/
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 int $id
* @return 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');
}
}
/**
* @param int $id
* @return Response
* @param $email instance of Email table
*
* get the form for Email setting page
*
*/
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 int $id
* @return 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');
}
}
/**
* @param int $id
* @return Response
* @param $access instance of Access table
*
* get the form for Access setting page
*
*/
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 int $id
* @return 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');
}
}
/**
* @param int $id
* @return Response
* @param $responder instance of Responder table
*
* get the form for Responder setting page
*
*/
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 int $id
* @return Response
*/
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');
}
}
/**
* @param int $id
* @return Response
* @param $alert instance of Alert table
*
* get the form for Alert setting page
*
*/
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 int $id
* @return 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');
}
}

View File

@@ -0,0 +1,203 @@
<?php namespace App\Http\Controllers\Admin;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
/* include Sla_plan Model */
use App\Model\Manage\Sla_plan;
/* Include SlaRequest */
use App\Http\Requests\SlaRequest;
/* Include SlaUpdate */
use App\Http\Requests\SlaUpdate;
class SlaController extends Controller {
/* constructor for authentication */
public function __construct()
{
$this->middleware('auth');
$this->middleware('roles');
}
/**
* Display a listing of the resource.
*
* @return 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 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.
*
* @return 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 int $id
* @return 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 int $id
* @return 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 int $id
* @return 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');
}
}
}

View File

@@ -0,0 +1,229 @@
<?php namespace App\Http\Controllers\Admin;
use App\Http\Requests\TeamRequest;
/* include TeamUpdate request for update validation */
use App\Http\Requests\TeamUpdate;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Model\Agent\Teams;
use App\Model\Agent\Agents;
use App\Model\Agent\Assign_team_agent;
use App\User;
class TeamController extends Controller {
/**
* Display a listing of the resource.
*
* @return Response
*/
public function __construct()
{
$this->middleware('auth');
$this->middleware('roles');
}
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.
*
* @return 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.
*
* @return 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 int $id
* @return 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 int $id
* @return 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 int $id
* @return 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');
}
}
}

View File

@@ -0,0 +1,225 @@
<?php namespace App\Http\Controllers\Admin;
use App\Http\Requests\TemplateRequest;
use App\Http\Requests\DiagnoRequest;
use App\Http\Controllers\Controller;
/* include TemplateUpdate request for update validation */
use App\Http\Requests\TemplateUdate;
use Illuminate\Http\Request;
use App\Model\Email\Template;
use App\Model\Utility\Languages;
use App\Model\Email\Emails;
use Mail;
class TemplateController extends Controller {
/* constructor for authentication */
public function __construct()
{
$this->middleware('auth');
$this->middleware('roles');
}
/**
* Display a listing of the resource.
*
* @return 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.
*
* @return 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.
*
* @return 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 int $id
* @return 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 int $id
* @return 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 int $id
* @return 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
* @return 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');
}
}
/*
To Do function for Sending an Email
*/
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');
}
}

View File

@@ -0,0 +1,37 @@
<?php namespace App\Http\Controllers\Admin;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
/* include Priority Model */
use App\Model\Priority;
/* include Ticket_thread Model */
use App\Model\Ticket_thread;
class ThreadController extends Controller {
/* get the values from ticket_thread Table and direct to view page */
public function getTickets(Ticket_thread $thread, Priority $priority)
{
try
{
/* get the values 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');
}
}
}

View File

@@ -0,0 +1,36 @@
<?php namespace App\Http\Controllers\Admin;
class WelcomeController extends Controller {
/*
|--------------------------------------------------------------------------
| Welcome Controller
|--------------------------------------------------------------------------
|
| This controller renders the "marketing page" for the application and
| is configured to only allow guests. Like most of the other sample
| controllers, you are free to modify or remove it as you desire.
|
*/
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest');
}
/**
* Show the application welcome screen to the user.
*
* @return Response
*/
public function index()
{
return view('welcome');
}
}

View File

@@ -0,0 +1,633 @@
<?php
namespace App\Http\Controllers\Agent;
use App\Http\Controllers\Controller;
// use App\Model\Ticket\Ticket;
use App\Model\Email\Emails;
use App\Model\Ticket\Ticket_attachments;
use App\Model\Ticket\Ticket_Thread;
class MailController extends Controller {
public $email = "";
public $stream = "";
// public function fetchEmails(Emails $email)
// {
// $emails = $email->get();
// $mailboxes = $emails;
// return $mailboxes;
// }
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;
}
function getdata() {
$email = new Emails;
$mailboxes = $email->get();
if (count($mailboxes) >= 0) {
foreach ($mailboxes as $current_mailbox) {
if ($current_mailbox['fetching_status']) {
$stream = @imap_open($current_mailbox['fetching_host'], $current_mailbox['email_address'], $current_mailbox['password']);
$testvar = "";
if ($stream >= 0) {
$emails = imap_search($stream, 'SINCE ' . date('d-M-Y', strtotime("-10 day")));
if ($emails != false) {
if (count($emails) >= 0) {
rsort($emails);
foreach ($emails as $email_id) {
$overview = imap_fetch_overview($stream, $email_id, 0);
$var = $overview[0]->seen ? 'read' : 'unread';
if ($var == 'unread') {
$testvar = 'set';
$from = $this->decode_imap_text($overview[0]->from);
$subject = $this->decode_imap_text($overview[0]->subject);
$datetime = $overview[0]->date;
$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->default_helptopic();
$sla = $this->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);
//=================================================
// 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";
}
//=================================================
// 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];
}
}
//=================================================
// 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";
}
}
}
}
}
//=================================================
// 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();
if ($this->create_user($emailadd, $username, $subject, $body, $phone, $helptopic, $sla, $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);
}
}
}
}
}
//======================================
// ATTACHMENT |Incomplete
//======================================
public function get_attachment($structure, $stream, $email_id, $thread_id) {
if (isset($structure->parts) && count($structure->parts)) {
for ($i = 0; $i < count($structure->parts); $i++) {
$attachments[$i] = array(
'is_attachment' => false,
'filename' => '',
'name' => '',
'attachment' => '');
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;
}
}
}
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;
}
}
}
if ($attachments[$i]['is_attachment']) {
$attachments[$i]['attachment'] = imap_fetchbody($stream, $email_id, $i + 1);
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']);
}
}
}
if ($this->save_attcahments($attachments, $thread_id) == true) {
return true;
}
}
}
//=====================================
// SAVE ATTACHMENT | Incomplete
//=====================================
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'];
// echo '<img src="'.$tmpName.'">';
$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; //$content;
$ticket_Thread->save();
}
}
}
return true;
}
// // public function part($part)
// // {
// // $structure = $part->parts;
// // return $structure;
// // }
// // public function fetchdata()
// // {
// // $tickets = Tickets::all();
// // foreach ($tickets as $ticket)
// // {
// // echo $ticket->body.'<hr/>';
// // }
// // }
// public function ticket_list()
// {
// $tickets = Tickets::all();
// $threads = Ticket_Thread::all();
// return view('themes.default1.agent.ticket.ticket',compact('tickets'),compact('threads'));
// }
// 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'));
// }
// //============================================
// // Create Ticket | Incomplete
// //============================================
// public function reply(Ticket_Thread $thread, TicketRequest $request)
// {
// $thread->ticket_id = $request->input('ticket_ID');
// $thread->title = $request->input('To');
// $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 'success';
// return Redirect("thread/".$ticket_id);
// }
// //============================================
// // Ticket Edit get | Incomplete
// //============================================
// public function ticket_edit_get($id, Tickets $ticket , Ticket_Thread $thread)
// {
// $ticket_id = $ticket->where('id' , '=' , $id)->first();
// $thread_id = $thread->where('ticket_id' , '=' , $id)->first();
// $user = User::where('id' , '=' , $ticket_id->user_id)->first();
// return view("themes.default1.agent.ticket.edit",compact('ticket_id','thread_id','user'));
// }
// //============================================
// // Ticket Edit post | Incomplete
// //============================================
// public function ticket_edit_post($ticket_id,Ticket_Thread $thread)
// {
// dd($ticket_id);
// // return Redirect("");
// }
// //============================================
// // Ticket print | Incomplete
// //============================================
// public function ticket_print($id)
// {
// return pdf();
// // return Redirect("");
// }
// //============================================
// // Generate Ticket Number | Incomplete
// //============================================
// 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;
// }
// //=============================================
// // Checking email availability | Complete
// //=============================================
// public function check_email($email)
// {
// $check = User::where('email','=',$email)->first();
// if($check == true)
// {
// return $check;
// }
// else
// {
// return false;
// }
// }
// //===============================================
// // Create User | InComplete
// //===============================================
// public function create_user($emailadd, $username, $subject, $body, $phone, $helptopic, $sla, $system)
// {
// $email;
// $username;
// $checkemail = $this->check_email($emailadd);
// if($checkemail == false )
// {
// $password = $this->generateRandomString();
// $user = new User;
// $user->user_name = $username;
// $user->email = $emailadd;
// $user->password = Hash::make($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');
// }))
// {
// }
// }
// }
// else
// {
// $username = $checkemail->username;
// $user_id = $checkemail->id;
// }
// $ticket_number = $this->check_ticket($user_id, $subject, $body, $helptopic, $sla);
// 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;
// }
// }
// //============================================
// // Select Default help_topic | Incomplete
// //============================================
// public function default_helptopic()
// {
// $helptopic = "Support";
// return $helptopic;
// }
// //============================================
// // Select Default sla | Incomplete
// //============================================
// public function default_sla()
// {
// $sla = "12hours";
// return $sla;
// }
// //============================================
// // Select Default priority | Incomplete
// //============================================
// public function default_priority()
// {
// $priority = "important";
// return $helptopic;
// }
// //============================================
// // check ticket | Incomplete
// //============================================
// public function check_ticket($user_id, $subject, $body, $helptopic, $sla)
// {
// $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);
// return $ticket_number;
// }
// }
// else
// {
// $ticket_number = $this->create_ticket($user_id, $subject, $body, $helptopic, $sla);
// return $ticket_number;
// }
// }
// //============================================
// // Create Ticket | Incomplete
// //============================================
// public function create_ticket($user_id, $subject, $body, $helptopic, $sla)
// {
// $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->save();
// $ticket_number = $ticket->ticket_number;
// $id = $ticket->id;
// if($this->ticket_thread($subject, $body, $id, $user_id)==true)
// {
// return $ticket_number;
// }
// }
// //============================================
// // Create Ticket | Incomplete
// //============================================
// 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 Random password | Incomplete
// //============================================
// 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;
// }
// 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";
// }
// 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";
// }
// 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";
// }
// public function assign($id)
// {
// return $id;
// }
}

View File

@@ -0,0 +1,174 @@
<?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 */
class OrganizationController extends Controller {
/* Define constructor for authentication checking */
public function __construct() {
$this->middleware('auth');
$this->middleware('role.agent');
$this->middleware('roles');
}
/**
* Display a listing of the resource.
*
* @return 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 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.
*
* @return 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 int $id
* @return 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 int $id
* @return 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 int $id
* @return 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 int $id
* @return 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');
}
}
}

View File

@@ -0,0 +1,501 @@
<?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\Http\Requests\Ticket_EditRequest;
use App\Model\Ticket\Ticket_Thread;
use App\User;
use Auth;
use DB;
use Hash;
use Input;
use Mail;
use PDF;
class TicketController extends Controller {
/* Define constructor for Authentication Checking */
public function __construct() {
$this->middleware('auth');
}
//============================================
// Ticket List | Incomplete
//============================================
public function ticket_list() {
// $tickets = Tickets::all();
// $threads = Ticket_Thread::all();
return view('themes.default1.agent.ticket.ticket');
}
//============================================
// Open Ticket List | Incomplete
//============================================
public function open_ticket_list() {
// $tickets = Tickets::all();
// $threads = Ticket_Thread::all();
return view('themes.default1.agent.ticket.open');
}
//============================================
// Open Ticket List | Incomplete
//============================================
public function answered_ticket_list() {
// $tickets = Tickets::all();
// $threads = Ticket_Thread::all();
return view('themes.default1.agent.ticket.answered');
}
//============================================
// Open Ticket List | Incomplete
//============================================
public function myticket_ticket_list() {
// $tickets = Tickets::all();
// $threads = Ticket_Thread::all();
return view('themes.default1.agent.ticket.myticket');
}
//============================================
// Open Ticket List | Incomplete
//============================================
public function overdue_ticket_list() {
// $tickets = Tickets::all();
// $threads = Ticket_Thread::all();
return view('themes.default1.agent.ticket.overdue');
}
//============================================
// Open Ticket List | Incomplete
//============================================
public function closed_ticket_list() {
// $tickets = Tickets::all();
// $threads = Ticket_Thread::all();
return view('themes.default1.agent.ticket.closed');
}
//============================================
// create Ticket | Incomplete
//============================================
public function newticket() {
// $tickets = Tickets::all();
// $threads = Ticket_Thread::all();
return view('themes.default1.agent.ticket.new');
}
//============================================
// post create ticket | Incomplete
//============================================
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 = "";
if ($this->create_user($email, $fullname, $subject, $body, $phone, $helptopic, $sla, $priority, $system)) {
return Redirect('newticket')->with('success', 'success');
} else {
return Redirect('newticket')->with('success', 'success');
}
// echo $priority;
}
//============================================
// Thread | Incomplete
//============================================
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'));
}
//============================================
// Ticket reply | Incomplete
//============================================
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 'success';
return 1;
}
// //============================================
// // Ticket Edit get | Incomplete
// //============================================
// public function ticket_edit_get($id, Tickets $ticket , Ticket_Thread $thread)
// {
// $ticket_id = $ticket->where('id' , '=' , $id)->first();
// $thread_id = $thread->where('ticket_id' , '=' , $id)->first();
// $user = User::where('id' , '=' , $ticket_id->user_id)->first();
// return view("themes.default1.agent.ticket.edit",compact('ticket_id','thread_id','user'));
// }
//============================================
// Ticket Edit post | Incomplete
//============================================
public function ticket_edit_post($ticket_id, Ticket_Thread $thread) {
// echo $ticket_id;
$threads = $thread->where('ticket_id', '=', $ticket_id)->first();
// // echo $threads->title;
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;
}
//============================================
// Ticket print | Incomplete
//============================================
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();
}
//============================================
// Generate Ticket Number | Incomplete
//============================================
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;
}
//=============================================
// Checking email availability | Complete
//=============================================
public function check_email($email) {
$check = User::where('email', '=', $email)->first();
if ($check == true) {
return $check;
} else {
return false;
}
}
//===============================================
// Create User | InComplete
//===============================================
public function create_user($emailadd, $username, $subject, $body, $phone, $helptopic, $sla, $priority, $system) {
$email;
$username;
$checkemail = $this->check_email($emailadd);
if ($checkemail == false) {
$password = $this->generateRandomString();
$user = new User;
$user->user_name = $username;
$user->email = $emailadd;
$user->password = Hash::make($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');
})) {
}
}
} else {
$username = $checkemail->username;
$user_id = $checkemail->id;
}
$ticket_number = $this->check_ticket($user_id, $subject, $body, $helptopic, $sla, $priority);
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;
}
}
//============================================
// Select Default help_topic | Incomplete
//============================================
public function default_helptopic() {
$helptopic = "Support";
return $helptopic;
}
//============================================
// Select Default sla | Incomplete
//============================================
public function default_sla() {
$sla = "12hours";
return $sla;
}
//============================================
// Select Default priority | Incomplete
//============================================
public function default_priority() {
$priority = "important";
return $helptopic;
}
//============================================
// check ticket | Incomplete
//============================================
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 | Incomplete
//============================================
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;
}
}
//============================================
// Create Ticket | Incomplete
//============================================
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 Random password | Incomplete
//============================================
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;
}
//============================================
// Ticket Close | Incomplete
//============================================
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";
}
//============================================
// Ticket resolve | Incomplete
//============================================
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";
}
//============================================
// Ticket open | Incomplete
//============================================
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";
}
//============================================
// Ticket open | Incomplete
//============================================
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";
}
//============================================
// ban email | Incomplete
//============================================
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";
}
//============================================
// Ticket Assign | Incomplete
//============================================
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;
}
//============================================
// Internal Note | Incomplete
//============================================
public function InternalNote($id) {
$InternalContent = Input::get('InternalContent');
// $InternalContent = 'hello';
$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;
}
//============================================
// Surrender ticket | Incomplete
//============================================
public function surrender($id) {
$ticket = Tickets::where('id', '=', $id)->first();
$ticket->assigned_to = 0;
$ticket->save();
return 1;
}
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));
}
}
public function trash() {
return view('themes.default1.agent.ticket.trash');
}
public function unassigned() {
return view('themes.default1.agent.ticket.unassigned');
}
public function myticket() {
return view('themes.default1.agent.ticket.myticket');
}
}

View File

@@ -0,0 +1,257 @@
<?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 */
use App\Model\Agent_panel\Sys_user;
/* 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;
class UserController extends Controller {
/* Define constructor for Authentication Checking */
public function __construct() {
$this->middleware('auth');
$this->middleware('role.agent');
$this->middleware('roles');
}
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index(Sys_user $user) {
try
{
/* get all values in Sys_user */
$users = $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 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.
*
* @return Response
*/
public function store(Sys_user $user, Sys_userRequest $request) {
try
{
/* insert the input request to sys_user table */
/* Check whether function success or not */
if ($user->fill($request->input())->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 int $id
* @return Response
*/
public function show($id, Sys_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 int $id
* @return Response
*/
public function edit($id, Sys_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 int $id
* @return Response
*/
public function update($id, Sys_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 int $id
* @return Response
*/
public function destroy($id, Sys_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');
}
}
public function getProfile() {
$user = Auth::user();
return view('themes.default1.agent.user.profile', compact('user'));
}
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');
}
}
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');
}
}
}

View File

@@ -0,0 +1,177 @@
<?php namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Contracts\Auth\Guard;
use Illuminate\Contracts\Auth\Registrar;
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;
/* include User Model */
use App\User;
/* Include RegisterRequest */
use Illuminate\Http\Request;
/* Register validation */
use App\Http\Requests\RegisterRequest;
use Hash;
use Mail;
/* Include login validator */
use App\Http\Requests\LoginRequest;
class AuthController extends Controller {
/*
|--------------------------------------------------------------------------
| Registration & Login Controller
|--------------------------------------------------------------------------
|
| 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?
|
*/
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 */
public function getRegister()
{
return view('auth.register');
}
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();
$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');
}
public function getMail($token, User $user)
{
$user = $user->where('remember_token',$token)->where('active',0)->first();
//dd($user);
if($user)
{
$user->active = 1;
$user->save();
return redirect('auth/login');
}
else
{
return redirect('auth/login');
}
}
public function getLogin()
{
return view('auth.login');
}
/* Post of login page */
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()
]);
}
protected function getFailedLoginMessage()
{
return 'This Field do not match our records.';
}
}

View File

@@ -0,0 +1,38 @@
<?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;
class PasswordController extends Controller {
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset requests
| and uses a simple trait to include this behavior. You're free to
| explore this trait and override any methods you wish to tweak.
|
*/
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');
}
}

View File

@@ -0,0 +1,40 @@
<?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]);
}
}
}

View File

@@ -0,0 +1,11 @@
<?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;
}

View File

@@ -0,0 +1,16 @@
<?php namespace App\Http\Controllers\Error;
use App\Http\Controllers\Controller;
class ErrorController extends Controller {
/**
* Display a Error Page of 404.
*
* @return Response
*/
public function error404() {
return view('404');
}
}

View File

@@ -0,0 +1,121 @@
<?php namespace App\Http\Controllers\Guest;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
/* include help topic model */
use App\Model\Manage\Help_topic;
/* Include form_name model */
use App\Model\Form\Form_name;
/*include form_detals model*/
use App\Model\Form\Form_details;
/* Include form_value model */
use App\Model\Form\Form_value;
use App\User;
use Form;
use Input;
use DB;
/* Validate form TicketForm using */
use App\Http\Requests\TicketForm;
class FormController extends Controller {
/* constructor for authentication */
/* function for crate form */
/* This Function to get the form for the ticket */
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 */
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
// // ));
}
public function postedForm(Request $request, User $user)
{
$user->name = $request->input('Name');
$user->email = $request->input('Email');
$user->save();
}
}

View File

@@ -0,0 +1,191 @@
<?php namespace App\Http\Controllers\Guest;
use App\Http\Controllers\Controller;
use App\Http\Requests\CheckTicket;
use App\Http\Requests\ProfilePassword;
/* include guest_note model */
use App\Http\Requests\ProfileRequest;
/* include User Model */
use App\Http\Requests\TicketRequest;
use App\Model\Manage\Help_topic;
use App\Model\Ticket\Tickets;
/* include Help_topic Model */
use App\Model\Ticket\Ticket_Thread;
/* Profile validator */
use App\User;
/* Profile Password validator */
use Auth;
/* include ticket_thred model */
use Hash;
/* include tickets model */
/* TicketRequest to validate the ticket response */
use Input;
/* Validate post check ticket */
class GuestController extends Controller {
/* Define constructor for Authentication Checking */
public function __construct() {
$this->middleware('auth');
$this->middleware('role.user');
}
public function getProfile() {
$user = Auth::user();
return view('themes.default1.client.guest-user.profile', compact('user'));
}
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');
}
}
public function getTicket(Help_topic $topic) {
$topics = $topic->get();
return view('themes.default1.client.guest-user.form', compact('topics'));
}
/*Get my ticket*/
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*/
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 */
public function ticketEdit() {
}
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');
}
}
//============================================
// Ticket reply | Incomplete
//============================================
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);
}
public function getCheckTicket(Tickets $ticket, User $user) {
return view('themes.default1.client.guest-user.newticket', compact('ticket'));
}
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');
}
}
}

View File

@@ -0,0 +1,21 @@
<?php namespace App\Http\Controllers\Guest;
use App\Http\Controllers\Controller;
use App\Model\Settings\System;
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'));
}
}

View File

@@ -0,0 +1,36 @@
<?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');
}
}

35
code/app/Http/Kernel.php Normal file
View File

@@ -0,0 +1,35 @@
<?php namespace App\Http;
use Illuminate\Foundation\Http\Kernel as HttpKernel;
class Kernel extends HttpKernel {
/**
* The application's global HTTP middleware stack.
*
* @var array
*/
protected $middleware = [
'Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode',
'Illuminate\Cookie\Middleware\EncryptCookies',
'Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse',
'Illuminate\Session\Middleware\StartSession',
'Illuminate\View\Middleware\ShareErrorsFromSession',
'App\Http\Middleware\VerifyCsrfToken',
];
/**
* The application's route middleware.
*
* @var array
*/
protected $routeMiddleware = [
'auth' => 'App\Http\Middleware\Authenticate',
'auth.basic' => 'Illuminate\Auth\Middleware\AuthenticateWithBasicAuth',
'guest' => 'App\Http\Middleware\RedirectIfAuthenticated',
'roles' => 'App\Http\Middleware\CheckRole',
'role.agent' => 'App\Http\Middleware\CheckRoleAgent',
'role.user' => 'App\Http\Middleware\CheckRoleUser',
];
}

View File

@@ -0,0 +1,50 @@
<?php namespace App\Http\Middleware;
use Closure;
use Illuminate\Contracts\Auth\Guard;
class Authenticate {
/**
* The Guard implementation.
*
* @var Guard
*/
protected $auth;
/**
* Create a new filter instance.
*
* @param Guard $auth
* @return void
*/
public function __construct(Guard $auth)
{
$this->auth = $auth;
}
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if ($this->auth->guest())
{
if ($request->ajax())
{
return response('Unauthorized.', 401);
}
else
{
return redirect()->guest('auth/login');
}
}
return $next($request);
}
}

View File

@@ -0,0 +1,23 @@
<?php namespace App\Http\Middleware;
use Closure;
class CheckRole {
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next) {
if ($request->user()->role == 'admin') {
return $next($request);
}
return redirect('guest')->with('fails', 'You are not Autherised');
}
}

View File

@@ -0,0 +1,21 @@
<?php namespace App\Http\Middleware;
use Closure;
class CheckRoleAgent {
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next) {
if ($request->user()->role == 'agent' || $request->user()->role == 'admin') {
return $next($request);
}
return redirect('guest')->with('fails', 'You are not Autherised');
}
}

View File

@@ -0,0 +1,22 @@
<?php namespace App\Http\Middleware;
use Closure;
class CheckRoleUser {
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next) {
if ($request->user()->role == 'user') {
return $next($request);
}
return redirect('guest')->with('fails', 'You are not Autherised');
}
}

View File

@@ -0,0 +1,44 @@
<?php namespace App\Http\Middleware;
use Closure;
use Illuminate\Contracts\Auth\Guard;
use Illuminate\Http\RedirectResponse;
class RedirectIfAuthenticated {
/**
* The Guard implementation.
*
* @var Guard
*/
protected $auth;
/**
* Create a new filter instance.
*
* @param Guard $auth
* @return void
*/
public function __construct(Guard $auth)
{
$this->auth = $auth;
}
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if ($this->auth->check())
{
return new RedirectResponse(url('dashboard'));
}
return $next($request);
}
}

View File

@@ -0,0 +1,19 @@
<?php namespace App\Http\Middleware;
use Closure;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as BaseVerifier;
class VerifyCsrfToken extends BaseVerifier {
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next) {
return parent::handle($request, $next);
}
}

View File

@@ -0,0 +1,40 @@
<?php namespace App\Http\Requests;
use App\Http\Requests\Request;
class AgentRequest extends Request {
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'user_name' => 'required|unique:agents',
'first_name' => 'required',
'last_name' => 'required',
'email' => 'required',
'account_type' => 'required',
'account_status' => 'required',
'assign_group' => 'required',
'primary_dpt' => 'required',
'agent_tzone' => 'required',
'phone_number' => 'phone:IN',
'mobile' => 'phone:IN',
'team_id' => 'required'
];
}
}

View File

@@ -0,0 +1,39 @@
<?php namespace App\Http\Requests;
use App\Http\Requests\Request;
class AgentUpdate extends Request {
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'first_name' => 'required',
'last_name' => 'required',
'email' => 'required|email',
'account_type' => 'required',
'role' => 'required',
'assign_group' => 'required',
'primary_dpt' => 'required',
'agent_tzone' => 'required',
'phone_number' => 'phone:IN',
'mobile' => 'phone:IN',
'team_id' => 'required'
];
}
}

View File

@@ -0,0 +1,28 @@
<?php namespace App\Http\Requests;
use App\Http\Requests\Request;
class BanRequest extends Request {
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize() {
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules() {
return [
'email_address' => 'required|email|unique:banlist',
'ban_status' => 'required',
];
}
}

View File

@@ -0,0 +1,30 @@
<?php namespace App\Http\Requests;
use App\Http\Requests\Request;
class BanlistRequest extends Request {
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'email_address' => 'email',
'ban_status' => 'required'
];
}
}

View File

@@ -0,0 +1,30 @@
<?php namespace App\Http\Requests;
use App\Http\Requests\Request;
class CheckTicket extends Request {
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'email' => 'required|email',
'ticket_number'=>'required'
];
}
}

View File

@@ -0,0 +1,32 @@
<?php namespace App\Http\Requests;
use App\Http\Requests\Request;
class CompanyRequest extends Request {
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'company_name' => 'required',
'website' => 'url',
'phone' => 'numeric',
'logo' => 'image'
];
}
}

View File

@@ -0,0 +1,37 @@
<?php namespace App\Http\Requests;
use App\Http\Requests\Request;
class CreateTicketRequest extends Request {
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'email' => 'required|email',
'fullname' => 'required|min:3',
'helptopic' => 'required',
'dept' => 'required',
'sla' => 'required',
'subject' => 'required|min:5',
'body' => 'required|min:20',
'priority' => 'required'
];
}
}

View File

@@ -0,0 +1,32 @@
<?php namespace App\Http\Requests;
use App\Http\Requests\Request;
class DepartmentRequest extends Request {
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'name' => 'required|unique:department',
'outgoing_email' => 'required',
'auto_response_email' => 'required',
'group_id' => 'required'
];
}
}

View File

@@ -0,0 +1,32 @@
<?php namespace App\Http\Requests;
use App\Http\Requests\Request;
class DepartmentUpdate extends Request {
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'outgoing_email' => 'required',
'auto_response_email' => 'required',
'group_id' => 'required'
];
}
}

View File

@@ -0,0 +1,32 @@
<?php namespace App\Http\Requests;
use App\Http\Requests\Request;
class DiagnoRequest extends Request {
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'from' => 'required|email',
'to' => 'required|email',
'subject' => 'required',
'message' => 'required'
];
}
}

View File

@@ -0,0 +1,35 @@
<?php namespace App\Http\Requests;
use App\Http\Requests\Request;
class EmailRequest extends Request {
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
];
}
}

View File

@@ -0,0 +1,39 @@
<?php namespace App\Http\Requests;
use App\Http\Requests\Request;
class EmailsEditRequest extends Request {
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'email_address' => 'email',
'email_name' => 'required',
'department' => 'required',
'priority' => 'required',
'help_topic' => 'required',
'imap_config' => 'required',
'password' => 'required|min:6',
'user_name' => 'required',
'sending_host' => 'required',
'sending_port' => 'required'
//'mailbox_protocol' => 'required'
];
}
}

View File

@@ -0,0 +1,39 @@
<?php namespace App\Http\Requests;
use App\Http\Requests\Request;
class EmailsRequest extends Request {
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'email_address' => 'required|email|unique:emails',
'email_name' => 'required',
'department' => 'required',
'priority' => 'required',
'help_topic' => 'required',
'imap_config' => 'required',
'password' => 'required|min:6',
'user_name' => 'required',
'sending_host' => 'required',
'sending_port' => 'required'
//'mailbox_protocol' => 'required'
];
}
}

View File

@@ -0,0 +1,34 @@
<?php namespace App\Http\Requests;
use App\Http\Requests\Request;
class FormRequest extends Request {
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'title' => 'required',
'label' => 'required',
'type' => 'required',
'visibility' => 'required'
];
}
}

View File

@@ -0,0 +1,30 @@
<?php namespace App\Http\Requests;
use App\Http\Requests\Request;
class GroupRequest extends Request {
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'name' => 'required|unique:groups'
];
}
}

View File

@@ -0,0 +1,36 @@
<?php namespace App\Http\Requests;
use App\Http\Requests\Request;
class HelptopicRequest extends Request {
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'topic' => 'required|unique:help_topic',
'parent_topic' => 'required',
'custom_form' => 'required',
'department' => 'required',
'priority' => 'required',
'sla_plan' => 'required',
'auto_assign' => 'required'
];
}
}

View File

@@ -0,0 +1,34 @@
<?php namespace App\Http\Requests;
use App\Http\Requests\Request;
class HelptopicUpdate extends Request {
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'parent_topic' => 'required',
'custom_form' => 'required',
'department' => 'required',
'priority' => 'required',
'sla_plan' => 'required',
'auto_assign' => 'required'
];
}
}

View File

@@ -0,0 +1,30 @@
<?php namespace App\Http\Requests;
use App\Http\Requests\Request;
class LoginRequest extends Request {
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'email' => 'required|email',
'password' => 'required|min:6'
];
}
}

View File

@@ -0,0 +1,32 @@
<?php namespace App\Http\Requests;
use App\Http\Requests\Request;
class OrganizationRequest extends Request {
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'name' => 'required|unique:organization',
'website' => 'url',
'phone' => 'size:10'
];
}
}

View File

@@ -0,0 +1,31 @@
<?php namespace App\Http\Requests;
use App\Http\Requests\Request;
class OrganizationUpdate extends Request {
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'website' => 'url',
'phone' => 'size:10'
];
}
}

View File

@@ -0,0 +1,31 @@
<?php namespace App\Http\Requests;
use App\Http\Requests\Request;
class ProfilePassword extends Request {
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'old_password' => 'required',
'new_password' => 'required|min:6',
'confirm_password' => 'required|same:new_password'
];
}
}

View File

@@ -0,0 +1,30 @@
<?php namespace App\Http\Requests;
use App\Http\Requests\Request;
class ProfileRequest extends Request {
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'first_name' => 'required',
'profile_pic' => 'mimes:png,jpeg',
];
}
}

View File

@@ -0,0 +1,32 @@
<?php namespace App\Http\Requests;
use App\Http\Requests\Request;
class RegisterRequest extends Request {
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'email' => 'required|max:50|email|unique:users',
'full_name' => 'required',
'password' => 'required|min:6',
'password_confirmation' => 'required|same:password'
];
}
}

View File

@@ -0,0 +1,9 @@
<?php namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
abstract class Request extends FormRequest {
//
}

View File

@@ -0,0 +1,30 @@
<?php namespace App\Http\Requests;
use App\Http\Requests\Request;
class SlaRequest extends Request {
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'name' => 'required|unique:sla_plan',
'grace_period'=> 'required'
];
}
}

View File

@@ -0,0 +1,29 @@
<?php namespace App\Http\Requests;
use App\Http\Requests\Request;
class SlaUpdate extends Request {
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'grace_period'=> 'required'
];
}
}

View File

@@ -0,0 +1,32 @@
<?php namespace App\Http\Requests;
use App\Http\Requests\Request;
class Sys_userRequest extends Request {
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'email' => 'required|email',
'full_name' => 'required|unique:sys_user',
'phone' => 'size:10'
];
}
}

View File

@@ -0,0 +1,30 @@
<?php namespace App\Http\Requests;
use App\Http\Requests\Request;
class Sys_userUpdate extends Request {
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'email' => 'required|email',
'phone' => 'size:10'
];
}
}

View File

@@ -0,0 +1,32 @@
<?php namespace App\Http\Requests;
use App\Http\Requests\Request;
class SystemRequest extends Request {
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'name' => 'required',
'url' => 'url'
];
}
}

View File

@@ -0,0 +1,30 @@
<?php namespace App\Http\Requests;
use App\Http\Requests\Request;
class TeamRequest extends Request {
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'name' => 'required|unique:teams',
'status' => 'required'
];
}
}

View File

@@ -0,0 +1,30 @@
<?php namespace App\Http\Requests;
use App\Http\Requests\Request;
class TeamUpdate extends Request {
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
];
}
}

View File

@@ -0,0 +1,30 @@
<?php namespace App\Http\Requests;
use App\Http\Requests\Request;
class TemplateRequest extends Request {
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize() {
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules() {
return [
'name' => 'required|unique:template',
'ban_status' => 'required',
'template_set_to_clone' => 'required',
'language' => 'required',
];
}
}

View File

@@ -0,0 +1,30 @@
<?php namespace App\Http\Requests;
use App\Http\Requests\Request;
class TemplateUdate extends Request {
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize() {
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules() {
return [
'ban_status' => 'required',
'template_set_to_clone' => 'required',
'language' => 'required',
];
}
}

View File

@@ -0,0 +1,32 @@
<?php namespace App\Http\Requests;
use App\Http\Requests\Request;
class TicketForm extends Request {
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'help_topic' => 'required',
'Email' => 'required',
'Subject' => 'required',
'Detail' => 'required'
];
}
}

View File

@@ -0,0 +1,31 @@
<?php namespace App\Http\Requests;
use App\Http\Requests\Request;
class TicketRequest extends Request {
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'To' => 'required',
'ticket_ID' => 'required',
'ReplyContent' => 'required'
];
}
}

275
code/app/Http/routes.php Normal file
View File

@@ -0,0 +1,275 @@
<?php
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
//Route::get('/', 'WelcomeController@index');
//Route::get('/', 'HomeController@index');
Route::controllers([
'auth' => 'Auth\AuthController',
'password' => 'Auth\PasswordController',
]);
$router->get('getmail/{token}', 'Auth\AuthController@getMail');
/*
|-------------------------------------------------------------------------------
|Admin Routes
|-------------------------------------------------------------------------------
| Here is defining entire routes for the Admin Panel
|
|
*/
// To get the dash board
//Route::get('dashboard', 'HomeController@index');
Route::group(['middleware' => 'roles', 'middleware' => 'auth'], function () {
// resource is a function to process create,edit,read and delete
Route::resource('groups', 'Admin\GroupController'); // for group module, for CRUD
Route::resource('departments', 'Admin\DepartmentController'); // for departments module, for CRUD
Route::resource('teams', 'Admin\TeamController'); // in teams module, for CRUD
Route::resource('agents', 'Admin\AgentController'); // in agents module, for CRUD
Route::resource('emails', 'Admin\EmailsController'); // in emails module, for CRUD
Route::resource('banlist', 'Admin\BanlistController'); // in banlist module, for CRUD
Route::resource('template', 'Admin\TemplateController'); // in template module, for CRUD
Route::get('getdiagno', 'Admin\TemplateController@formDiagno'); // for getting form for diagnostic
Route::post('postdiagno', 'Admin\TemplateController@postDiagno'); // for getting form for diagnostic
Route::resource('helptopic', 'Admin\HelptopicController'); // in helptopics module, for CRUD
Route::resource('sla', 'Admin\SlaController'); // in SLA Plan module, for CRUD
Route::resource('form', 'Admin\FormController'); // in Form module, for CRUD
//$router->model('id','getcompany');
Route::get('getcompany', 'Admin\SettingsController@getcompany'); // direct to company setting page
Route::patch('postcompany/{id}', 'Admin\SettingsController@postcompany'); // Updating the Company table with requests
Route::get('getsystem', 'Admin\SettingsController@getsystem'); // direct to system setting page
Route::patch('postsystem/{id}', 'Admin\SettingsController@postsystem'); // Updating the System table with requests
Route::get('getticket', 'Admin\SettingsController@getticket'); // direct to ticket setting page
Route::patch('postticket/{id}', 'Admin\SettingsController@postticket'); // Updating the Ticket table with requests
Route::get('getemail', 'Admin\SettingsController@getemail'); // direct to email setting page
Route::patch('postemail/{id}', 'Admin\SettingsController@postemail'); // Updating the Email table with requests
Route::get('getaccess', 'Admin\SettingsController@getaccess'); // direct to access setting page
Route::patch('postaccess/{id}', 'Admin\SettingsController@postaccess'); // Updating the Access table with requests
Route::get('getresponder', 'Admin\SettingsController@getresponder'); // direct to responder setting page
Route::patch('postresponder/{id}', 'Admin\SettingsController@postresponder'); // Updating the Responder table with requests
Route::get('getalert', 'Admin\SettingsController@getalert'); // direct to alert setting page
Route::patch('postalert/{id}', 'Admin\SettingsController@postalert'); // Updating the Alert table with requests
/* Admin profile get */
Route::get('admin-profile', 'Admin\ProfileController@getProfile');
/* Admin Profile Post */
Route::patch('admin-profile', 'Admin\ProfileController@postProfile');
/* Admin Profile Password Post */
Route::patch('admin-profile-password', 'Admin\ProfileController@postProfilePassword');
});
/* calling ticket.blade.php file */
// $router->get('tickets','Admin\ThreadController@getTickets');
/* calling timeline.blade.php file */
Route::get('time', function () {
return view('themes.default1.admin.tickets.timeline');
});
/*
|------------------------------------------------------------------
|Agent Routes
|--------------------------------------------------------------------
| Here defining entire Agent Panel routers
|
|
*/
Route::group(['middleware' => 'role.agent', 'middleware' => 'auth'], function () {
/* User router is used to control the CRUD of user */
Route::resource('user', 'Agent\UserController');
/* organization router used to deal CRUD function of organization */
Route::resource('organizations', 'Agent\OrganizationController');
/* User profile get */
Route::get('agent-profile', 'Agent\UserController@getProfile');
/* User Profile Post */
Route::patch('agent-profile', 'Agent\UserController@postProfile');
/* Profile Password Post */
Route::patch('agent-profile-password', 'Agent\UserController@postProfilePassword');
// Route::get('/abcd', 'GuestController@getList');
// Route::get('/qwer', ['as' => 'thread', 'uses' => 'GuestController@getThread']);
/* Fetch Emails */
Route::get('/test', ['as' => 'thr', 'uses' => 'Agent\MailController@fetchdata']);
/* Get Ticket */
Route::get('/ticket', ['as' => 'ticket', 'uses' => 'Agent\TicketController@ticket_list']);
/* Get Open Ticket */
Route::get('/ticket/open', ['as' => 'open.ticket', 'uses' => 'Agent\TicketController@open_ticket_list']);
/* Get Answered Ticket */
Route::get('/ticket/answered', ['as' => 'answered.ticket', 'uses' => 'Agent\TicketController@answered_ticket_list']);
/* Get Tickets Assigned to logged user */
Route::get('/ticket/myticket', ['as' => 'myticket.ticket', 'uses' => 'Agent\TicketController@myticket_ticket_list']);
/* Get Overdue Ticket */
Route::get('/ticket/overdue', ['as' => 'overdue.ticket', 'uses' => 'Agent\TicketController@overdue_ticket_list']);
/* Get Closed Ticket */
Route::get('/ticket/closed', ['as' => 'closed.ticket', 'uses' => 'Agent\TicketController@closed_ticket_list']);
/* Get Create New Ticket */
Route::get('/newticket', ['as' => 'newticket', 'uses' => 'Agent\TicketController@newticket']);
/* Post Create New Ticket */
Route::post('/newticket/post', ['as' => 'post.newticket', 'uses' => 'Agent\TicketController@post_newticket']);
/* Get Thread by ID */
Route::get('/thread/{id}', ['as' => 'ticket.thread', 'uses' => 'Agent\TicketController@thread']);
/* Patch Thread Reply */
Route::patch('/thread/reply/{id}', ['as' => 'ticket.reply', 'uses' => 'Agent\TicketController@reply']);
/* Patch Internal Note */
Route::patch('/internal/note/{id}', ['as' => 'Internal.note', 'uses' => 'Agent\TicketController@InternalNote']);
/* Patch Ticket assigned to whom */
Route::patch('/ticket/assign/{id}', ['as' => 'assign.ticket', 'uses' => 'Agent\TicketController@assign']);
/* Patchi Ticket Edit */
Route::patch('/ticket/post/edit/{id}', ['as' => 'ticket.post.edit', 'uses' => 'Agent\TicketController@ticket_edit_post']);
/* Get Print Ticket */
Route::get('/ticket/print/{id}', ['as' => 'ticket.print', 'uses' => 'Agent\TicketController@ticket_print']);
/* Get Ticket Close */
Route::get('/ticket/close/{id}', ['as' => 'ticket.close', 'uses' => 'Agent\TicketController@close']);
/* Get ticket Resolve */
Route::get('/ticket/resolve/{id}', ['as' => 'ticket.resolve', 'uses' => 'Agent\TicketController@resolve']);
/* Get Ticket Open */
Route::get('/ticket/open/{id}', ['as' => 'ticket.open', 'uses' => 'Agent\TicketController@open']);
/* Get Ticket Delete */
Route::get('/ticket/delete/{id}', ['as' => 'ticket.delete', 'uses' => 'Agent\TicketController@delete']);
/* Get Ban Email */
Route::get('/email/ban/{id}', ['as' => 'ban.email', 'uses' => 'Agent\TicketController@ban']);
/* Get Ticket Surrender */
Route::get('/ticket/surrender/{id}', ['as' => 'ticket.surrender', 'uses' => 'Agent\TicketController@surrender']);
Route::get('/aaaa', 'Guest\GuestController@ticket_number');
/* To show Deleted Tickets */
Route::get('trash', 'Agent\TicketController@trash');
/* To show Unassigned Tickets */
Route::get('unassigned', 'Agent\TicketController@unassigned');
});
/*
|------------------------------------------------------------------
|Guest Routes
|--------------------------------------------------------------------
| Here defining Guest User's routes
|
|
*/
/* get the form for create a ticket by guest user */
$router->get('getform', 'Guest\FormController@getForm');
/* post the AJAX form for create a ticket by guest user */
$router->post('postform', 'Guest\FormController@postForm');
/* post the form to store the value */
$router->post('postedform', 'Guest\FormController@postedForm');
//testing checkbox auto-populate
$router->get('check', 'CheckController@getcheck');
$router->post('postcheck/{id}', 'CheckController@postcheck');
//guest layout
$router->get('/', 'Guest\OuthouseController@get');
//testing ckeditor
//$router->get('ck','Admin\SettingsController@getck');
//===================================================================================
Route::group(['middleware' => 'role.user', 'middleware' => 'auth'], function () {
/* User profile get */
Route::get('user-profile', 'Guest\GuestController@getProfile');
/* User Profile Post */
Route::patch('profile', 'Guest\GuestController@postProfile');
/* Profile Password Post */
Route::patch('profile-password', 'Guest\GuestController@postProfilePassword');
});
//====================================================================================
/* Get my tickets */
$router->get('myticket', ['as' => 'ticket', 'uses' => 'Guest\GuestController@getMyticket']);
/* Get my ticket thread */
//$router->get('thread/{id}',['as'=>'ticket.thread','uses'=>'Guest\GuestController@getthread']);
// testing
// Route::get('testing','Agent\MailController@getdata');
/* Check your Ticket */
$router->get('checkticket', 'Guest\GuestController@getCheckTicket');
/* post Check Ticket */
$router->post('postcheck', 'Guest\GuestController@PostCheckTicket');
$router->get('postcheck', 'Guest\GuestController@PostCheckTicket');
/* 404 page */
$router->get('404', 'error\ErrorController@error404');

View File

@@ -0,0 +1,13 @@
<?php namespace App\Model\Agent;
use Illuminate\Database\Eloquent\Model;
class Agents extends Model
{
protected $table = 'agents';
protected $fillable = [
'user_name','first_name','last_name','email','phone','mobile','agent_sign',
'account_type','account_status','assign_group','primary_dpt','agent_tzone',
'daylight_save','limit_access','directory_listing','vocation_mode','assign_team'
];
}

View File

@@ -0,0 +1,11 @@
<?php namespace App\Model\Agent;
use Illuminate\Database\Eloquent\Model;
class Assign_team_agent extends Model {
protected $table = 'team_assign_agent';
protected $fillable = ['id','team_id','agent_id'];
}

View File

@@ -0,0 +1,13 @@
<?php namespace App\Model\Agent;
use Illuminate\Database\Eloquent\Model;
class Department extends Model
{
protected $table = 'department';
protected $fillable = [
'name', 'type', 'sla', 'manager', 'ticket_assignment', 'outgoing_email',
'template_set', 'auto_ticket_response', 'auto_message_response',
'auto_response_email', 'recipient', 'group_access', 'department_sign'
];
}

View File

@@ -0,0 +1,11 @@
<?php namespace App\Model\Agent;
use Illuminate\Database\Eloquent\Model;
class Group_assign_department extends Model {
protected $table = 'group_assign_department';
protected $fillable = ['group_id','id','department_id'];
}

View File

@@ -0,0 +1,15 @@
<?php namespace App\Model\Agent;
use Illuminate\Database\Eloquent\Model;
class Groups extends Model
{
protected $table = 'groups';
protected $fillable = [
'name', 'group_status', 'can_create_ticket', 'can_edit_ticket',
'can_post_ticket', 'can_close_ticket', 'can_assign_ticket',
'can_trasfer_ticket', 'can_delete_ticket', 'can_ban_email',
'can_manage_canned', 'can_manage_faq', 'can_view_agent_stats',
'department_access', 'admin_notes'
];
}

View File

@@ -0,0 +1,11 @@
<?php namespace App\Model\Agent;
use Illuminate\Database\Eloquent\Model;
class Teams extends Model
{
protected $table = 'teams';
protected $fillable = [
'name', 'status', 'team_lead', 'assign_alert', 'admin_notes'
];
}

View File

@@ -0,0 +1,13 @@
<?php namespace App\Model\Agent_panel;
use Illuminate\Database\Eloquent\Model;
class Organization extends Model {
/* define the table name */
protected $table = 'organization';
/* Define the fillable fields */
protected $fillable = ['id','name','phone','website','address','internal_notes'];
}

View File

@@ -0,0 +1,13 @@
<?php namespace App\Model\Agent_panel;
use Illuminate\Database\Eloquent\Model;
class Sys_user extends Model {
/* define table name */
protected $table = 'sys_user';
/* define fillable fields */
protected $fillable = ['id','email','full_name','phone','internal_notes'];
}

View File

@@ -0,0 +1,12 @@
<?php namespace App\Model\Email;
use Illuminate\Database\Eloquent\Model;
class Banlist extends Model {
protected $table = 'banlist';
protected $fillable = [
'id', 'ban_status', 'email_address', 'internal_notes',
];
}

View File

@@ -0,0 +1,15 @@
<?php namespace App\Model\Email;
use Illuminate\Database\Eloquent\Model;
class Emails extends Model
{
protected $table = 'emails';
protected $fillable = [
'email_address', 'email_name', 'department', 'priority', 'help_topic',
'user_name', 'password', 'fetching_host', 'fetching_port', 'mailbox_protocol',
'folder', 'sending_host', 'sending_port', 'internal_notes', 'auto_response',
'fetching_status', 'move_to_folder', 'delete_email', 'do_nothing',
'sending_status', 'authentication', 'header_spoofing','imap_config'
];
}

View File

@@ -0,0 +1,12 @@
<?php namespace App\Model\Email;
use Illuminate\Database\Eloquent\Model;
class Template extends Model {
protected $table = 'template';
protected $fillable = [
'id','name','status','template_set_to_clone','language','internal_note'
];
}

View File

@@ -0,0 +1,12 @@
<?php namespace App\Model\Form;
use Illuminate\Database\Eloquent\Model;
class Form_details extends Model {
protected $table = 'form_details';
protected $fillable = ['id','label','type'];
}

View File

@@ -0,0 +1,11 @@
<?php namespace App\Model\Form;
use Illuminate\Database\Eloquent\Model;
class Form_name extends Model {
protected $table = 'form_name';
protected $fillable = ['id','name','status','no_of_fields'];
}

View File

@@ -0,0 +1,11 @@
<?php namespace App\Model\Form;
use Illuminate\Database\Eloquent\Model;
class Form_value extends Model {
protected $table = 'form_value';
protected $fillable = ['id','values'];
}

View File

@@ -0,0 +1,11 @@
<?php namespace App\Model\Guest;
use Illuminate\Database\Eloquent\Model;
class Guest_note extends Model {
protected $table = 'guest_note';
protected $fillable = ['id','heading','content'];
}

View File

@@ -0,0 +1,13 @@
<?php namespace App\Model\Manage;
use Illuminate\Database\Eloquent\Model;
class Forms extends Model {
protected $table = 'forms';
/*
this is a custom Forms created by user himself
*/
protected $fillable = ['id','title','instruction','label','type','visibility','variable','internal_notes'];
}

View File

@@ -0,0 +1,13 @@
<?php namespace App\Model\Manage;
use Illuminate\Database\Eloquent\Model;
class Help_topic extends Model
{
protected $table = 'help_topic';
protected $fillable = [
'id','topic', 'parent_topic', 'custom_form', 'department', 'ticket_status', 'priority',
'sla_plan', 'thank_page', 'ticket_num_format', 'internal_notes', 'status', 'type','auto_assign',
'auto_response'
];
}

View File

@@ -0,0 +1,11 @@
<?php namespace App\Model\Manage;
use Illuminate\Database\Eloquent\Model;
class Sla_plan extends Model
{
protected $table = 'sla_plan';
protected $fillable = [
'name', 'grace_period', 'admin_note', 'status', 'transient', 'ticket_overdue'
];
}

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