Applied fixes from StyleCI

This commit is contained in:
Sujit Prasad
2016-02-19 02:20:12 -05:00
committed by StyleCI Bot
parent be5df5334f
commit d637c2b23f
439 changed files with 19063 additions and 19210 deletions

View File

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

View File

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

View File

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

View File

@@ -1,27 +1,25 @@
<?php namespace App\Events; <?php
use App\Events\Event; namespace App\Events;
use Illuminate\Queue\SerializesModels; use Illuminate\Queue\SerializesModels;
class ClientTicketForm extends Event { class ClientTicketForm extends Event
{
use SerializesModels;
use SerializesModels; public $para1;
public $para2;
public $para1; public $para3;
public $para2; public $para4;
public $para3; public $para5;
public $para4;
public $para5;
public function __construct($para1='',$para2='',$para3='',$para4='',$para5='')
{
$this->para1 = $para1;
$this->para2 = $para2;
$this->para3 = $para3;
$this->para4 = $para4;
$this->para5 = $para5;
}
public function __construct($para1 = '', $para2 = '', $para3 = '', $para4 = '', $para5 = '')
{
$this->para1 = $para1;
$this->para2 = $para2;
$this->para3 = $para3;
$this->para4 = $para4;
$this->para5 = $para5;
}
} }

View File

@@ -1,28 +1,25 @@
<?php namespace App\Events; <?php
use App\Events\Event; namespace App\Events;
use Illuminate\Queue\SerializesModels; use Illuminate\Queue\SerializesModels;
class ClientTicketFormPost extends Event { class ClientTicketFormPost extends Event
{
use SerializesModels; use SerializesModels;
public $para1;
public $para2;
public $para3;
public $para4;
public $para5;
public function __construct($para1='',$para2='',$para3='',$para4='',$para5='')
{
$this->para1 = $para1;
$this->para2 = $para2;
$this->para3 = $para3;
$this->para4 = $para4;
$this->para5 = $para5;
}
public $para1;
public $para2;
public $para3;
public $para4;
public $para5;
public function __construct($para1 = '', $para2 = '', $para3 = '', $para4 = '', $para5 = '')
{
$this->para1 = $para1;
$this->para2 = $para2;
$this->para3 = $para3;
$this->para4 = $para4;
$this->para5 = $para5;
}
} }

View File

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

View File

@@ -1,31 +1,29 @@
<?php namespace App\Events; <?php
use App\Events\Event; namespace App\Events;
use Illuminate\Queue\SerializesModels; use Illuminate\Queue\SerializesModels;
class FaveoAfterReply extends Event { class FaveoAfterReply extends Event
{
use SerializesModels; use SerializesModels;
public $para1; public $para1;
public $para2; public $para2;
public $para3; public $para3;
public $para4; public $para4;
public $para5; public $para5;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct($para1='',$para2='',$para3='',$para4='',$para5='')
{
$this->para1 = $para1;
$this->para2 = $para2;
$this->para3 = $para3;
$this->para4 = $para4;
$this->para5 = $para5;
}
/**
* Create a new event instance.
*
* @return void
*/
public function __construct($para1 = '', $para2 = '', $para3 = '', $para4 = '', $para5 = '')
{
$this->para1 = $para1;
$this->para2 = $para2;
$this->para3 = $para3;
$this->para4 = $para4;
$this->para5 = $para5;
}
} }

View File

@@ -1,31 +1,30 @@
<?php namespace App\Events; <?php
use App\Events\Event; namespace App\Events;
use Illuminate\Queue\SerializesModels; use Illuminate\Queue\SerializesModels;
class FormRegisterEvent extends Event { class FormRegisterEvent extends Event
{
use SerializesModels;
use SerializesModels; public $para1;
public $para2;
public $para1; public $para3;
public $para2; public $para4;
public $para3; public $para5;
public $para4;
public $para5;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct($para1='',$para2='',$para3='',$para4='',$para5='')
{
$this->para1 = $para1;
$this->para2 = $para2;
$this->para3 = $para3;
$this->para4 = $para4;
$this->para5 = $para5;
}
/**
* Create a new event instance.
*
* @return void
*/
public function __construct($para1 = '', $para2 = '', $para3 = '', $para4 = '', $para5 = '')
{
$this->para1 = $para1;
$this->para2 = $para2;
$this->para3 = $para3;
$this->para4 = $para4;
$this->para5 = $para5;
}
} }

View File

@@ -1,31 +1,29 @@
<?php namespace App\Events; <?php
use App\Events\Event; namespace App\Events;
use Illuminate\Queue\SerializesModels; use Illuminate\Queue\SerializesModels;
class LoginEvent extends Event { class LoginEvent extends Event
{
use SerializesModels; use SerializesModels;
public $para1; public $para1;
public $para2; public $para2;
public $para3; public $para3;
public $para4; public $para4;
public $para5; public $para5;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct($para1='',$para2='',$para3='',$para4='',$para5='')
{
$this->para1 = $para1;
$this->para2 = $para2;
$this->para3 = $para3;
$this->para4 = $para4;
$this->para5 = $para5;
}
/**
* Create a new event instance.
*
* @return void
*/
public function __construct($para1 = '', $para2 = '', $para3 = '', $para4 = '', $para5 = '')
{
$this->para1 = $para1;
$this->para2 = $para2;
$this->para3 = $para3;
$this->para4 = $para4;
$this->para5 = $para5;
}
} }

View File

@@ -1,30 +1,29 @@
<?php namespace App\Events; <?php
use App\Events\Event; namespace App\Events;
use Illuminate\Queue\SerializesModels; use Illuminate\Queue\SerializesModels;
class PostRegisterEvent extends Event { class PostRegisterEvent extends Event
{
use SerializesModels; use SerializesModels;
public $para1; public $para1;
public $para2; public $para2;
public $para3; public $para3;
public $para4; public $para4;
public $para5; public $para5;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct($para1='',$para2='',$para3='',$para4='',$para5='')
{
$this->para1 = $para1;
$this->para2 = $para2;
$this->para3 = $para3;
$this->para4 = $para4;
$this->para5 = $para5;
}
/**
* Create a new event instance.
*
* @return void
*/
public function __construct($para1 = '', $para2 = '', $para3 = '', $para4 = '', $para5 = '')
{
$this->para1 = $para1;
$this->para2 = $para2;
$this->para3 = $para3;
$this->para4 = $para4;
$this->para5 = $para5;
}
} }

View File

@@ -1,31 +1,29 @@
<?php namespace App\Events; <?php
use App\Events\Event; namespace App\Events;
use Illuminate\Queue\SerializesModels; use Illuminate\Queue\SerializesModels;
class ReadMailEvent extends Event { class ReadMailEvent extends Event
{
use SerializesModels; use SerializesModels;
public $para1; public $para1;
public $para2; public $para2;
public $para3; public $para3;
public $para4; public $para4;
public $para5; public $para5;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct($para1='',$para2='',$para3='',$para4='',$para5='')
{
$this->para1 = $para1;
$this->para2 = $para2;
$this->para3 = $para3;
$this->para4 = $para4;
$this->para5 = $para5;
}
/**
* Create a new event instance.
*
* @return void
*/
public function __construct($para1 = '', $para2 = '', $para3 = '', $para4 = '', $para5 = '')
{
$this->para1 = $para1;
$this->para2 = $para2;
$this->para3 = $para3;
$this->para4 = $para4;
$this->para5 = $para5;
}
} }

View File

@@ -1,30 +1,29 @@
<?php namespace App\Events; <?php
use App\Events\Event; namespace App\Events;
use Illuminate\Queue\SerializesModels; use Illuminate\Queue\SerializesModels;
class TicketBoxHeader extends Event { class TicketBoxHeader extends Event
{
use SerializesModels; use SerializesModels;
public $para1; public $para1;
public $para2; public $para2;
public $para3; public $para3;
public $para4; public $para4;
public $para5; public $para5;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct($para1='',$para2='',$para3='',$para4='',$para5='')
{
$this->para1 = $para1;
$this->para2 = $para2;
$this->para3 = $para3;
$this->para4 = $para4;
$this->para5 = $para5;
}
/**
* Create a new event instance.
*
* @return void
*/
public function __construct($para1 = '', $para2 = '', $para3 = '', $para4 = '', $para5 = '')
{
$this->para1 = $para1;
$this->para2 = $para2;
$this->para3 = $para3;
$this->para4 = $para4;
$this->para5 = $para5;
}
} }

View File

@@ -1,30 +1,29 @@
<?php namespace App\Events; <?php
use App\Events\Event; namespace App\Events;
use Illuminate\Queue\SerializesModels; use Illuminate\Queue\SerializesModels;
class TicketDetailTable extends Event { class TicketDetailTable extends Event
{
use SerializesModels; use SerializesModels;
public $para1; public $para1;
public $para2; public $para2;
public $para3; public $para3;
public $para4; public $para4;
public $para5; public $para5;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct($para1='',$para2='',$para3='',$para4='',$para5='')
{
$this->para1 = $para1;
$this->para2 = $para2;
$this->para3 = $para3;
$this->para4 = $para4;
$this->para5 = $para5;
}
/**
* Create a new event instance.
*
* @return void
*/
public function __construct($para1 = '', $para2 = '', $para3 = '', $para4 = '', $para5 = '')
{
$this->para1 = $para1;
$this->para2 = $para2;
$this->para3 = $para3;
$this->para4 = $para4;
$this->para5 = $para5;
}
} }

View File

@@ -1,30 +1,29 @@
<?php namespace App\Events; <?php
use App\Events\Event; namespace App\Events;
use Illuminate\Queue\SerializesModels; use Illuminate\Queue\SerializesModels;
class TimeLineFormEvent extends Event { class TimeLineFormEvent extends Event
{
use SerializesModels; use SerializesModels;
public $para1; public $para1;
public $para2; public $para2;
public $para3; public $para3;
public $para4; public $para4;
public $para5; public $para5;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct($para1='',$para2='',$para3='',$para4='',$para5='')
{
$this->para1 = $para1;
$this->para2 = $para2;
$this->para3 = $para3;
$this->para4 = $para4;
$this->para5 = $para5;
}
/**
* Create a new event instance.
*
* @return void
*/
public function __construct($para1 = '', $para2 = '', $para3 = '', $para4 = '', $para5 = '')
{
$this->para1 = $para1;
$this->para2 = $para2;
$this->para3 = $para3;
$this->para4 = $para4;
$this->para5 = $para5;
}
} }

View File

@@ -1,31 +1,30 @@
<?php namespace App\Events; <?php
use App\Events\Event; namespace App\Events;
use Illuminate\Queue\SerializesModels; use Illuminate\Queue\SerializesModels;
class Timeline extends Event { class Timeline extends Event
{
use SerializesModels;
use SerializesModels; public $para1;
public $para2;
public $para1; public $para3;
public $para2; public $para4;
public $para3; public $para5;
public $para4;
public $para5;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct($para1='',$para2='',$para3='',$para4='',$para5='')
{
$this->para1 = $para1;
$this->para2 = $para2;
$this->para3 = $para3;
$this->para4 = $para4;
$this->para5 = $para5;
}
/**
* Create a new event instance.
*
* @return void
*/
public function __construct($para1 = '', $para2 = '', $para3 = '', $para4 = '', $para5 = '')
{
$this->para1 = $para1;
$this->para2 = $para2;
$this->para3 = $para3;
$this->para4 = $para4;
$this->para5 = $para5;
}
} }

View File

@@ -1,21 +1,20 @@
<?php namespace App\Events; <?php
use App\Events\Event; namespace App\Events;
use Illuminate\Queue\SerializesModels; use Illuminate\Queue\SerializesModels;
class TopNavEvent extends Event { class TopNavEvent extends Event
{
use SerializesModels; use SerializesModels;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Create a new event instance.
*
* @return void
*/
public function __construct()
{
//
}
} }

View File

@@ -8,19 +8,20 @@ use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
// use App\Http\Controllers\Common\SettingsController; // use App\Http\Controllers\Common\SettingsController;
//use App\Model\helpdesk\Email\Smtp; //use App\Model\helpdesk\Email\Smtp;
class Handler extends ExceptionHandler { class Handler extends ExceptionHandler
{
/** /**
* A list of the exception types that should not be reported. * A list of the exception types that should not be reported.
* *
* @var array * @var array
*/ */
protected $dontReport = [ protected $dontReport = [
'Symfony\Component\HttpKernel\Exception\HttpException' 'Symfony\Component\HttpKernel\Exception\HttpException',
]; ];
/** /**
* Create a new controller instance. * Create a new controller instance.
*
* @return type response * @return type response
*/ */
// public function __construct() { // public function __construct() {
@@ -32,26 +33,29 @@ class Handler extends ExceptionHandler {
* *
* This is a great spot to send exceptions to Sentry, Bugsnag, etc. * This is a great spot to send exceptions to Sentry, Bugsnag, etc.
* *
* @param \Exception $e * @param \Exception $e
*
* @return void * @return void
*/ */
public function report(Exception $e) { public function report(Exception $e)
{
return parent::report($e); return parent::report($e);
} }
/** /**
* Render an exception into an HTTP response. * Render an exception into an HTTP response.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @param \Exception $e * @param \Exception $e
*
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
public function render($request, Exception $e) { public function render($request, Exception $e)
{
if ($e instanceof \Tymon\JWTAuth\Exceptions\TokenExpiredException) { if ($e instanceof \Tymon\JWTAuth\Exceptions\TokenExpiredException) {
return response()->json(['message' => $e->getMessage(), 'code' => $e->getStatusCode()]); return response()->json(['message' => $e->getMessage(), 'code' => $e->getStatusCode()]);
//dd($e); //dd($e);
} else if ($e instanceof \Tymon\JWTAuth\Exceptions\TokenInvalidException) { } elseif ($e instanceof \Tymon\JWTAuth\Exceptions\TokenInvalidException) {
return response()->json(['message' => $e->getMessage(), 'code' => $e->getStatusCode()]); return response()->json(['message' => $e->getMessage(), 'code' => $e->getStatusCode()]);
} }
@@ -81,13 +85,13 @@ class Handler extends ExceptionHandler {
return parent::render($request, $e); return parent::render($request, $e);
} }
protected function renderExceptionWithWhoops(Exception $e) { protected function renderExceptionWithWhoops(Exception $e)
$whoops = new \Whoops\Run; {
$whoops = new \Whoops\Run();
$whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler()); $whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler());
return new \Illuminate\Http\Response( return new \Illuminate\Http\Response(
$whoops->handleException($e), $e->getStatusCode(), $e->getHeaders() $whoops->handleException($e), $e->getStatusCode(), $e->getHeaders()
); );
} }
} }

View File

@@ -3,47 +3,47 @@
namespace App\Http\Controllers\Admin\helpdesk; namespace App\Http\Controllers\Admin\helpdesk;
// controller // controller
use App\Http\Controllers\Controller;
use App\Http\Controllers\Common\SettingsController;
use App\Http\Controllers\Common\PhpMailController; use App\Http\Controllers\Common\PhpMailController;
use App\Http\Controllers\Common\SettingsController;
use App\Http\Controllers\Controller;
// request // request
use App\Http\Requests\helpdesk\AgentRequest; use App\Http\Requests\helpdesk\AgentRequest;
use App\Http\Requests\helpdesk\AgentUpdate; use App\Http\Requests\helpdesk\AgentUpdate;
// model // model
use App\User;
use App\Model\helpdesk\Agent\Assign_team_agent; use App\Model\helpdesk\Agent\Assign_team_agent;
use App\Model\helpdesk\Agent\Department; use App\Model\helpdesk\Agent\Department;
use App\Model\helpdesk\Agent\Groups; use App\Model\helpdesk\Agent\Groups;
use App\Model\helpdesk\Agent\Teams; use App\Model\helpdesk\Agent\Teams;
use App\Model\helpdesk\Utility\Timezones; use App\Model\helpdesk\Email\Emails;
use App\Model\helpdesk\Settings\Company; use App\Model\helpdesk\Settings\Company;
use App\Model\helpdesk\Settings\Email; use App\Model\helpdesk\Settings\Email;
use App\Model\helpdesk\Email\Emails; use App\Model\helpdesk\Utility\Timezones;
use App\User;
// classes // classes
use DB; use DB;
use Mail;
use Hash;
use Exception; use Exception;
use Hash;
use Mail;
/** /**
* AgentController * AgentController
* This controller is used to CRUD category * This controller is used to CRUD category.
* *
* @package Controllers
* @subpackage Controller
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class AgentController extends Controller { class AgentController extends Controller
{
/** /**
* Create a new controller instance. * Create a new controller instance.
* constructor to check * constructor to check
* 1. authentication * 1. authentication
* 2. user roles * 2. user roles
* 3. roles must be agent * 3. roles must be agent.
*
* @return void * @return void
*/ */
public function __construct(PhpMailController $PhpMailController) { public function __construct(PhpMailController $PhpMailController)
{
$this->PhpMailController = $PhpMailController; $this->PhpMailController = $PhpMailController;
SettingsController::smtp(); SettingsController::smtp();
// checking authentication // checking authentication
@@ -53,11 +53,14 @@ class AgentController extends Controller {
} }
/** /**
* Get all agent list page * Get all agent list page.
*
* @param type User $user * @param type User $user
*
* @return type Response * @return type Response
*/ */
public function index() { public function index()
{
try { try {
return view('themes.default1.admin.helpdesk.agent.agents.index'); return view('themes.default1.admin.helpdesk.agent.agents.index');
} catch (Exception $e) { } catch (Exception $e) {
@@ -66,21 +69,25 @@ class AgentController extends Controller {
} }
/** /**
* creating a new agent * creating a new agent.
*
* @param type Assign_team_agent $team_assign_agent * @param type Assign_team_agent $team_assign_agent
* @param type Timezones $timezone * @param type Timezones $timezone
* @param type Groups $group * @param type Groups $group
* @param type Department $department * @param type Department $department
* @param type Teams $team * @param type Teams $team
*
* @return type view * @return type view
*/ */
public function create(Assign_team_agent $team_assign_agent, Timezones $timezone, Groups $group, Department $department, Teams $team) { public function create(Assign_team_agent $team_assign_agent, Timezones $timezone, Groups $group, Department $department, Teams $team)
{
try { try {
$team = $team->get(); $team = $team->get();
$timezones = $timezone->get(); $timezones = $timezone->get();
$groups = $group->get(); $groups = $group->get();
$departments = $department->get(); $departments = $department->get();
$teams = $team->lists('id', 'name'); $teams = $team->lists('id', 'name');
return view('themes.default1.admin.helpdesk.agent.agents.create', compact('assign', 'teams', 'agents', 'timezones', 'groups', 'departments', 'team')); return view('themes.default1.admin.helpdesk.agent.agents.create', compact('assign', 'teams', 'agents', 'timezones', 'groups', 'departments', 'team'));
} catch (Exception $e) { } catch (Exception $e) {
return redirect()->back()->with('fails', $e->errorInfo[2]); return redirect()->back()->with('fails', $e->errorInfo[2]);
@@ -88,13 +95,16 @@ class AgentController extends Controller {
} }
/** /**
* store a new agent * store a new agent.
* @param type User $user *
* @param type AgentRequest $request * @param type User $user
* @param type AgentRequest $request
* @param type Assign_team_agent $team_assign_agent * @param type Assign_team_agent $team_assign_agent
*
* @return type Response * @return type Response
*/ */
public function store(User $user, AgentRequest $request, Assign_team_agent $team_assign_agent) { public function store(User $user, AgentRequest $request, Assign_team_agent $team_assign_agent)
{
// dd($this->system_mail()); // dd($this->system_mail());
@@ -120,6 +130,7 @@ class AgentController extends Controller {
} catch (Exception $e) { } catch (Exception $e) {
return redirect('agents')->with('fails', 'Some error occured while sending mail to the agent. Please check email settings and try again'); return redirect('agents')->with('fails', 'Some error occured while sending mail to the agent. Please check email settings and try again');
} }
return redirect('agents')->with('success', 'Agent Created sucessfully'); return redirect('agents')->with('success', 'Agent Created sucessfully');
} else { } else {
return redirect('agents')->with('fails', 'Agent can not Create'); return redirect('agents')->with('fails', 'Agent can not Create');
@@ -127,17 +138,20 @@ class AgentController extends Controller {
} }
/** /**
* Editing a selected agent * Editing a selected agent.
* @param type int $id *
* @param type User $user * @param type int $id
* @param type User $user
* @param type Assign_team_agent $team_assign_agent * @param type Assign_team_agent $team_assign_agent
* @param type Timezones $timezone * @param type Timezones $timezone
* @param type Groups $group * @param type Groups $group
* @param type Department $department * @param type Department $department
* @param type Teams $team * @param type Teams $team
*
* @return type Response * @return type Response
*/ */
public function edit($id, User $user, Assign_team_agent $team_assign_agent, Timezones $timezone, Groups $group, Department $department, Teams $team) { public function edit($id, User $user, Assign_team_agent $team_assign_agent, Timezones $timezone, Groups $group, Department $department, Teams $team)
{
try { try {
$user = $user->whereId($id)->first(); $user = $user->whereId($id)->first();
$team = $team->get(); $team = $team->get();
@@ -148,6 +162,7 @@ class AgentController extends Controller {
$table = $team_assign_agent->where('agent_id', $id)->first(); $table = $team_assign_agent->where('agent_id', $id)->first();
$teams = $team->lists('id', 'name'); $teams = $team->lists('id', 'name');
$assign = $team_assign_agent->where('agent_id', $id)->lists('team_id'); $assign = $team_assign_agent->where('agent_id', $id)->lists('team_id');
return view('themes.default1.admin.helpdesk.agent.agents.edit', compact('teams', 'assign', 'table', 'teams1', 'selectedTeams', 'user', 'timezones', 'groups', 'departments', 'team', 'exp', 'counted')); return view('themes.default1.admin.helpdesk.agent.agents.edit', compact('teams', 'assign', 'table', 'teams1', 'selectedTeams', 'user', 'timezones', 'groups', 'departments', 'team', 'exp', 'counted'));
} catch (Exception $e) { } catch (Exception $e) {
return redirect('agents')->with('fail', 'No such file'); return redirect('agents')->with('fail', 'No such file');
@@ -156,13 +171,16 @@ class AgentController extends Controller {
/** /**
* Update the specified agent in storage. * Update the specified agent in storage.
* @param type int $id *
* @param type User $user * @param type int $id
* @param type AgentUpdate $request * @param type User $user
* @param type AgentUpdate $request
* @param type Assign_team_agent $team_assign_agent * @param type Assign_team_agent $team_assign_agent
*
* @return type Response * @return type Response
*/ */
public function update($id, User $user, AgentUpdate $request, Assign_team_agent $team_assign_agent) { public function update($id, User $user, AgentUpdate $request, Assign_team_agent $team_assign_agent)
{
// storing all the details // storing all the details
$user = $user->whereId($id)->first(); $user = $user->whereId($id)->first();
@@ -181,20 +199,24 @@ class AgentController extends Controller {
//Todo For success and failure conditions //Todo For success and failure conditions
try { try {
$user->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'); return redirect('agents')->with('success', 'Agent Updated sucessfully');
} catch (Exception $e) { } catch (Exception $e) {
return redirect('agents')->with('fails', 'Agent did not update' . '<li>' . $e->errorInfo[2] . '</li>'); return redirect('agents')->with('fails', 'Agent did not update'.'<li>'.$e->errorInfo[2].'</li>');
} }
} }
/** /**
* Remove the specified agent from storage. * Remove the specified agent from storage.
* @param type int $id *
* @param type User $user * @param type int $id
* @param type User $user
* @param type Assign_team_agent $team_assign_agent * @param type Assign_team_agent $team_assign_agent
*
* @return type Response * @return type Response
*/ */
public function destroy($id, User $user, Assign_team_agent $team_assign_agent) { public function destroy($id, User $user, Assign_team_agent $team_assign_agent)
{
/* Becouse of foreign key we delete team_assign_agent first */ /* Becouse of foreign key we delete team_assign_agent first */
error_reporting(E_ALL & ~E_NOTICE); error_reporting(E_ALL & ~E_NOTICE);
$team_assign_agent = $team_assign_agent->where('agent_id', $id); $team_assign_agent = $team_assign_agent->where('agent_id', $id);
@@ -205,43 +227,52 @@ class AgentController extends Controller {
$user->id; $user->id;
$user->delete(); $user->delete();
throw new \Exception($error); throw new \Exception($error);
return redirect('agents')->with('success', 'Agent Deleted sucessfully'); return redirect('agents')->with('success', 'Agent Deleted sucessfully');
} catch (\Exception $e) { } catch (\Exception $e) {
dd($e->errorInfo); dd($e->errorInfo);
return redirect('agents')->with('fails', $error); return redirect('agents')->with('fails', $error);
} }
} }
/** /**
* Generate a random string for password * Generate a random string for password.
*
* @param type $length * @param type $length
*
* @return type string * @return type string
*/ */
public function generateRandomString($length = 10) { public function generateRandomString($length = 10)
{
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$charactersLength = strlen($characters); $charactersLength = strlen($characters);
$randomString = ''; $randomString = '';
for ($i = 0; $i < $length; $i++) { for ($i = 0; $i < $length; $i++) {
$randomString .= $characters[rand(0, $charactersLength - 1)]; $randomString .= $characters[rand(0, $charactersLength - 1)];
} }
return $randomString; return $randomString;
} }
/** /**
* Fetching comapny name to send mail * Fetching comapny name to send mail.
*
* @return type * @return type
*/ */
public function company() { public function company()
{
$company = Company::Where('id', '=', '1')->first(); $company = Company::Where('id', '=', '1')->first();
if ($company->company_name == null) { if ($company->company_name == null) {
$company = "Support Center"; $company = 'Support Center';
} else { } else {
$company = $company->company_name; $company = $company->company_name;
} }
return $company; return $company;
} }
/** /*
* System default email * System default email
*/ */
// public function system_mail() { // public function system_mail() {

View File

@@ -8,29 +8,30 @@ use App\Http\Controllers\Controller;
use App\Http\Requests\helpdesk\BanlistRequest; use App\Http\Requests\helpdesk\BanlistRequest;
use App\Http\Requests\helpdesk\BanRequest; use App\Http\Requests\helpdesk\BanRequest;
// model // model
use App\User;
use App\Model\helpdesk\Email\Banlist; use App\Model\helpdesk\Email\Banlist;
use App\User;
//classes //classes
use Exception; use Exception;
/** /**
* BanlistController * BanlistController
* In this controller in the CRUD function for all the banned emails * In this controller in the CRUD function for all the banned emails.
* @package Controllers *
* @subpackage Controller
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class BanlistController extends Controller { class BanlistController extends Controller
{
/** /**
* Create a new controller instance. * Create a new controller instance.
* constructor to check * constructor to check
* 1. authentication * 1. authentication
* 2. user roles * 2. user roles
* 3. roles must be agent * 3. roles must be agent.
*
* @return void * @return void
*/ */
public function __construct() { public function __construct()
{
// checking authentication // checking authentication
$this->middleware('auth'); $this->middleware('auth');
// checking admin roles // checking admin roles
@@ -39,12 +40,16 @@ class BanlistController extends Controller {
/** /**
* Display a listing of the resource. * Display a listing of the resource.
*
* @param type Banlist $ban * @param type Banlist $ban
*
* @return type Response * @return type Response
*/ */
public function index() { public function index()
{
try { try {
$bans = User::where('ban', '=', 1)->get(); $bans = User::where('ban', '=', 1)->get();
return view('themes.default1.admin.helpdesk.emails.banlist.index', compact('bans')); return view('themes.default1.admin.helpdesk.emails.banlist.index', compact('bans'));
} catch (Exception $e) { } catch (Exception $e) {
return view('404'); return view('404');
@@ -53,9 +58,11 @@ class BanlistController extends Controller {
/** /**
* Show the form for creating a new resource. * Show the form for creating a new resource.
*
* @return type Response * @return type Response
*/ */
public function create() { public function create()
{
try { try {
return view('themes.default1.admin.helpdesk.emails.banlist.create'); return view('themes.default1.admin.helpdesk.emails.banlist.create');
} catch (Exception $e) { } catch (Exception $e) {
@@ -65,12 +72,15 @@ class BanlistController extends Controller {
/** /**
* Store a newly created resource in storage. * Store a newly created resource in storage.
* @param type banlist $ban *
* @param type banlist $ban
* @param type BanRequest $request * @param type BanRequest $request
* @param type User $user * @param type User $user
*
* @return type Response * @return type Response
*/ */
public function store(BanRequest $request, User $user) { public function store(BanRequest $request, User $user)
{
// dd($request); // dd($request);
try { try {
//adding field to user whether it is banned or not //adding field to user whether it is banned or not
@@ -83,11 +93,12 @@ class BanlistController extends Controller {
// $user->create($request->input())->save(); // $user->create($request->input())->save();
return redirect('banlist')->with('success', 'Email Banned sucessfully'); return redirect('banlist')->with('success', 'Email Banned sucessfully');
} else { } else {
$user = new User; $user = new User();
$user->email = $adban; $user->email = $adban;
$user->ban = $request->input('ban'); $user->ban = $request->input('ban');
$user->internal_note = $request->input('internal_note'); $user->internal_note = $request->input('internal_note');
$user->save(); $user->save();
return redirect('banlist')->with('success', 'Email Banned sucessfully'); return redirect('banlist')->with('success', 'Email Banned sucessfully');
} }
} catch (Exception $e) { } catch (Exception $e) {
@@ -98,22 +109,28 @@ class BanlistController extends Controller {
/** /**
* Display the specified resource. * Display the specified resource.
* *
* @param int $id * @param int $id
*
* @return Response * @return Response
*/ */
public function show($id) { public function show($id)
{
// //
} }
/** /**
* Show the form for editing the specified resource. * Show the form for editing the specified resource.
* @param type int $id *
* @param type int $id
* @param type Banlist $ban * @param type Banlist $ban
*
* @return type Response * @return type Response
*/ */
public function edit($id, User $ban) { public function edit($id, User $ban)
{
try { try {
$bans = $ban->whereId($id)->first(); $bans = $ban->whereId($id)->first();
return view('themes.default1.admin.helpdesk.emails.banlist.edit', compact('bans')); return view('themes.default1.admin.helpdesk.emails.banlist.edit', compact('bans'));
} catch (Exception $e) { } catch (Exception $e) {
return view('404'); return view('404');
@@ -122,12 +139,15 @@ class BanlistController extends Controller {
/** /**
* Update the specified resource in storage. * Update the specified resource in storage.
* @param type int $id *
* @param type Banlist $ban * @param type int $id
* @param type Banlist $ban
* @param type BanlistRequest $request * @param type BanlistRequest $request
*
* @return type Response * @return type Response
*/ */
public function update($id, User $ban, BanlistRequest $request) { public function update($id, User $ban, BanlistRequest $request)
{
try { try {
$bans = $ban->whereId($id)->first(); $bans = $ban->whereId($id)->first();
$bans->internal_note = $request->input('internal_note'); $bans->internal_note = $request->input('internal_note');
@@ -143,7 +163,7 @@ class BanlistController extends Controller {
} }
} }
/** /*
* Remove the specified resource from storage. * Remove the specified resource from storage.
* @param type int $id * @param type int $id
* @param type Banlist $ban * @param type Banlist $ban

View File

@@ -9,46 +9,50 @@ use App\Http\Requests\helpdesk\DepartmentRequest;
use App\Http\Requests\helpdesk\DepartmentUpdate; use App\Http\Requests\helpdesk\DepartmentUpdate;
// model // model
use App\Model\helpdesk\Agent\Department; use App\Model\helpdesk\Agent\Department;
use App\Model\helpdesk\Agent\Groups;
use App\Model\helpdesk\Agent\Group_assign_department; use App\Model\helpdesk\Agent\Group_assign_department;
use App\Model\helpdesk\Agent\Groups;
use App\Model\helpdesk\Agent\Teams; use App\Model\helpdesk\Agent\Teams;
use App\Model\helpdesk\Email\Emails; use App\Model\helpdesk\Email\Emails;
use App\Model\helpdesk\Email\Template; use App\Model\helpdesk\Email\Template;
use App\Model\helpdesk\Manage\Help_topic;
use App\Model\helpdesk\Manage\Sla_plan; use App\Model\helpdesk\Manage\Sla_plan;
use App\Model\helpdesk\Settings\System; use App\Model\helpdesk\Settings\System;
use App\Model\helpdesk\Ticket\Tickets; use App\Model\helpdesk\Ticket\Tickets;
use App\Model\helpdesk\Manage\Help_topic;
use App\User; use App\User;
// classes // classes
use DB; use DB;
use Exception; use Exception;
/** /**
* DepartmentController * DepartmentController.
* *
* @package Controllers
* @subpackage Controller
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class DepartmentController extends Controller { class DepartmentController extends Controller
{
/** /**
* Create a new controller instance. * Create a new controller instance.
*
* @return void * @return void
*/ */
public function __construct() { public function __construct()
{
$this->middleware('auth'); $this->middleware('auth');
$this->middleware('roles'); $this->middleware('roles');
} }
/** /**
* Get index page * Get index page.
*
* @param type Department $department * @param type Department $department
*
* @return type Response * @return type Response
*/ */
public function index(Department $department) { public function index(Department $department)
{
try { try {
$departments = $department->get(); $departments = $department->get();
return view('themes.default1.admin.helpdesk.agent.departments.index', compact('departments')); return view('themes.default1.admin.helpdesk.agent.departments.index', compact('departments'));
} catch (Exception $e) { } catch (Exception $e) {
return view('404'); return view('404');
@@ -57,16 +61,19 @@ class DepartmentController extends Controller {
/** /**
* Show the form for creating a new resource. * Show the form for creating a new resource.
* @param type User $user *
* @param type User $user
* @param type Group_assign_department $group_assign_department * @param type Group_assign_department $group_assign_department
* @param type Department $department * @param type Department $department
* @param type Sla_plan $sla * @param type Sla_plan $sla
* @param type Template $template * @param type Template $template
* @param type Emails $email * @param type Emails $email
* @param type Groups $group * @param type Groups $group
*
* @return type Response * @return type Response
*/ */
public function create(User $user, Group_assign_department $group_assign_department, Department $department, Sla_plan $sla, Template $template, Emails $email, Groups $group) { public function create(User $user, Group_assign_department $group_assign_department, Department $department, Sla_plan $sla, Template $template, Emails $email, Groups $group)
{
try { try {
$slas = $sla->get(); $slas = $sla->get();
$user = $user->where('role', 'agent')->get(); $user = $user->where('role', 'agent')->get();
@@ -74,6 +81,7 @@ class DepartmentController extends Controller {
$templates = $template->get(); $templates = $template->get();
$department = $department->get(); $department = $department->get();
$groups = $group->lists('id', 'name'); $groups = $group->lists('id', 'name');
return view('themes.default1.admin.helpdesk.agent.departments.create', compact('department', 'templates', 'slas', 'user', 'emails', 'groups')); return view('themes.default1.admin.helpdesk.agent.departments.create', compact('department', 'templates', 'slas', 'user', 'emails', 'groups'));
} catch (Exception $e) { } catch (Exception $e) {
return view('404'); return view('404');
@@ -82,11 +90,14 @@ class DepartmentController extends Controller {
/** /**
* Store a newly created resource in storage. * Store a newly created resource in storage.
* @param type Department $department *
* @param type Department $department
* @param type DepartmentRequest $request * @param type DepartmentRequest $request
*
* @return type Response * @return type Response
*/ */
public function store(Department $department, DepartmentRequest $request) { public function store(Department $department, DepartmentRequest $request)
{
try { try {
$department->fill($request->except('group_id', 'manager'))->save(); $department->fill($request->except('group_id', 'manager'))->save();
$requests = $request->input('group_id'); $requests = $request->input('group_id');
@@ -113,18 +124,21 @@ class DepartmentController extends Controller {
/** /**
* Show the form for editing the specified resource. * Show the form for editing the specified resource.
* @param type int $id *
* @param type User $user * @param type int $id
* @param type User $user
* @param type Group_assign_department $group_assign_department * @param type Group_assign_department $group_assign_department
* @param type Template $template * @param type Template $template
* @param type Teams $team * @param type Teams $team
* @param type Department $department * @param type Department $department
* @param type Sla_plan $sla * @param type Sla_plan $sla
* @param type Emails $email * @param type Emails $email
* @param type Groups $group * @param type Groups $group
*
* @return type Response * @return type Response
*/ */
public function edit($id, User $user, Group_assign_department $group_assign_department, Template $template, Teams $team, Department $department, Sla_plan $sla, Emails $email, Groups $group) { 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 { try {
$slas = $sla->get(); $slas = $sla->get();
$user = $user->where('role', 'agent')->get(); $user = $user->where('role', 'agent')->get();
@@ -133,6 +147,7 @@ class DepartmentController extends Controller {
$departments = $department->whereId($id)->first(); $departments = $department->whereId($id)->first();
$groups = $group->lists('id', 'name'); $groups = $group->lists('id', 'name');
$assign = $group_assign_department->where('department_id', $id)->lists('group_id'); $assign = $group_assign_department->where('department_id', $id)->lists('group_id');
return view('themes.default1.admin.helpdesk.agent.departments.edit', compact('assign', 'team', 'templates', 'departments', 'slas', 'user', 'emails', 'groups')); return view('themes.default1.admin.helpdesk.agent.departments.edit', compact('assign', 'team', 'templates', 'departments', 'slas', 'user', 'emails', 'groups'));
} catch (Exception $e) { } catch (Exception $e) {
return view('404'); return view('404');
@@ -141,13 +156,16 @@ class DepartmentController extends Controller {
/** /**
* Update the specified resource in storage. * Update the specified resource in storage.
* @param type int $id *
* @param type int $id
* @param type Group_assign_department $group_assign_department * @param type Group_assign_department $group_assign_department
* @param type Department $department * @param type Department $department
* @param type DepartmentUpdate $request * @param type DepartmentUpdate $request
*
* @return type Response * @return type Response
*/ */
public function update($id, Group_assign_department $group_assign_department, Department $department, DepartmentUpdate $request) { public function update($id, Group_assign_department $group_assign_department, Department $department, DepartmentUpdate $request)
{
// dd($id); // dd($id);
try { try {
$table = $group_assign_department->where('department_id', $id); $table = $group_assign_department->where('department_id', $id);
@@ -177,12 +195,15 @@ class DepartmentController extends Controller {
/** /**
* Remove the specified resource from storage. * Remove the specified resource from storage.
* @param type int $id *
* @param type Department $department * @param type int $id
* @param type Department $department
* @param type Group_assign_department $group_assign_department * @param type Group_assign_department $group_assign_department
*
* @return type Response * @return type Response
*/ */
public function destroy($id, Department $department, Group_assign_department $group_assign_department, System $system, Tickets $tickets) { public function destroy($id, Department $department, Group_assign_department $group_assign_department, System $system, Tickets $tickets)
{
// try { // try {
$system = $system->where('id', '=', '1')->first(); $system = $system->where('id', '=', '1')->first();
if ($system->department == $id) { if ($system->department == $id) {
@@ -191,54 +212,53 @@ class DepartmentController extends Controller {
$tickets = DB::table('tickets')->where('dept_id', '=', $id)->update(['dept_id' => $system->department]); $tickets = DB::table('tickets')->where('dept_id', '=', $id)->update(['dept_id' => $system->department]);
if ($tickets > 0) { if ($tickets > 0) {
if ($tickets > 1) { if ($tickets > 1) {
$text_tickets = "Tickets"; $text_tickets = 'Tickets';
} else { } else {
$text_tickets = "Ticket"; $text_tickets = 'Ticket';
} }
$ticket = '<li>' . $tickets . ' ' . $text_tickets . ' have been moved to default department</li>'; $ticket = '<li>'.$tickets.' '.$text_tickets.' have been moved to default department</li>';
} else { } else {
$ticket = ""; $ticket = '';
} }
$users = DB::table('users')->where('primary_dpt', '=', $id)->update(['primary_dpt' => $system->department]); $users = DB::table('users')->where('primary_dpt', '=', $id)->update(['primary_dpt' => $system->department]);
if ($users > 0) { if ($users > 0) {
if ($users > 1) { if ($users > 1) {
$text_user = "Users"; $text_user = 'Users';
} else { } else {
$text_user = "User"; $text_user = 'User';
} }
$user = '<li>' . $users . ' ' . $text_user . ' have been moved to default department</li>'; $user = '<li>'.$users.' '.$text_user.' have been moved to default department</li>';
} else { } else {
$user = ""; $user = '';
} }
$emails = DB::table('emails')->where('department', '=', $id)->update(['department' => $system->department]); $emails = DB::table('emails')->where('department', '=', $id)->update(['department' => $system->department]);
if ($emails > 0) { if ($emails > 0) {
if ($emails > 1) { if ($emails > 1) {
$text_emails = "Emails"; $text_emails = 'Emails';
} else { } else {
$text_emails = "Email"; $text_emails = 'Email';
} }
$email = '<li>' . $emails . ' System ' . $text_emails . ' have been moved to default department</li>'; $email = '<li>'.$emails.' System '.$text_emails.' have been moved to default department</li>';
} else { } else {
$email = ""; $email = '';
} }
$helptopic = DB::table('help_topic')->where('department', '=', $id)->update(['department' => null], ['status' => '1']); $helptopic = DB::table('help_topic')->where('department', '=', $id)->update(['department' => null], ['status' => '1']);
if ($helptopic > 0) { if ($helptopic > 0) {
$helptopic = '<li>The associated helptopic has been deactivated</li>'; $helptopic = '<li>The associated helptopic has been deactivated</li>';
} else { } else {
$helptopic = ""; $helptopic = '';
} }
$message = $ticket . $user . $email . $helptopic; $message = $ticket.$user.$email.$helptopic;
/* Becouse of foreign key we delete group_assign_department first */ /* Becouse of foreign key we delete group_assign_department first */
$group_assign_department = $group_assign_department->where('department_id', $id); $group_assign_department = $group_assign_department->where('department_id', $id);
$group_assign_department->delete(); $group_assign_department->delete();
$departments = $department->whereId($id)->first(); $departments = $department->whereId($id)->first();
/* Check the function is Success or Fail */ /* Check the function is Success or Fail */
if ($departments->delete() == true) { if ($departments->delete() == true) {
return redirect('departments')->with('success', 'Department Deleted sucessfully' . $message); return redirect('departments')->with('success', 'Department Deleted sucessfully'.$message);
} else { } else {
return redirect('departments')->with('fails', 'Department can not Delete'); return redirect('departments')->with('fails', 'Department can not Delete');
} }
} }
} }
} }

View File

@@ -11,39 +11,43 @@ use App\Http\Requests\helpdesk\EmailsRequest;
use App\Model\helpdesk\Agent\Department; use App\Model\helpdesk\Agent\Department;
use App\Model\helpdesk\Email\Emails; use App\Model\helpdesk\Email\Emails;
use App\Model\helpdesk\Manage\Help_topic; use App\Model\helpdesk\Manage\Help_topic;
use App\Model\helpdesk\Utility\MailboxProtocol;
use App\Model\helpdesk\Ticket\Ticket_Priority;
use App\Model\helpdesk\Settings\Email; use App\Model\helpdesk\Settings\Email;
use App\Model\helpdesk\Ticket\Ticket_Priority;
use App\Model\helpdesk\Utility\MailboxProtocol;
// classes // classes
use Crypt; use Crypt;
use Exception; use Exception;
/** /**
* EmailsController * EmailsController.
* *
* @package Controllers
* @subpackage Controller
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class EmailsController extends Controller { class EmailsController extends Controller
{
/** /**
* Create a new controller instance. * Create a new controller instance.
*
* @return type * @return type
*/ */
public function __construct() { public function __construct()
{
$this->middleware('auth'); $this->middleware('auth');
$this->middleware('roles'); $this->middleware('roles');
} }
/** /**
* Display a listing of the resource. * Display a listing of the resource.
*
* @param type Emails $emails * @param type Emails $emails
*
* @return type Response * @return type Response
*/ */
public function index(Emails $emails) { public function index(Emails $emails)
{
try { try {
$emails = $emails->get(); $emails = $emails->get();
return view('themes.default1.admin.helpdesk.emails.emails.index', compact('emails')); return view('themes.default1.admin.helpdesk.emails.emails.index', compact('emails'));
} catch (Exception $e) { } catch (Exception $e) {
return view('404'); return view('404');
@@ -52,18 +56,22 @@ class EmailsController extends Controller {
/** /**
* Show the form for creating a new resource. * Show the form for creating a new resource.
* @param type Department $department *
* @param type Help_topic $help * @param type Department $department
* @param type Priority $priority * @param type Help_topic $help
* @param type Priority $priority
* @param type MailboxProtocol $mailbox_protocol * @param type MailboxProtocol $mailbox_protocol
*
* @return type Response * @return type Response
*/ */
public function create(Department $department, Help_topic $help, Ticket_Priority $priority, MailboxProtocol $mailbox_protocol) { public function create(Department $department, Help_topic $help, Ticket_Priority $priority, MailboxProtocol $mailbox_protocol)
{
try { try {
$departments = $department->get(); $departments = $department->get();
$helps = $help->get(); $helps = $help->get();
$priority = $priority->get(); $priority = $priority->get();
$mailbox_protocols = $mailbox_protocol->get(); $mailbox_protocols = $mailbox_protocol->get();
return view('themes.default1.admin.helpdesk.emails.emails.create', compact('mailbox_protocols', 'priority', 'departments', 'helps')); return view('themes.default1.admin.helpdesk.emails.emails.create', compact('mailbox_protocols', 'priority', 'departments', 'helps'));
} catch (Exception $e) { } catch (Exception $e) {
return view('404'); return view('404');
@@ -72,11 +80,14 @@ class EmailsController extends Controller {
/** /**
* Store a newly created resource in storage. * Store a newly created resource in storage.
* @param type Emails $email *
* @param type Emails $email
* @param type EmailsRequest $request * @param type EmailsRequest $request
*
* @return type Response * @return type Response
*/ */
public function store(Emails $email, EmailsRequest $request) { public function store(Emails $email, EmailsRequest $request)
{
try { try {
$password = $request->input('password'); $password = $request->input('password');
$encrypted = Crypt::encrypt($password); $encrypted = Crypt::encrypt($password);
@@ -115,30 +126,36 @@ class EmailsController extends Controller {
/** /**
* Display the specified resource. * Display the specified resource.
* *
* @param int $id * @param int $id
*
* @return Response * @return Response
*/ */
public function show($id) { public function show($id)
{
// //
} }
/** /**
* Show the form for editing the specified resource. * Show the form for editing the specified resource.
* @param type int $id *
* @param type Department $department * @param type int $id
* @param type Help_topic $help * @param type Department $department
* @param type Emails $email * @param type Help_topic $help
* @param type Priority $priority * @param type Emails $email
* @param type Priority $priority
* @param type MailboxProtocol $mailbox_protocol * @param type MailboxProtocol $mailbox_protocol
*
* @return type Response * @return type Response
*/ */
public function edit($id, Department $department, Help_topic $help, Emails $email, Ticket_Priority $priority, MailboxProtocol $mailbox_protocol) { public function edit($id, Department $department, Help_topic $help, Emails $email, Ticket_Priority $priority, MailboxProtocol $mailbox_protocol)
{
try { try {
$emails = $email->whereId($id)->first(); $emails = $email->whereId($id)->first();
$departments = $department->get(); $departments = $department->get();
$helps = $help->get(); $helps = $help->get();
$priority = $priority->get(); $priority = $priority->get();
$mailbox_protocols = $mailbox_protocol->get(); $mailbox_protocols = $mailbox_protocol->get();
return view('themes.default1.admin.helpdesk.emails.emails.edit', compact('mailbox_protocols', 'priority', 'departments', 'helps', 'emails')); return view('themes.default1.admin.helpdesk.emails.emails.edit', compact('mailbox_protocols', 'priority', 'departments', 'helps', 'emails'));
} catch (Exception $e) { } catch (Exception $e) {
return view('404'); return view('404');
@@ -147,12 +164,15 @@ class EmailsController extends Controller {
/** /**
* Update the specified resource in storage. * Update the specified resource in storage.
* @param type $id *
* @param type Emails $email * @param type $id
* @param type Emails $email
* @param type EmailsEditRequest $request * @param type EmailsEditRequest $request
*
* @return type Response * @return type Response
*/ */
public function update($id, Emails $email, EmailsEditRequest $request) { public function update($id, Emails $email, EmailsEditRequest $request)
{
$password = $request->input('password'); $password = $request->input('password');
$encrypted = Crypt::encrypt($password); $encrypted = Crypt::encrypt($password);
//echo $encrypted; //echo $encrypted;
@@ -179,6 +199,7 @@ class EmailsController extends Controller {
} }
$emails->password = $encrypted; $emails->password = $encrypted;
$emails->save(); $emails->save();
return redirect('emails')->with('success', 'Email Updated sucessfully'); return redirect('emails')->with('success', 'Email Updated sucessfully');
} catch (Exception $e) { } catch (Exception $e) {
return redirect('emails')->with('fails', 'Email not updated'); return redirect('emails')->with('fails', 'Email not updated');
@@ -187,11 +208,14 @@ class EmailsController extends Controller {
/** /**
* Remove the specified resource from storage. * Remove the specified resource from storage.
* @param type int $id *
* @param type int $id
* @param type Emails $email * @param type Emails $email
*
* @return type Response * @return type Response
*/ */
public function destroy($id, Emails $email) { public function destroy($id, Emails $email)
{
$default_system_email = Email::where('id', '=', '1')->first(); $default_system_email = Email::where('id', '=', '1')->first();
if ($default_system_email->id) { if ($default_system_email->id) {
if ($id == $default_system_email->id) { if ($id == $default_system_email->id) {
@@ -209,5 +233,4 @@ class EmailsController extends Controller {
return redirect('emails')->with('fails', 'Email can not Delete '); return redirect('emails')->with('fails', 'Email can not Delete ');
} }
} }
} }

View File

@@ -13,58 +13,66 @@ use Illuminate\Http\Request;
// Class // Class
use Input; use Input;
use Redirect; use Redirect;
use Exception;
/** /**
* FormController * FormController
* This controller is used to CRUD Custom Forms * This controller is used to CRUD Custom Forms.
* *
* @package Controllers
* @subpackage Controller
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class FormController extends Controller { class FormController extends Controller
{
private $fields; private $fields;
private $forms; private $forms;
public function __construct(Fields $fields, Forms $forms) { public function __construct(Fields $fields, Forms $forms)
{
$this->fields = $fields; $this->fields = $fields;
$this->forms = $forms; $this->forms = $forms;
// $this->middleware('auth'); // $this->middleware('auth');
} }
/** /**
* home * home.
*
* @return type * @return type
*/ */
public function home() { public function home()
{
return view('forms.home'); return view('forms.home');
} }
/** /**
* list of forms * list of forms.
* @param type Forms $forms *
* @param type Forms $forms
*
* @return Response * @return Response
*/ */
public function index(Forms $forms) { public function index(Forms $forms)
{
return view('themes.default1.admin.helpdesk.manage.form.index', compact('forms')); return view('themes.default1.admin.helpdesk.manage.form.index', compact('forms'));
} }
/** /**
* Show the form for creating a new resource. * Show the form for creating a new resource.
*
* @return Response * @return Response
*/ */
public function create() { public function create()
{
return view('themes.default1.admin.helpdesk.manage.form.form'); return view('themes.default1.admin.helpdesk.manage.form.form');
} }
/** /**
* Display the specified resource. * Display the specified resource.
* @param int $id *
* @param int $id
*
* @return Response * @return Response
*/ */
public function show($id) { public function show($id)
{
return view('themes.default1.admin.helpdesk.manage.form.preview', compact('id')); return view('themes.default1.admin.helpdesk.manage.form.preview', compact('id'));
} }
@@ -73,13 +81,14 @@ class FormController extends Controller {
* *
* @return Response * @return Response
*/ */
public function store(Forms $forms) { public function store(Forms $forms)
{
if (!Input::get('formname')) { if (!Input::get('formname')) {
return Redirect::back()->with('fails', 'Please fill Form name'); return Redirect::back()->with('fails', 'Please fill Form name');
} }
$required = Input::get('required'); $required = Input::get('required');
$count = count($required); $count = count($required);
$require = array(); $require = [];
for ($i = 2; $i < $count + 2; $i++) { for ($i = 2; $i < $count + 2; $i++) {
for ($j = 0; $j < 1; $j++) { for ($j = 0; $j < 1; $j++) {
array_push($require, $required[$i][$j]); array_push($require, $required[$i][$j]);
@@ -88,24 +97,26 @@ class FormController extends Controller {
$forms->formname = Input::get('formname'); $forms->formname = Input::get('formname');
$forms->save(); $forms->save();
$count = count(Input::get('name')); $count = count(Input::get('name'));
$fields = array(); $fields = [];
for ($i = 0; $i <= $count; $i++) { for ($i = 0; $i <= $count; $i++) {
if (!empty(Input::get('name')[$i])) { if (!empty(Input::get('name')[$i])) {
array_push($fields, array( array_push($fields, [
'forms_id' => $forms->id, 'forms_id' => $forms->id,
'label' => Input::get('label')[$i], 'label' => Input::get('label')[$i],
'name' => Input::get('name')[$i], 'name' => Input::get('name')[$i],
'type' => Input::get('type')[$i], 'type' => Input::get('type')[$i],
'value' => Input::get('value')[$i], 'value' => Input::get('value')[$i],
'required' => $require[$i], 'required' => $require[$i],
)); ]);
} }
} }
Fields::insert($fields); Fields::insert($fields);
return Redirect::back()->with('success', 'Successfully created Form'); return Redirect::back()->with('success', 'Successfully created Form');
} }
public function delete($id, Forms $forms, Fields $field, Help_topic $help_topic) { public function delete($id, Forms $forms, Fields $field, Help_topic $help_topic)
{
$fields = $field->where('forms_id', $id)->get(); $fields = $field->where('forms_id', $id)->get();
$help_topics = $help_topic->where('custom_form', '=', $id)->get(); $help_topics = $help_topic->where('custom_form', '=', $id)->get();
foreach ($help_topics as $help_topic) { foreach ($help_topics as $help_topic) {
@@ -117,7 +128,7 @@ class FormController extends Controller {
} }
$forms = $forms->where('id', $id)->first(); $forms = $forms->where('id', $id)->first();
$forms->delete(); $forms->delete();
return redirect()->back()->with('success', 'Deleted Successfully'); return redirect()->back()->with('success', 'Deleted Successfully');
} }
} }

View File

@@ -6,45 +6,49 @@ namespace App\Http\Controllers\Admin\helpdesk;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
// requests // requests
use App\Http\Requests\helpdesk\GroupRequest; use App\Http\Requests\helpdesk\GroupRequest;
use Illuminate\Http\Request;
// models
use App\Model\helpdesk\Agent\Department; use App\Model\helpdesk\Agent\Department;
use App\Model\helpdesk\Agent\Groups; // models
use App\Model\helpdesk\Agent\Group_assign_department; use App\Model\helpdesk\Agent\Group_assign_department;
use App\Model\helpdesk\Agent\Groups;
use App\User; use App\User;
// classes
use Illuminate\Support\Facades\Input;
use Exception; use Exception;
// classes
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Input;
/** /**
* GroupController * GroupController.
* *
* @package Controllers
* @subpackage Controller
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class GroupController extends Controller { class GroupController extends Controller
{
/** /**
* Create a new controller instance. * Create a new controller instance.
*
* @return type void * @return type void
*/ */
public function __construct() { public function __construct()
{
$this->middleware('auth'); $this->middleware('auth');
$this->middleware('roles'); $this->middleware('roles');
} }
/** /**
* Display a listing of the resource. * Display a listing of the resource.
* @param type Groups $group *
* @param type Department $department * @param type Groups $group
* @param type Department $department
* @param type Group_assign_department $group_assign_department * @param type Group_assign_department $group_assign_department
*
* @return type Response * @return type Response
*/ */
public function index(Groups $group, Department $department, Group_assign_department $group_assign_department) { public function index(Groups $group, Department $department, Group_assign_department $group_assign_department)
{
try { try {
$groups = $group->get(); $groups = $group->get();
$departments = $department->lists('id'); $departments = $department->lists('id');
return view('themes.default1.admin.helpdesk.agent.groups.index', compact('departments', 'group_assign_department', 'groups')); return view('themes.default1.admin.helpdesk.agent.groups.index', compact('departments', 'group_assign_department', 'groups'));
} catch (Exception $e) { } catch (Exception $e) {
return view('404'); return view('404');
@@ -53,9 +57,11 @@ class GroupController extends Controller {
/** /**
* Show the form for creating a new resource. * Show the form for creating a new resource.
*
* @return type Response * @return type Response
*/ */
public function create() { public function create()
{
try { try {
return view('themes.default1.admin.helpdesk.agent.groups.create'); return view('themes.default1.admin.helpdesk.agent.groups.create');
} catch (Exception $e) { } catch (Exception $e) {
@@ -65,44 +71,55 @@ class GroupController extends Controller {
/** /**
* Store a newly created resource in storage. * Store a newly created resource in storage.
* @param type Groups $group *
* @param type Groups $group
* @param type GroupRequest $request * @param type GroupRequest $request
*
* @return type Response * @return type Response
*/ */
public function store(Groups $group, GroupRequest $request) { public function store(Groups $group, GroupRequest $request)
{
try { try {
/* Check Whether function success or not */ /* Check Whether function success or not */
$group->fill($request->input())->save(); $group->fill($request->input())->save();
return redirect('groups')->with('success', 'Group Created Successfully'); return redirect('groups')->with('success', 'Group Created Successfully');
} catch (Exception $e) { } catch (Exception $e) {
/* redirect to Index page with Fails Message */ /* redirect to Index page with Fails Message */
return redirect('groups')->with('fails', 'Groups can not Create' . '<li>' . $e->errorInfo[2] . '</li>'); return redirect('groups')->with('fails', 'Groups can not Create'.'<li>'.$e->errorInfo[2].'</li>');
} }
} }
/** /**
* Show the form for editing the specified resource. * Show the form for editing the specified resource.
* @param type int $id *
* @param type int $id
* @param type Groups $group * @param type Groups $group
*
* @return type Response * @return type Response
*/ */
public function edit($id, Groups $group) { public function edit($id, Groups $group)
{
try { try {
$groups = $group->whereId($id)->first(); $groups = $group->whereId($id)->first();
return view('themes.default1.admin.helpdesk.agent.groups.edit', compact('groups')); return view('themes.default1.admin.helpdesk.agent.groups.edit', compact('groups'));
} catch (Exception $e) { } catch (Exception $e) {
return redirect('groups')->with('fails', 'Groups can not Create' . '<li>' . $e->errorInfo[2] . '</li>'); return redirect('groups')->with('fails', 'Groups can not Create'.'<li>'.$e->errorInfo[2].'</li>');
} }
} }
/** /**
* Update the specified resource in storage. * Update the specified resource in storage.
* @param type int $id *
* @param type Groups $group * @param type int $id
* @param type Groups $group
* @param type Request $request * @param type Request $request
*
* @return type Response * @return type Response
*/ */
public function update($id, Groups $group, Request $request) { public function update($id, Groups $group, Request $request)
{
$var = $group->whereId($id)->first(); $var = $group->whereId($id)->first();
//Updating Status //Updating Status
$status = $request->Input('group_status'); $status = $request->Input('group_status');
@@ -153,22 +170,26 @@ class GroupController extends Controller {
return redirect('groups')->with('success', 'Group Updated Successfully'); return redirect('groups')->with('success', 'Group Updated Successfully');
} catch (Exception $e) { } catch (Exception $e) {
/* redirect to Index page with Fails Message */ /* redirect to Index page with Fails Message */
return redirect('groups')->with('fails', 'Groups can not Create' . '<li>' . $e->errorInfo[2] . '</li>'); return redirect('groups')->with('fails', 'Groups can not Create'.'<li>'.$e->errorInfo[2].'</li>');
} }
} }
/** /**
* Remove the specified resource from storage. * Remove the specified resource from storage.
* @param type int $id *
* @param type Groups $group * @param type int $id
* @param type Groups $group
* @param type Group_assign_department $group_assign_department * @param type Group_assign_department $group_assign_department
*
* @return type Response * @return type Response
*/ */
public function destroy($id, Groups $group, Group_assign_department $group_assign_department) { public function destroy($id, Groups $group, Group_assign_department $group_assign_department)
{
$users = User::where('assign_group', '=', $id)->first(); $users = User::where('assign_group', '=', $id)->first();
if ($users) { if ($users) {
$user = '<li>There are agents assigned to this group. Please unassign them from this group to delete</li>'; $user = '<li>There are agents assigned to this group. Please unassign them from this group to delete</li>';
return redirect('groups')->with('fails', 'Group cannot Delete ' . $user);
return redirect('groups')->with('fails', 'Group cannot Delete '.$user);
} }
$group_assign_department->where('group_id', $id)->delete(); $group_assign_department->where('group_id', $id)->delete();
$groups = $group->whereId($id)->first(); $groups = $group->whereId($id)->first();
@@ -179,8 +200,7 @@ class GroupController extends Controller {
return redirect('groups')->with('success', 'Group Deleted Successfully'); return redirect('groups')->with('success', 'Group Deleted Successfully');
} catch (Exception $e) { } catch (Exception $e) {
/* redirect to Index page with Fails Message */ /* redirect to Index page with Fails Message */
return redirect('groups')->with('fails', 'Groups cannot Create' . '<li>' . $e->errorInfo[2] . '</li>'); return redirect('groups')->with('fails', 'Groups cannot Create'.'<li>'.$e->errorInfo[2].'</li>');
} }
} }
} }

View File

@@ -13,39 +13,43 @@ use App\Model\helpdesk\Agent\Department;
use App\Model\helpdesk\Form\Forms; use App\Model\helpdesk\Form\Forms;
use App\Model\helpdesk\Manage\Help_topic; use App\Model\helpdesk\Manage\Help_topic;
use App\Model\helpdesk\Manage\Sla_plan; use App\Model\helpdesk\Manage\Sla_plan;
use App\Model\helpdesk\Ticket\Ticket_Priority;
use App\Model\helpdesk\Settings\Ticket; use App\Model\helpdesk\Settings\Ticket;
use App\Model\helpdesk\Ticket\Ticket_Priority;
use App\User; use App\User;
// classes // classes
use DB; use DB;
use Exception; use Exception;
/** /**
* HelptopicController * HelptopicController.
* *
* @package Controllers
* @subpackage Controller
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class HelptopicController extends Controller { class HelptopicController extends Controller
{
/** /**
* Create a new controller instance. * Create a new controller instance.
*
* @return type vodi * @return type vodi
*/ */
public function __construct() { public function __construct()
{
$this->middleware('auth'); $this->middleware('auth');
$this->middleware('roles'); $this->middleware('roles');
} }
/** /**
* Display a listing of the resource. * Display a listing of the resource.
*
* @param type Help_topic $topic * @param type Help_topic $topic
*
* @return type Response * @return type Response
*/ */
public function index(Help_topic $topic) { public function index(Help_topic $topic)
{
try { try {
$topics = $topic->get(); $topics = $topic->get();
return view('themes.default1.admin.helpdesk.manage.helptopic.index', compact('topics')); return view('themes.default1.admin.helpdesk.manage.helptopic.index', compact('topics'));
} catch (Exception $e) { } catch (Exception $e) {
return view('404'); return view('404');
@@ -54,12 +58,14 @@ class HelptopicController extends Controller {
/** /**
* Show the form for creating a new resource. * Show the form for creating a new resource.
* @param type Priority $priority *
* @param type Priority $priority
* @param type Department $department * @param type Department $department
* @param type Help_topic $topic * @param type Help_topic $topic
* @param type Form_name $form * @param type Form_name $form
* @param type Agents $agent * @param type Agents $agent
* @param type Sla_plan $sla * @param type Sla_plan $sla
*
* @return type Response * @return type Response
*/ */
/* /*
@@ -72,7 +78,8 @@ class HelptopicController extends Controller {
| 5.Forms Model | 5.Forms Model
================================================ ================================================
*/ */
public function create(Ticket_Priority $priority, Department $department, Help_topic $topic, Forms $form, User $agent, Sla_plan $sla) { public function create(Ticket_Priority $priority, Department $department, Help_topic $topic, Forms $form, User $agent, Sla_plan $sla)
{
try { try {
$departments = $department->get(); $departments = $department->get();
$topics = $topic->get(); $topics = $topic->get();
@@ -80,6 +87,7 @@ class HelptopicController extends Controller {
$agents = $agent->where('role', '=', 'agent')->get(); $agents = $agent->where('role', '=', 'agent')->get();
$slas = $sla->get(); $slas = $sla->get();
$priority = $priority->get(); $priority = $priority->get();
return view('themes.default1.admin.helpdesk.manage.helptopic.create', compact('priority', 'departments', 'topics', 'forms', 'agents', 'slas')); return view('themes.default1.admin.helpdesk.manage.helptopic.create', compact('priority', 'departments', 'topics', 'forms', 'agents', 'slas'));
} catch (Exception $e) { } catch (Exception $e) {
return view('404'); return view('404');
@@ -88,11 +96,14 @@ class HelptopicController extends Controller {
/** /**
* Store a newly created resource in storage. * Store a newly created resource in storage.
* @param type Help_topic $topic *
* @param type Help_topic $topic
* @param type HelptopicRequest $request * @param type HelptopicRequest $request
*
* @return type Response * @return type Response
*/ */
public function store(Help_topic $topic, HelptopicRequest $request) { public function store(Help_topic $topic, HelptopicRequest $request)
{
try { try {
if ($request->custom_form) { if ($request->custom_form) {
$custom_form = $request->custom_form; $custom_form = $request->custom_form;
@@ -111,22 +122,25 @@ class HelptopicController extends Controller {
return redirect('helptopic')->with('success', 'Helptopic Created Successfully'); return redirect('helptopic')->with('success', 'Helptopic Created Successfully');
} catch (Exception $e) { } catch (Exception $e) {
/* redirect to Index page with Fails Message */ /* redirect to Index page with Fails Message */
return redirect('helptopic')->with('fails', 'Helptopic can not Create' . '<li>' . $e->errorInfo[2] . '</li>'); return redirect('helptopic')->with('fails', 'Helptopic can not Create'.'<li>'.$e->errorInfo[2].'</li>');
} }
} }
/** /**
* Show the form for editing the specified resource. * Show the form for editing the specified resource.
* @param type $id *
* @param type Priority $priority * @param type $id
* @param type Priority $priority
* @param type Department $department * @param type Department $department
* @param type Help_topic $topic * @param type Help_topic $topic
* @param type Form_name $form * @param type Form_name $form
* @param type Agents $agent * @param type Agents $agent
* @param type Sla_plan $sla * @param type Sla_plan $sla
*
* @return type Response * @return type Response
*/ */
public function edit($id, Ticket_Priority $priority, Department $department, Help_topic $topic, Forms $form, Sla_plan $sla) { public function edit($id, Ticket_Priority $priority, Department $department, Help_topic $topic, Forms $form, Sla_plan $sla)
{
try { try {
$agents = User::where('role', '=', 'agent')->get(); $agents = User::where('role', '=', 'agent')->get();
$departments = $department->get(); $departments = $department->get();
@@ -134,20 +148,24 @@ class HelptopicController extends Controller {
$forms = $form->get(); $forms = $form->get();
$slas = $sla->get(); $slas = $sla->get();
$priority = $priority->get(); $priority = $priority->get();
return view('themes.default1.admin.helpdesk.manage.helptopic.edit', compact('priority', 'departments', 'topics', 'forms', 'agents', 'slas')); return view('themes.default1.admin.helpdesk.manage.helptopic.edit', compact('priority', 'departments', 'topics', 'forms', 'agents', 'slas'));
} catch (Exception $e) { } catch (Exception $e) {
return redirect('helptopic')->with('fails', '<li>' . $e->errorInfo[2] . '</li>'); return redirect('helptopic')->with('fails', '<li>'.$e->errorInfo[2].'</li>');
} }
} }
/** /**
* Update the specified resource in storage. * Update the specified resource in storage.
* @param type $id *
* @param type Help_topic $topic * @param type $id
* @param type Help_topic $topic
* @param type HelptopicUpdate $request * @param type HelptopicUpdate $request
*
* @return type Response * @return type Response
*/ */
public function update($id, Help_topic $topic, HelptopicUpdate $request) { public function update($id, Help_topic $topic, HelptopicUpdate $request)
{
// dd($request); // dd($request);
try { try {
$topics = $topic->whereId($id)->first(); $topics = $topic->whereId($id)->first();
@@ -170,61 +188,62 @@ class HelptopicController extends Controller {
return redirect('helptopic')->with('success', 'Helptopic Updated Successfully'); return redirect('helptopic')->with('success', 'Helptopic Updated Successfully');
} catch (Exception $e) { } catch (Exception $e) {
/* redirect to Index page with Fails Message */ /* redirect to Index page with Fails Message */
return redirect('helptopic')->with('fails', 'Helptopic can not Update' . '<li>' . $e->errorInfo[2] . '</li>'); return redirect('helptopic')->with('fails', 'Helptopic can not Update'.'<li>'.$e->errorInfo[2].'</li>');
} }
} }
/** /**
* Remove the specified resource from storage. * Remove the specified resource from storage.
* @param type int $id *
* @param type int $id
* @param type Help_topic $topic * @param type Help_topic $topic
*
* @return type Response * @return type Response
*/ */
public function destroy($id, Help_topic $topic, Ticket $ticket_setting) { public function destroy($id, Help_topic $topic, Ticket $ticket_setting)
{
$ticket_settings = $ticket_setting->where('id', '=', '1')->first(); $ticket_settings = $ticket_setting->where('id', '=', '1')->first();
if ($ticket_settings->help_topic == $id) { if ($ticket_settings->help_topic == $id) {
return redirect('departments')->with('fails', 'You cannot delete default department'); return redirect('departments')->with('fails', 'You cannot delete default department');
} else { } else {
$tickets = DB::table('tickets')->where('help_topic_id', '=', $id)->update(['help_topic_id' => $ticket_settings->help_topic]); $tickets = DB::table('tickets')->where('help_topic_id', '=', $id)->update(['help_topic_id' => $ticket_settings->help_topic]);
if ($tickets > 0) { if ($tickets > 0) {
if ($tickets > 1) { if ($tickets > 1) {
$text_tickets = "Tickets"; $text_tickets = 'Tickets';
} else { } else {
$text_tickets = "Ticket"; $text_tickets = 'Ticket';
} }
$ticket = '<li>' . $tickets . ' ' . $text_tickets . ' have been moved to default Help Topic</li>'; $ticket = '<li>'.$tickets.' '.$text_tickets.' have been moved to default Help Topic</li>';
} else { } else {
$ticket = ""; $ticket = '';
} }
$emails = DB::table('emails')->where('help_topic', '=', $id)->update(['help_topic' => $ticket_settings->help_topic]); $emails = DB::table('emails')->where('help_topic', '=', $id)->update(['help_topic' => $ticket_settings->help_topic]);
if ($emails > 0) { if ($emails > 0) {
if ($emails > 1) { if ($emails > 1) {
$text_emails = "Emails"; $text_emails = 'Emails';
} else { } else {
$text_emails = "Email"; $text_emails = 'Email';
} }
$email = '<li>' . $emails . ' System ' . $text_emails . ' have been moved to default Help Topic</li>'; $email = '<li>'.$emails.' System '.$text_emails.' have been moved to default Help Topic</li>';
} else { } else {
$email = ""; $email = '';
} }
$message = $ticket . $email; $message = $ticket.$email;
$topics = $topic->whereId($id)->first(); $topics = $topic->whereId($id)->first();
/* Check whether function success or not */ /* Check whether function success or not */
try { try {
$topics->delete(); $topics->delete();
/* redirect to Index page with Success Message */ /* redirect to Index page with Success Message */
return redirect('helptopic')->with('success', 'Helptopic Deleted Successfully' . $message); return redirect('helptopic')->with('success', 'Helptopic Deleted Successfully'.$message);
} catch (Exception $e) { } catch (Exception $e) {
/* redirect to Index page with Fails Message */ /* redirect to Index page with Fails Message */
return redirect('helptopic')->with('fails', 'Helptopic can not Delete' . '<li>' . $e->errorInfo[2] . '</li>'); return redirect('helptopic')->with('fails', 'Helptopic can not Delete'.'<li>'.$e->errorInfo[2].'</li>');
} }
} }
} }
} }

View File

@@ -10,17 +10,17 @@ namespace App\Http\Controllers\Admin\helpdesk;
* are authenticated. Of course, you are free to change or remove the * 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! * controller as you wish. It is just here to get your app started!
* *
* @package Controllers
* @subpackage Controller
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class HomeController extends Controller { class HomeController extends Controller
{
/** /**
* Create a new controller instance. * Create a new controller instance.
*
* @return void * @return void
*/ */
public function __construct() { public function __construct()
{
$this->middleware('auth'); $this->middleware('auth');
} }
@@ -29,8 +29,8 @@ class HomeController extends Controller {
* *
* @return Response * @return Response
*/ */
public function index() { public function index()
{
return view('themes/default1/admin/dashboard'); return view('themes/default1/admin/dashboard');
} }
} }

View File

@@ -3,55 +3,55 @@
namespace App\Http\Controllers\Admin\helpdesk; namespace App\Http\Controllers\Admin\helpdesk;
// controllers // controllers
use App\Http\Controllers\Controller; use App;
// requests // requests
use App\Http\Requests; use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
//supports //supports
use App\Http\Requests;
use Cache;
use Config;
//classes
use File;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Redirect; use Illuminate\Support\Facades\Redirect;
use Illuminate\Support\Facades\Session; use Illuminate\Support\Facades\Session;
use Illuminate\Support\Collection;
//classes
use Input; use Input;
use Config;
use Validator;
use Zipper;
use App;
use Lang; use Lang;
use Cache; use Validator;
use File;
use Exception;
/** /**
* SlaController * SlaController.
* *
* @package Controllers
* @subpackage Controller
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class LanguageController extends Controller { class LanguageController extends Controller
{
/** /**
* Create a new controller instance. * Create a new controller instance.
*
* @return type void * @return type void
*/ */
public function __construct() { public function __construct()
{
$this->middleware('auth'); $this->middleware('auth');
$this->middleware('roles'); $this->middleware('roles');
} }
/** /**
* Switch language at runtime * Switch language at runtime.
*
* @param type "" $lang * @param type "" $lang
*
* @return type response * @return type response
*/ */
public function switchLanguage($lang) { public function switchLanguage($lang)
{
//if(Cache::has('language')) //if(Cache::has('language'))
//{ //{
// return Cache::get('language'); // return Cache::get('language');
//} else return 'false'; //} else return 'false';
// Cache::put('language',$) // Cache::put('language',$)
$path = base_path('resources/lang'); // Path to check available language packages $path = base_path('resources/lang'); // Path to check available language packages
if (array_key_exists($lang, Config::get('languages')) && in_array($lang, scandir($path))) { if (array_key_exists($lang, Config::get('languages')) && in_array($lang, scandir($path))) {
// dd(array_key_exists($lang, Config::get('languages'))); // dd(array_key_exists($lang, Config::get('languages')));
// app()->setLocale($lang); // app()->setLocale($lang);
@@ -60,55 +60,63 @@ class LanguageController extends Controller {
// dd(Cache::get('language')); // dd(Cache::get('language'));
// dd() // dd()
} else { } else {
return Redirect::back()->with('fails', Lang::get("lang.language-error")); return Redirect::back()->with('fails', Lang::get('lang.language-error'));
} }
return Redirect::back(); return Redirect::back();
} }
/** /**
* Shows language page * Shows language page.
*
* @return type response * @return type response
*/ */
public function index() { public function index()
{
return view('themes.default1.admin.helpdesk.language.index'); return view('themes.default1.admin.helpdesk.language.index');
} }
/** /**
* Shows Language upload form * Shows Language upload form.
*
* @return type response * @return type response
*/ */
public function getForm() { public function getForm()
{
return view('themes.default1.admin.helpdesk.language.create'); return view('themes.default1.admin.helpdesk.language.create');
} }
/** /**
* Provide language datatable to language page * Provide language datatable to language page.
* @return type *
* @return type
*/ */
public function getLanguages() { public function getLanguages()
$path = base_path('resources/lang'); {
$path = base_path('resources/lang');
$values = scandir($path); //Extracts names of directories present in lang directory $values = scandir($path); //Extracts names of directories present in lang directory
$values = array_slice($values, 2); // skips array element $value[0] = '.' & $value[1] = '..' $values = array_slice($values, 2); // skips array element $value[0] = '.' & $value[1] = '..'
return \Datatable::collection(new Collection($values)) return \Datatable::collection(new Collection($values))
->addColumn('language', function($model) { ->addColumn('language', function ($model) {
return Config::get('languages.' . $model); return Config::get('languages.'.$model);
}) })
->addColumn('id', function($model) { ->addColumn('id', function ($model) {
return $model; return $model;
}) })
->addColumn('status', function($model) { ->addColumn('status', function ($model) {
if (Lang::getLocale() === $model) { if (Lang::getLocale() === $model) {
return "<span style='color:green'>" . Lang::trans("lang.active") . "</span>"; return "<span style='color:green'>".Lang::trans('lang.active').'</span>';
} else
return "<span style='color:red'>" . Lang::trans("lang.inactive") . "</span>";
})
->addColumn('Action', function($model) {
if (Lang::getLocale() === $model) {
return "<a href='change-language/" . $model . "'><input type='button' class='btn btn-info btn-xs btn-flat' disabled value='" . Lang::trans("lang.disable") . "'/></a>
<a href='change-language/" . $model . "' class='btn btn-danger btn-xs btn-flat' disabled><i class='fa fa-trash' style='color:black;'> </i> " . Lang::trans("lang.delete") . "</a>";
} else { } else {
return "<a href='change-language/" . $model . "'><input type='button' class='btn btn-info btn-xs btn-flat' value='" . Lang::trans("lang.enable") . "'/></a> return "<span style='color:red'>".Lang::trans('lang.inactive').'</span>';
<a href='delete-language/" . $model . "' class='btn btn-danger btn-xs btn-flat'><i class='fa fa-trash' style='color:black;'> </i> " . Lang::trans("lang.delete") . "</a>"; }
})
->addColumn('Action', function ($model) {
if (Lang::getLocale() === $model) {
return "<a href='change-language/".$model."'><input type='button' class='btn btn-info btn-xs btn-flat' disabled value='".Lang::trans('lang.disable')."'/></a>
<a href='change-language/".$model."' class='btn btn-danger btn-xs btn-flat' disabled><i class='fa fa-trash' style='color:black;'> </i> ".Lang::trans('lang.delete').'</a>';
} else {
return "<a href='change-language/".$model."'><input type='button' class='btn btn-info btn-xs btn-flat' value='".Lang::trans('lang.enable')."'/></a>
<a href='delete-language/".$model."' class='btn btn-danger btn-xs btn-flat'><i class='fa fa-trash' style='color:black;'> </i> ".Lang::trans('lang.delete').'</a>';
} }
}) })
->searchColumns('language', 'id') ->searchColumns('language', 'id')
@@ -116,23 +124,25 @@ class LanguageController extends Controller {
} }
/** /**
* handle language file uploading * handle language file uploading.
* @return response *
* @return response
*/ */
public function postForm() { public function postForm()
{
// getting all of the post data // getting all of the post data
$file = array( $file = [
'File' => Input::file('File'), 'File' => Input::file('File'),
'language-name' => Input::input('language-name'), 'language-name' => Input::input('language-name'),
'iso-code' => Input::input('iso-code') 'iso-code' => Input::input('iso-code'),
); ];
// setting up rules // setting up rules
$rules = array( $rules = [
'File' => 'required|mimes:zip|max:30000', 'File' => 'required|mimes:zip|max:30000',
'language-name' => 'required', 'language-name' => 'required',
'iso-code' => 'required|max:2' 'iso-code' => 'required|max:2',
); // and for max size ]; // and for max size
// doing the validation, passing post data, rules and the messages // doing the validation, passing post data, rules and the messages
$validator = Validator::make($file, $rules); $validator = Validator::make($file, $rules);
if ($validator->fails()) { if ($validator->fails()) {
@@ -141,18 +151,19 @@ class LanguageController extends Controller {
return Redirect::back()->withInput()->withErrors($validator); return Redirect::back()->withInput()->withErrors($validator);
} else { } else {
//Checking if package already exists or not in lang folder //Checking if package already exists or not in lang folder
$path = base_path('resources/lang'); $path = base_path('resources/lang');
if (in_array(strtolower(Input::get('iso-code')), scandir($path))) { if (in_array(strtolower(Input::get('iso-code')), scandir($path))) {
//sending back with error message //sending back with error message
Session::flash('fails', Lang::get('lang.package_exist')); Session::flash('fails', Lang::get('lang.package_exist'));
Session::flash('link', "change-language/" . strtolower(Input::get('iso-code'))); Session::flash('link', 'change-language/'.strtolower(Input::get('iso-code')));
return Redirect::back()->withInput(); return Redirect::back()->withInput();
} elseif (!array_key_exists(strtolower(Input::get('iso-code')), Config::get('languages'))) {//Checking Valid ISO code form Languages.php } elseif (!array_key_exists(strtolower(Input::get('iso-code')), Config::get('languages'))) {//Checking Valid ISO code form Languages.php
//sending back with error message //sending back with error message
Session::flash('fails', Lang::get('lang.iso-code-error')); Session::flash('fails', Lang::get('lang.iso-code-error'));
return Redirect::back()->withInput(); return Redirect::back()->withInput();
} else { } else {
@@ -160,11 +171,11 @@ class LanguageController extends Controller {
if (Input::file('File')->isValid()) { if (Input::file('File')->isValid()) {
$name = Input::file('File')->getClientOriginalName(); //uploaded file's original name $name = Input::file('File')->getClientOriginalName(); //uploaded file's original name
$destinationPath = '../public/uploads/'; // defining uploading path $destinationPath = '../public/uploads/'; // defining uploading path
$extractpath = '../resources/lang/' . strtolower(Input::get('iso-code')); //defining extracting path $extractpath = '../resources/lang/'.strtolower(Input::get('iso-code')); //defining extracting path
mkdir($extractpath); //creating directroy for extracting uploadd file mkdir($extractpath); //creating directroy for extracting uploadd file
//mkdir($destinationPath); //mkdir($destinationPath);
Input::file('File')->move($destinationPath, $name); // uploading file to given path Input::file('File')->move($destinationPath, $name); // uploading file to given path
\Zipper::make($destinationPath . '/' . $name)->extractTo($extractpath); //extracting file to give path \Zipper::make($destinationPath.'/'.$name)->extractTo($extractpath); //extracting file to give path
//check if Zip extract foldercontains any subfolder //check if Zip extract foldercontains any subfolder
$directories = File::directories($extractpath); $directories = File::directories($extractpath);
//$directories = glob($extractpath. '/*' , GLOB_ONLYDIR); //$directories = glob($extractpath. '/*' , GLOB_ONLYDIR);
@@ -174,18 +185,21 @@ class LanguageController extends Controller {
if ($success) { if ($success) {
//sending back with error message //sending back with error message
Session::flash('fails', Lang::get('lang.zipp-error')); Session::flash('fails', Lang::get('lang.zipp-error'));
Session::flash('link2', "http://www.ladybirdweb.com/support/show/how-to-translate-faveo-into-multiple-languages"); Session::flash('link2', 'http://www.ladybirdweb.com/support/show/how-to-translate-faveo-into-multiple-languages');
return Redirect::back()->withInput(); return Redirect::back()->withInput();
} }
} else { } else {
// sending back with success message // sending back with success message
Session::flash('success', Lang::get("lang.upload-success")); Session::flash('success', Lang::get('lang.upload-success'));
Session::flash('link', "change-language/" . strtolower(Input::get('iso-code'))); Session::flash('link', 'change-language/'.strtolower(Input::get('iso-code')));
return Redirect::route('LanguageController'); return Redirect::route('LanguageController');
} }
} else { } else {
// sending back with error message. // sending back with error message.
Session::flash('fails', Lang::get("lang.file-error")); Session::flash('fails', Lang::get('lang.file-error'));
return Redirect::route('form'); return Redirect::route('form');
} }
} }
@@ -193,36 +207,43 @@ class LanguageController extends Controller {
} }
/** /**
* allow user to download language template file * allow user to download language template file.
*
* @return type * @return type
*/ */
Public function download() { public function download()
{
return response()->download('../public/downloads/en.zip'); return response()->download('../public/downloads/en.zip');
} }
/** /**
* This function is used to delete languages * This function is used to delete languages.
* @param type $lang *
* @param type $lang
*
* @return type response * @return type response
*/ */
public function deleteLanguage($lang) { public function deleteLanguage($lang)
{
if ($lang !== App::getLocale()) { if ($lang !== App::getLocale()) {
$deletePath = base_path('resources/lang') . $lang; //define file path to delete $deletePath = base_path('resources/lang').$lang; //define file path to delete
$success = File::deleteDirectory($deletePath); //remove extracted folder and it's subfolder from lang $success = File::deleteDirectory($deletePath); //remove extracted folder and it's subfolder from lang
if ($success) { if ($success) {
//sending back with success message //sending back with success message
Session::flash('success', Lang::get('lang.delete-success')); Session::flash('success', Lang::get('lang.delete-success'));
return Redirect::back(); return Redirect::back();
} else { } else {
//sending back with error message //sending back with error message
Session::flash('fails', Lang::get('lang.lang-doesnot-exist')); Session::flash('fails', Lang::get('lang.lang-doesnot-exist'));
return Redirect::back(); return Redirect::back();
} }
} else { } else {
//sending back with error message //sending back with error message
Session::flash('fails', Lang::get('lang.active-lang-error')); Session::flash('fails', Lang::get('lang.active-lang-error'));
return redirect('languages'); return redirect('languages');
} }
} }
} }

View File

@@ -11,33 +11,35 @@ use App\Http\Requests\ProfileRequest;
use App\User; use App\User;
// classes // classes
use Auth; use Auth;
use Exception;
use Hash; use Hash;
use Input; use Input;
use Exception;
/** /**
* ProfileController * ProfileController.
* *
* @package Controllers
* @subpackage Controller
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class ProfileController extends Controller { class ProfileController extends Controller
{
/** /**
* Create a new controller instance. * Create a new controller instance.
*
* @return type void * @return type void
*/ */
public function __construct() { public function __construct()
{
$this->middleware('auth'); $this->middleware('auth');
$this->middleware('roles'); $this->middleware('roles');
} }
/** /**
* Get profile page * Get profile page.
*
* @return type Response * @return type Response
*/ */
public function getProfile() { public function getProfile()
{
try { try {
$user = Auth::user(); $user = Auth::user();
if ($user) { if ($user) {
@@ -51,10 +53,12 @@ class ProfileController extends Controller {
} }
/** /**
* Get profile Edit page * Get profile Edit page.
*
* @return type Response * @return type Response
*/ */
public function getProfileedit() { public function getProfileedit()
{
try { try {
$user = Auth::user(); $user = Auth::user();
if ($user) { if ($user) {
@@ -68,12 +72,15 @@ class ProfileController extends Controller {
} }
/** /**
* Post profile page * Post profile page.
* @param type int $id *
* @param type int $id
* @param type ProfileRequest $request * @param type ProfileRequest $request
*
* @return type Response * @return type Response
*/ */
public function postProfile($id, ProfileRequest $request) { public function postProfile($id, ProfileRequest $request)
{
$user = Auth::user(); $user = Auth::user();
$user->gender = $request->input('gender'); $user->gender = $request->input('gender');
$user->save(); $user->save();
@@ -92,12 +99,13 @@ class ProfileController extends Controller {
//$extension = Input::file('profile_pic')->getClientOriginalExtension(); //$extension = Input::file('profile_pic')->getClientOriginalExtension();
$name = Input::file('profile_pic')->getClientOriginalName(); $name = Input::file('profile_pic')->getClientOriginalName();
$destinationPath = 'lb-faveo/profilepic'; $destinationPath = 'lb-faveo/profilepic';
$fileName = rand(0000, 9999) . '.' . $name; $fileName = rand(0000, 9999).'.'.$name;
//echo $fileName; //echo $fileName;
Input::file('profile_pic')->move($destinationPath, $fileName); Input::file('profile_pic')->move($destinationPath, $fileName);
$user->profile_pic = $fileName; $user->profile_pic = $fileName;
} else { } else {
$user->fill($request->except('profile_pic', 'gender'))->save(); $user->fill($request->except('profile_pic', 'gender'))->save();
return redirect('guest')->with('success', 'Profile Updated sucessfully'); return redirect('guest')->with('success', 'Profile Updated sucessfully');
} }
if ($user->fill($request->except('profile_pic'))->save()) { if ($user->fill($request->except('profile_pic'))->save()) {
@@ -106,22 +114,25 @@ class ProfileController extends Controller {
} }
/** /**
* Post Profile password page * Post Profile password page.
* @param type int $id *
* @param type User $user * @param type int $id
* @param type User $user
* @param type ProfilePassword $request * @param type ProfilePassword $request
*
* @return type Response * @return type Response
*/ */
public function postProfilePassword($id, User $user, ProfilePassword $request) { public function postProfilePassword($id, User $user, ProfilePassword $request)
{
$user = Auth::user(); $user = Auth::user();
//echo $user->password; //echo $user->password;
if (Hash::check($request->input('old_password'), $user->getAuthPassword())) { if (Hash::check($request->input('old_password'), $user->getAuthPassword())) {
$user->password = Hash::make($request->input('new_password')); $user->password = Hash::make($request->input('new_password'));
$user->save(); $user->save();
return redirect('guest')->with('success', 'Password Updated sucessfully'); return redirect('guest')->with('success', 'Password Updated sucessfully');
} else { } else {
return redirect('guest')->with('fails', 'Password was not Updated'); return redirect('guest')->with('fails', 'Password was not Updated');
} }
} }
} }

View File

@@ -21,51 +21,55 @@ use App\Model\helpdesk\Settings\Email;
use App\Model\helpdesk\Settings\Responder; use App\Model\helpdesk\Settings\Responder;
use App\Model\helpdesk\Settings\System; use App\Model\helpdesk\Settings\System;
use App\Model\helpdesk\Settings\Ticket; use App\Model\helpdesk\Settings\Ticket;
use App\Model\helpdesk\Ticket\Ticket_Priority;
use App\Model\helpdesk\Utility\Date_format; use App\Model\helpdesk\Utility\Date_format;
use App\Model\helpdesk\Utility\Date_time_format; use App\Model\helpdesk\Utility\Date_time_format;
use App\Model\helpdesk\Ticket\Ticket_Priority;
use App\Model\helpdesk\Utility\Timezones;
use App\Model\helpdesk\Utility\Time_format; use App\Model\helpdesk\Utility\Time_format;
use App\Model\helpdesk\Utility\Timezones;
// classes // classes
use Exception;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Input; use Input;
use Exception;
/** /**
* SettingsController * SettingsController.
* *
* @package Controllers
* @subpackage Controller
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class SettingsController extends Controller { class SettingsController extends Controller
{
/** /**
* Create a new controller instance. * Create a new controller instance.
*
* @return void * @return void
*/ */
public function __construct() { public function __construct()
{
// $this->smtp(); // $this->smtp();
$this->middleware('auth'); $this->middleware('auth');
$this->middleware('roles'); $this->middleware('roles');
} }
/** /**
* Main Settings Page * Main Settings Page.
*
* @return type view * @return type view
*/ */
public function settings() { public function settings()
{
return view('themes.default1.admin.helpdesk.setting'); return view('themes.default1.admin.helpdesk.setting');
} }
/** /**
* @param int $id * @param int $id
* @return Response
* @param $compant instance of company table * @param $compant instance of company table
* *
* get the form for company setting page * get the form for company setting page
*
* @return Response
*/ */
public function getcompany(Company $company) { public function getcompany(Company $company)
{
try { try {
/* fetch the values of company from company table */ /* fetch the values of company from company table */
$companys = $company->whereId('1')->first(); $companys = $company->whereId('1')->first();
@@ -78,18 +82,21 @@ class SettingsController extends Controller {
/** /**
* Update the specified resource in storage. * Update the specified resource in storage.
* @param type int $id *
* @param type Company $company * @param type int $id
* @param type CompanyRequest $request * @param type Company $company
* @param type CompanyRequest $request
*
* @return Response * @return Response
*/ */
public function postcompany($id, Company $company, CompanyRequest $request) { public function postcompany($id, Company $company, CompanyRequest $request)
{
/* fetch the values of company request */ /* fetch the values of company request */
$companys = $company->whereId('1')->first(); $companys = $company->whereId('1')->first();
if (Input::file('logo')) { if (Input::file('logo')) {
$name = Input::file('logo')->getClientOriginalName(); $name = Input::file('logo')->getClientOriginalName();
$destinationPath = 'lb-faveo/media/company/'; $destinationPath = 'lb-faveo/media/company/';
$fileName = rand(0000, 9999) . '.' . $name; $fileName = rand(0000, 9999).'.'.$name;
Input::file('logo')->move($destinationPath, $fileName); Input::file('logo')->move($destinationPath, $fileName);
$companys->logo = $fileName; $companys->logo = $fileName;
} }
@@ -103,21 +110,24 @@ class SettingsController extends Controller {
return redirect('getcompany')->with('success', 'Company Updated Successfully'); return redirect('getcompany')->with('success', 'Company Updated Successfully');
} catch (Exception $e) { } catch (Exception $e) {
/* redirect to Index page with Fails Message */ /* redirect to Index page with Fails Message */
return redirect('getcompany')->with('fails', 'Company can not Updated' . '<li>' . $e->errorInfo[2] . '</li>'); return redirect('getcompany')->with('fails', 'Company can not Updated'.'<li>'.$e->errorInfo[2].'</li>');
} }
} }
/** /**
* get the form for System setting page * get the form for System setting page.
* @param type System $system *
* @param type Department $department * @param type System $system
* @param type Timezones $timezone * @param type Department $department
* @param type Date_format $date * @param type Timezones $timezone
* @param type Date_format $date
* @param type Date_time_format $date_time * @param type Date_time_format $date_time
* @param type Time_format $time * @param type Time_format $time
*
* @return type Response * @return type Response
*/ */
public function getsystem(System $system, Department $department, Timezones $timezone, Date_format $date, Date_time_format $date_time, Time_format $time) { public function getsystem(System $system, Department $department, Timezones $timezone, Date_format $date, Date_time_format $date_time, Time_format $time)
{
try { try {
/* fetch the values of system from system table */ /* fetch the values of system from system table */
$systems = $system->whereId('1')->first(); $systems = $system->whereId('1')->first();
@@ -134,12 +144,15 @@ class SettingsController extends Controller {
/** /**
* Update the specified resource in storage. * Update the specified resource in storage.
* @param type int $id *
* @param type System $system * @param type int $id
* @param type System $system
* @param type SystemRequest $request * @param type SystemRequest $request
*
* @return type Response * @return type Response
*/ */
public function postsystem($id, System $system, SystemRequest $request) { public function postsystem($id, System $system, SystemRequest $request)
{
try { try {
// dd($request); // dd($request);
/* fetch the values of system request */ /* fetch the values of system request */
@@ -151,19 +164,22 @@ class SettingsController extends Controller {
return redirect('getsystem')->with('success', 'System Updated Successfully'); return redirect('getsystem')->with('success', 'System Updated Successfully');
} catch (Exception $e) { } catch (Exception $e) {
/* redirect to Index page with Fails Message */ /* redirect to Index page with Fails Message */
return redirect('getsystem')->with('fails', 'System can not Updated' . '<li>' . $e->errorInfo[2] . '</li>'); return redirect('getsystem')->with('fails', 'System can not Updated'.'<li>'.$e->errorInfo[2].'</li>');
} }
} }
/** /**
* get the form for Ticket setting page * get the form for Ticket setting page.
* @param type Ticket $ticket *
* @param type Sla_plan $sla * @param type Ticket $ticket
* @param type Sla_plan $sla
* @param type Help_topic $topic * @param type Help_topic $topic
* @param type Priority $priority * @param type Priority $priority
*
* @return type Response * @return type Response
*/ */
public function getticket(Ticket $ticket, Sla_plan $sla, Help_topic $topic, Ticket_Priority $priority) { public function getticket(Ticket $ticket, Sla_plan $sla, Help_topic $topic, Ticket_Priority $priority)
{
try { try {
/* fetch the values of ticket from ticket table */ /* fetch the values of ticket from ticket table */
$tickets = $ticket->whereId('1')->first(); $tickets = $ticket->whereId('1')->first();
@@ -180,12 +196,15 @@ class SettingsController extends Controller {
/** /**
* Update the specified resource in storage. * Update the specified resource in storage.
* @param type int $id *
* @param type Ticket $ticket * @param type int $id
* @param type Ticket $ticket
* @param type Request $request * @param type Request $request
*
* @return type Response * @return type Response
*/ */
public function postticket($id, Ticket $ticket, Request $request) { public function postticket($id, Ticket $ticket, Request $request)
{
try { try {
/* fetch the values of ticket request */ /* fetch the values of ticket request */
$tickets = $ticket->whereId('1')->first(); $tickets = $ticket->whereId('1')->first();
@@ -206,18 +225,21 @@ class SettingsController extends Controller {
return redirect('getticket')->with('success', 'Ticket Updated Successfully'); return redirect('getticket')->with('success', 'Ticket Updated Successfully');
} catch (Exception $e) { } catch (Exception $e) {
/* redirect to Index page with Fails Message */ /* redirect to Index page with Fails Message */
return redirect('getticket')->with('fails', 'Ticket can not Updated' . '<li>' . $e->errorInfo[2] . '</li>'); return redirect('getticket')->with('fails', 'Ticket can not Updated'.'<li>'.$e->errorInfo[2].'</li>');
} }
} }
/** /**
* get the form for Email setting page * get the form for Email setting page.
* @param type Email $email *
* @param type Email $email
* @param type Template $template * @param type Template $template
* @param type Emails $email1 * @param type Emails $email1
*
* @return type Response * @return type Response
*/ */
public function getemail(Email $email, Template $template, Emails $email1) { public function getemail(Email $email, Template $template, Emails $email1)
{
try { try {
/* fetch the values of email from Email table */ /* fetch the values of email from Email table */
$emails = $email->whereId('1')->first(); $emails = $email->whereId('1')->first();
@@ -234,12 +256,15 @@ class SettingsController extends Controller {
/** /**
* Update the specified resource in storage. * Update the specified resource in storage.
* @param type int $id *
* @param type Email $email * @param type int $id
* @param type Email $email
* @param type EmailRequest $request * @param type EmailRequest $request
*
* @return type Response * @return type Response
*/ */
public function postemail($id, Email $email, EmailRequest $request) { public function postemail($id, Email $email, EmailRequest $request)
{
try { try {
/* fetch the values of email request */ /* fetch the values of email request */
$emails = $email->whereId('1')->first(); $emails = $email->whereId('1')->first();
@@ -258,20 +283,22 @@ class SettingsController extends Controller {
return redirect('getemail')->with('success', 'Email Updated Successfully'); return redirect('getemail')->with('success', 'Email Updated Successfully');
} catch (Exception $e) { } catch (Exception $e) {
/* redirect to Index page with Fails Message */ /* redirect to Index page with Fails Message */
return redirect('getemail')->with('fails', 'Email can not Updated' . '<li>' . $e->errorInfo[2] . '</li>'); return redirect('getemail')->with('fails', 'Email can not Updated'.'<li>'.$e->errorInfo[2].'</li>');
} }
} }
/** /**
* get the form for Access setting page * get the form for Access setting page.
*
* @param type Access $access * @param type Access $access
*
* @return type Response * @return type Response
*/ */
// public function getaccess(Access $access) { // public function getaccess(Access $access) {
// try { // try {
// /* fetch the values of access from access table */ // /* fetch the values of access from access table */
// $accesses = $access->whereId('1')->first(); // $accesses = $access->whereId('1')->first();
// // Direct to Access Settings Page // // Direct to Access Settings Page
// return view('themes.default1.admin.helpdesk.settings.access', compact('accesses')); // return view('themes.default1.admin.helpdesk.settings.access', compact('accesses'));
// } catch (Exception $e) { // } catch (Exception $e) {
// return view('404'); // return view('404');
@@ -280,8 +307,10 @@ class SettingsController extends Controller {
/** /**
* Update the specified resource in storage. * Update the specified resource in storage.
* @param type Access $access *
* @param type Access $access
* @param type Request $request * @param type Request $request
*
* @return type Response * @return type Response
*/ */
// public function postaccess(Access $access, Request $request) { // public function postaccess(Access $access, Request $request) {
@@ -310,11 +339,14 @@ class SettingsController extends Controller {
// } // }
/** /**
* get the form for Responder setting page * get the form for Responder setting page.
*
* @param type Responder $responder * @param type Responder $responder
*
* @return type Response * @return type Response
*/ */
public function getresponder(Responder $responder) { public function getresponder(Responder $responder)
{
try { try {
/* fetch the values of responder from responder table */ /* fetch the values of responder from responder table */
$responders = $responder->whereId('1')->first(); $responders = $responder->whereId('1')->first();
@@ -327,11 +359,14 @@ class SettingsController extends Controller {
/** /**
* Update the specified resource in storage. * Update the specified resource in storage.
*
* @param type Responder $responder * @param type Responder $responder
* @param type Request $request * @param type Request $request
*
* @return type * @return type
*/ */
public function postresponder(Responder $responder, Request $request) { public function postresponder(Responder $responder, Request $request)
{
try { try {
/* fetch the values of responder request */ /* fetch the values of responder request */
$responders = $responder->whereId('1')->first(); $responders = $responder->whereId('1')->first();
@@ -348,16 +383,19 @@ class SettingsController extends Controller {
return redirect('getresponder')->with('success', 'Responder Updated Successfully'); return redirect('getresponder')->with('success', 'Responder Updated Successfully');
} catch (Exception $e) { } catch (Exception $e) {
/* redirect to Index page with Fails Message */ /* redirect to Index page with Fails Message */
return redirect('getresponder')->with('fails', 'Responder can not Updated' . '<li>' . $e->errorInfo[2] . '</li>'); return redirect('getresponder')->with('fails', 'Responder can not Updated'.'<li>'.$e->errorInfo[2].'</li>');
} }
} }
/** /**
* get the form for Alert setting page * get the form for Alert setting page.
*
* @param type Alert $alert * @param type Alert $alert
*
* @return type Response * @return type Response
*/ */
public function getalert(Alert $alert) { public function getalert(Alert $alert)
{
try { try {
/* fetch the values of alert from alert table */ /* fetch the values of alert from alert table */
$alerts = $alert->whereId('1')->first(); $alerts = $alert->whereId('1')->first();
@@ -370,12 +408,15 @@ class SettingsController extends Controller {
/** /**
* Update the specified resource in storage. * Update the specified resource in storage.
* @param type $id *
* @param type Alert $alert * @param type $id
* @param type Alert $alert
* @param type Request $request * @param type Request $request
*
* @return type Response * @return type Response
*/ */
public function postalert($id, Alert $alert, Request $request) { public function postalert($id, Alert $alert, Request $request)
{
try { try {
/* fetch the values of alert request */ /* fetch the values of alert request */
$alerts = $alert->whereId('1')->first(); $alerts = $alert->whereId('1')->first();
@@ -430,38 +471,46 @@ class SettingsController extends Controller {
return redirect('getalert')->with('success', 'Alert Updated Successfully'); return redirect('getalert')->with('success', 'Alert Updated Successfully');
} catch (Exception $e) { } catch (Exception $e) {
/* redirect to Index page with Fails Message */ /* redirect to Index page with Fails Message */
return redirect('getalert')->with('fails', 'Alert can not Updated' . '<li>' . $e->errorInfo[2] . '</li>'); return redirect('getalert')->with('fails', 'Alert can not Updated'.'<li>'.$e->errorInfo[2].'</li>');
} }
} }
/** /**
* To display the list of ratings in the system * To display the list of ratings in the system.
*
* @return type View * @return type View
*/ */
public function RatingSettings() { public function RatingSettings()
{
$ratings = DB::table('settings_ratings')->get(); $ratings = DB::table('settings_ratings')->get();
return view('themes.default1.admin.helpdesk.settings.ratings', compact('ratings')); return view('themes.default1.admin.helpdesk.settings.ratings', compact('ratings'));
} }
/** /**
* To store rating data * To store rating data.
*
* @return type Redirect * @return type Redirect
*/ */
public function PostRatingSettings($slug) { public function PostRatingSettings($slug)
{
$name = Input::get('rating_name'); $name = Input::get('rating_name');
$publish = Input::get('publish'); $publish = Input::get('publish');
$modify = Input::get('modify'); $modify = Input::get('modify');
DB::table('settings_ratings')->whereSlug($slug)->update(array('rating_name' => $name, 'publish' => $publish, 'modify' => $modify)); DB::table('settings_ratings')->whereSlug($slug)->update(['rating_name' => $name, 'publish' => $publish, 'modify' => $modify]);
return redirect()->back()->with('success', 'Successfully updated'); return redirect()->back()->with('success', 'Successfully updated');
} }
/** /**
* To delete a type of rating * To delete a type of rating.
*
* @return type Redirect * @return type Redirect
*/ */
public function RatingDelete($slug) { public function RatingDelete($slug)
{
DB::table('settings_ratings')->whereSlug($slug)->delete(); DB::table('settings_ratings')->whereSlug($slug)->delete();
return redirect()->back()->with('success', 'Successfully Deleted'); return redirect()->back()->with('success', 'Successfully Deleted');
} }
} }

View File

@@ -15,29 +15,32 @@ use DB;
use Exception; use Exception;
/** /**
* SlaController * SlaController.
* *
* @package Controllers
* @subpackage Controller
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class SlaController extends Controller { class SlaController extends Controller
{
/** /**
* Create a new controller instance. * Create a new controller instance.
*
* @return type void * @return type void
*/ */
public function __construct() { public function __construct()
{
$this->middleware('auth'); $this->middleware('auth');
$this->middleware('roles'); $this->middleware('roles');
} }
/** /**
* Display a listing of the resource. * Display a listing of the resource.
*
* @param type Sla_plan $sla * @param type Sla_plan $sla
*
* @return type Response * @return type Response
*/ */
public function index(Sla_plan $sla) { public function index(Sla_plan $sla)
{
try { try {
/* Declare a Variable $slas to store all Values From Sla_plan Table */ /* Declare a Variable $slas to store all Values From Sla_plan Table */
$slas = $sla->get(); $slas = $sla->get();
@@ -50,9 +53,11 @@ class SlaController extends Controller {
/** /**
* Show the form for creating a new resource. * Show the form for creating a new resource.
*
* @return type Response * @return type Response
*/ */
public function create() { public function create()
{
try { try {
/* Direct to Create Page */ /* Direct to Create Page */
return view('themes.default1.admin.helpdesk.manage.sla.create'); return view('themes.default1.admin.helpdesk.manage.sla.create');
@@ -63,11 +68,14 @@ class SlaController extends Controller {
/** /**
* Store a newly created resource in storage. * Store a newly created resource in storage.
* @param type Sla_plan $sla *
* @param type Sla_plan $sla
* @param type SlaRequest $request * @param type SlaRequest $request
*
* @return type Response * @return type Response
*/ */
public function store(Sla_plan $sla, SlaRequest $request) { public function store(Sla_plan $sla, SlaRequest $request)
{
try { try {
/* Fill the request values to Sla_plan Table */ /* Fill the request values to Sla_plan Table */
/* Check whether function success or not */ /* Check whether function success or not */
@@ -76,21 +84,25 @@ class SlaController extends Controller {
return redirect('sla')->with('success', 'SLA Plan Created Successfully'); return redirect('sla')->with('success', 'SLA Plan Created Successfully');
} catch (Exception $e) { } catch (Exception $e) {
/* redirect to Index page with Fails Message */ /* redirect to Index page with Fails Message */
return redirect('sla')->with('fails', 'SLA Plan can not Create' . '<li>' . $e->errorInfo[2] . '</li>'); return redirect('sla')->with('fails', 'SLA Plan can not Create'.'<li>'.$e->errorInfo[2].'</li>');
} }
} }
/** /**
* Show the form for editing the specified resource. * Show the form for editing the specified resource.
* @param type int $id *
* @param type int $id
* @param type Sla_plan $sla * @param type Sla_plan $sla
*
* @return type Response * @return type Response
*/ */
public function edit($id, Sla_plan $sla) { public function edit($id, Sla_plan $sla)
{
try { try {
/* Direct to edit page along values of perticular field using Id */ /* Direct to edit page along values of perticular field using Id */
$slas = $sla->whereId($id)->first(); $slas = $sla->whereId($id)->first();
$slas->get(); $slas->get();
return view('themes.default1.admin.helpdesk.manage.sla.edit', compact('slas')); return view('themes.default1.admin.helpdesk.manage.sla.edit', compact('slas'));
} catch (Exception $e) { } catch (Exception $e) {
return redirect()->back()->with('fails', $e->errorInfo[2]); return redirect()->back()->with('fails', $e->errorInfo[2]);
@@ -99,12 +111,15 @@ class SlaController extends Controller {
/** /**
* Update the specified resource in storage. * Update the specified resource in storage.
* @param type int $id *
* @param type Sla_plan $sla * @param type int $id
* @param type Sla_plan $sla
* @param type SlaUpdate $request * @param type SlaUpdate $request
*
* @return type Response * @return type Response
*/ */
public function update($id, Sla_plan $sla, SlaUpdate $request) { public function update($id, Sla_plan $sla, SlaUpdate $request)
{
try { try {
/* Fill values to selected field using Id except Check box */ /* Fill values to selected field using Id except Check box */
$slas = $sla->whereId($id)->first(); $slas = $sla->whereId($id)->first();
@@ -119,17 +134,20 @@ class SlaController extends Controller {
return redirect('sla')->with('success', 'SLA Plan Updated Successfully'); return redirect('sla')->with('success', 'SLA Plan Updated Successfully');
} catch (Exception $e) { } catch (Exception $e) {
/* redirect to Index page with Fails Message */ /* redirect to Index page with Fails Message */
return redirect('sla')->with('fails', 'SLA Plan can not Update' . '<li>' . $e->errorInfo[2] . '</li>'); return redirect('sla')->with('fails', 'SLA Plan can not Update'.'<li>'.$e->errorInfo[2].'</li>');
} }
} }
/** /**
* Remove the specified resource from storage. * Remove the specified resource from storage.
* @param type int $id *
* @param type int $id
* @param type Sla_plan $sla * @param type Sla_plan $sla
*
* @return type Response * @return type Response
*/ */
public function destroy($id, Sla_plan $sla) { public function destroy($id, Sla_plan $sla)
{
$default_sla = Ticket::where('id', '=', '1')->first(); $default_sla = Ticket::where('id', '=', '1')->first();
if ($default_sla->sla == $id) { if ($default_sla->sla == $id) {
return redirect('departments')->with('fails', 'You cannot delete default department'); return redirect('departments')->with('fails', 'You cannot delete default department');
@@ -137,49 +155,48 @@ class SlaController extends Controller {
$tickets = DB::table('tickets')->where('sla', '=', $id)->update(['sla' => $default_sla->sla]); $tickets = DB::table('tickets')->where('sla', '=', $id)->update(['sla' => $default_sla->sla]);
if ($tickets > 0) { if ($tickets > 0) {
if ($tickets > 1) { if ($tickets > 1) {
$text_tickets = "Tickets"; $text_tickets = 'Tickets';
} else { } else {
$text_tickets = "Ticket"; $text_tickets = 'Ticket';
} }
$ticket = '<li>' . $tickets . ' ' . $text_tickets . ' have been moved to default SLA</li>'; $ticket = '<li>'.$tickets.' '.$text_tickets.' have been moved to default SLA</li>';
} else { } else {
$ticket = ""; $ticket = '';
} }
$dept = DB::table('department')->where('sla', '=', $id)->update(['sla' => $default_sla->sla]); $dept = DB::table('department')->where('sla', '=', $id)->update(['sla' => $default_sla->sla]);
if ($dept > 0) { if ($dept > 0) {
if ($dept > 1) { if ($dept > 1) {
$text_dept = "Emails"; $text_dept = 'Emails';
} else { } else {
$text_dept = "Email"; $text_dept = 'Email';
} }
$dept = '<li>Associated department have been moved to default SLA</li>'; $dept = '<li>Associated department have been moved to default SLA</li>';
} else { } else {
$dept = ""; $dept = '';
} }
$topic = DB::table('help_topic')->where('sla_plan', '=', $id)->update(['sla_plan' => $default_sla->sla]); $topic = DB::table('help_topic')->where('sla_plan', '=', $id)->update(['sla_plan' => $default_sla->sla]);
if ($topic > 0) { if ($topic > 0) {
if ($topic > 1) { if ($topic > 1) {
$text_topic = "Emails"; $text_topic = 'Emails';
} else { } else {
$text_topic = "Email"; $text_topic = 'Email';
} }
$topic = '<li>Associated Help Topic have been moved to default SLA</li>'; $topic = '<li>Associated Help Topic have been moved to default SLA</li>';
} else { } else {
$topic = ""; $topic = '';
} }
$message = $ticket . $dept . $topic; $message = $ticket.$dept.$topic;
/* Delete a perticular field from the database by delete() using Id */ /* Delete a perticular field from the database by delete() using Id */
$slas = $sla->whereId($id)->first(); $slas = $sla->whereId($id)->first();
/* Check whether function success or not */ /* Check whether function success or not */
try { try {
$slas->delete(); $slas->delete();
/* redirect to Index page with Success Message */ /* redirect to Index page with Success Message */
return redirect('sla')->with('success', 'SLA Plan Deleted Successfully' . $message); return redirect('sla')->with('success', 'SLA Plan Deleted Successfully'.$message);
} catch (Exception $e) { } catch (Exception $e) {
/* redirect to Index page with Fails Message */ /* redirect to Index page with Fails Message */
return redirect('sla')->with('fails', 'SLA Plan can not Delete' . '<li>' . $e->errorInfo[2] . '</li>'); return redirect('sla')->with('fails', 'SLA Plan can not Delete'.'<li>'.$e->errorInfo[2].'</li>');
} }
} }
} }
} }

View File

@@ -16,35 +16,39 @@ use DB;
use Exception; use Exception;
/** /**
* TeamController * TeamController.
* *
* @package Controllers
* @subpackage Controller
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class TeamController extends Controller { class TeamController extends Controller
{
/** /**
* Create a new controller instance. * Create a new controller instance.
*
* @return type void * @return type void
*/ */
public function __construct() { public function __construct()
{
$this->middleware('auth'); $this->middleware('auth');
$this->middleware('roles'); $this->middleware('roles');
} }
/** /**
* get Index page * get Index page.
* @param type Teams $team *
* @param type Teams $team
* @param type Assign_team_agent $assign_team_agent * @param type Assign_team_agent $assign_team_agent
*
* @return type Response * @return type Response
*/ */
public function index(Teams $team, Assign_team_agent $assign_team_agent) { public function index(Teams $team, Assign_team_agent $assign_team_agent)
{
try { try {
$teams = $team->get(); $teams = $team->get();
/* find out the Number of Members in the Team */ /* find out the Number of Members in the Team */
$id = $teams->lists('id'); $id = $teams->lists('id');
$assign_team_agent = $assign_team_agent->get(); $assign_team_agent = $assign_team_agent->get();
return view('themes.default1.admin.helpdesk.agent.teams.index', compact('assign_team_agent', 'teams')); return view('themes.default1.admin.helpdesk.agent.teams.index', compact('assign_team_agent', 'teams'));
} catch (Exception $e) { } catch (Exception $e) {
return redirect()->back()->with('fails', $e->errorInfo[2]); return redirect()->back()->with('fails', $e->errorInfo[2]);
@@ -53,12 +57,16 @@ class TeamController extends Controller {
/** /**
* Show the form for creating a new resource. * Show the form for creating a new resource.
*
* @param type User $user * @param type User $user
*
* @return type Response * @return type Response
*/ */
public function create(User $user) { public function create(User $user)
{
try { try {
$user = $user->get(); $user = $user->get();
return view('themes.default1.admin.helpdesk.agent.teams.create', compact('user')); return view('themes.default1.admin.helpdesk.agent.teams.create', compact('user'));
} catch (Exception $e) { } catch (Exception $e) {
return redirect()->back()->with('fails', $e->errorInfo[2]); return redirect()->back()->with('fails', $e->errorInfo[2]);
@@ -67,12 +75,14 @@ class TeamController extends Controller {
/** /**
* Store a newly created resource in storage. * Store a newly created resource in storage.
* @param type Teams $team *
* @param type Teams $team
* @param type TeamRequest $request * @param type TeamRequest $request
*
* @return type Response * @return type Response
*/ */
public function store(Teams $team, TeamRequest $request) { public function store(Teams $team, TeamRequest $request)
{
if ($request->team_lead) { if ($request->team_lead) {
$team_lead = $request->team_lead; $team_lead = $request->team_lead;
} else { } else {
@@ -86,24 +96,28 @@ class TeamController extends Controller {
return redirect('teams')->with('success', 'Teams Created Successfully'); return redirect('teams')->with('success', 'Teams Created Successfully');
} catch (Exception $e) { } catch (Exception $e) {
/* redirect to Index page with Fails Message */ /* redirect to Index page with Fails Message */
return redirect('teams')->with('fails', 'Teams can not Create' . '<li>' . $e->errorInfo[2] . '</li>'); return redirect('teams')->with('fails', 'Teams can not Create'.'<li>'.$e->errorInfo[2].'</li>');
} }
} }
/** /**
* Show the form for editing the specified resource. * Show the form for editing the specified resource.
* @param type $id *
* @param type User $user * @param type $id
* @param type User $user
* @param type Assign_team_agent $assign_team_agent * @param type Assign_team_agent $assign_team_agent
* @param type Teams $team * @param type Teams $team
*
* @return type Response * @return type Response
*/ */
public function edit($id, User $user, Assign_team_agent $assign_team_agent, Teams $team) { public function edit($id, User $user, Assign_team_agent $assign_team_agent, Teams $team)
{
try { try {
$user = $user->whereId($id)->first(); $user = $user->whereId($id)->first();
$teams = $team->whereId($id)->first(); $teams = $team->whereId($id)->first();
$agent_team = $assign_team_agent->where('team_id', $id)->get(); $agent_team = $assign_team_agent->where('team_id', $id)->get();
$agent_id = $agent_team->lists('agent_id', 'agent_id'); $agent_id = $agent_team->lists('agent_id', 'agent_id');
return view('themes.default1.admin.helpdesk.agent.teams.edit', compact('agent_id', 'user', 'teams', 'allagents')); return view('themes.default1.admin.helpdesk.agent.teams.edit', compact('agent_id', 'user', 'teams', 'allagents'));
} catch (Exception $e) { } catch (Exception $e) {
return redirect()->back()->with('fails', $e->errorInfo[2]); return redirect()->back()->with('fails', $e->errorInfo[2]);
@@ -112,13 +126,15 @@ class TeamController extends Controller {
/** /**
* Update the specified resource in storage. * Update the specified resource in storage.
* @param type int $id *
* @param type Teams $team * @param type int $id
* @param type Teams $team
* @param type TeamUpdate $request * @param type TeamUpdate $request
*
* @return type Response * @return type Response
*/ */
public function update($id, Teams $team, TeamUpdate $request) { public function update($id, Teams $team, TeamUpdate $request)
{
$teams = $team->whereId($id)->first(); $teams = $team->whereId($id)->first();
//updating check box //updating check box
if ($request->team_lead) { if ($request->team_lead) {
@@ -140,18 +156,21 @@ class TeamController extends Controller {
return redirect('teams')->with('success', 'Teams Updated Successfully'); return redirect('teams')->with('success', 'Teams Updated Successfully');
} catch (Exception $e) { } catch (Exception $e) {
/* redirect to Index page with Fails Message */ /* redirect to Index page with Fails Message */
return redirect('teams')->with('fails', 'Teams can not Update' . '<li>' . $e->errorInfo[2] . '</li>'); return redirect('teams')->with('fails', 'Teams can not Update'.'<li>'.$e->errorInfo[2].'</li>');
} }
} }
/** /**
* Remove the specified resource from storage. * Remove the specified resource from storage.
* @param type int $id *
* @param type Teams $team * @param type int $id
* @param type Teams $team
* @param type Assign_team_agent $assign_team_agent * @param type Assign_team_agent $assign_team_agent
*
* @return type Response * @return type Response
*/ */
public function destroy($id, Teams $team, Assign_team_agent $assign_team_agent) { public function destroy($id, Teams $team, Assign_team_agent $assign_team_agent)
{
try { try {
$assign_team_agent->where('team_id', $id)->delete(); $assign_team_agent->where('team_id', $id)->delete();
$teams = $team->whereId($id)->first(); $teams = $team->whereId($id)->first();
@@ -162,8 +181,7 @@ class TeamController extends Controller {
return redirect('teams')->with('success', 'Teams Deleted Successfully'); return redirect('teams')->with('success', 'Teams Deleted Successfully');
} catch (Exception $e) { } catch (Exception $e) {
/* redirect to Index page with Fails Message */ /* redirect to Index page with Fails Message */
return redirect('teams')->with('fails', 'Teams can not Delete' . '<li>' . $e->errorInfo[2] . '</li>'); return redirect('teams')->with('fails', 'Teams can not Delete'.'<li>'.$e->errorInfo[2].'</li>');
} }
} }
} }

View File

@@ -3,9 +3,9 @@
namespace App\Http\Controllers\Admin\helpdesk; namespace App\Http\Controllers\Admin\helpdesk;
// controllers // controllers
use App\Http\Controllers\Controller;
use App\Http\Controllers\Common\SettingsController;
use App\Http\Controllers\Common\PhpMailController; use App\Http\Controllers\Common\PhpMailController;
use App\Http\Controllers\Common\SettingsController;
use App\Http\Controllers\Controller;
// requests // requests
use App\Http\Requests\helpdesk\TemplateRequest; use App\Http\Requests\helpdesk\TemplateRequest;
use App\Http\Requests\helpdesk\TemplateUdate; use App\Http\Requests\helpdesk\TemplateUdate;
@@ -14,25 +14,25 @@ use App\Model\helpdesk\Email\Emails;
use App\Model\helpdesk\Email\Template; use App\Model\helpdesk\Email\Template;
use App\Model\helpdesk\Utility\Languages; use App\Model\helpdesk\Utility\Languages;
// classes // classes
use Illuminate\Http\Request;
use Mail;
use Exception; use Exception;
use Illuminate\Http\Request;
use Input; use Input;
use Mail;
/** /**
* TemplateController * TemplateController.
* *
* @package Controllers
* @subpackage Controller
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class TemplateController extends Controller { class TemplateController extends Controller
{
/** /**
* Create a new controller instance. * Create a new controller instance.
*
* @return type void * @return type void
*/ */
public function __construct(PhpMailController $PhpMailController) { public function __construct(PhpMailController $PhpMailController)
{
$this->PhpMailController = $PhpMailController; $this->PhpMailController = $PhpMailController;
SettingsController::smtp(); SettingsController::smtp();
$this->middleware('auth'); $this->middleware('auth');
@@ -41,12 +41,16 @@ class TemplateController extends Controller {
/** /**
* Display a listing of the resource. * Display a listing of the resource.
*
* @param type Template $template * @param type Template $template
*
* @return type Response * @return type Response
*/ */
public function index(Template $template) { public function index(Template $template)
{
try { try {
$templates = $template->get(); $templates = $template->get();
return view('themes.default1.admin.helpdesk.emails.template.index', compact('templates')); return view('themes.default1.admin.helpdesk.emails.template.index', compact('templates'));
} catch (Exception $e) { } catch (Exception $e) {
return view('404'); return view('404');
@@ -55,14 +59,18 @@ class TemplateController extends Controller {
/** /**
* Show the form for creating a new resource. * Show the form for creating a new resource.
*
* @param type Languages $language * @param type Languages $language
* @param type Template $template * @param type Template $template
*
* @return type Response * @return type Response
*/ */
public function create(Languages $language, Template $template) { public function create(Languages $language, Template $template)
{
try { try {
$templates = $template->get(); $templates = $template->get();
$languages = $language->get(); $languages = $language->get();
return view('themes.default1.admin.helpdesk.emails.template.create', compact('languages', 'templates')); return view('themes.default1.admin.helpdesk.emails.template.create', compact('languages', 'templates'));
} catch (Exception $e) { } catch (Exception $e) {
return view('404'); return view('404');
@@ -71,11 +79,14 @@ class TemplateController extends Controller {
/** /**
* Store a newly created resource in storage. * Store a newly created resource in storage.
* @param type Template $template *
* @param type Template $template
* @param type TemplateRequest $request * @param type TemplateRequest $request
*
* @return type Response * @return type Response
*/ */
public function store(Template $template, TemplateRequest $request) { public function store(Template $template, TemplateRequest $request)
{
try { try {
/* Check whether function success or not */ /* Check whether function success or not */
if ($template->fill($request->input())->save() == true) { if ($template->fill($request->input())->save() == true) {
@@ -93,49 +104,60 @@ class TemplateController extends Controller {
/** /**
* Display the specified resource. * Display the specified resource.
* @param int $id *
* @param int $id
*
* @return Response * @return Response
*/ */
public function show($id) { public function show($id)
{
// //
} }
/** /**
* Show the form for editing the specified resource. * Show the form for editing the specified resource.
* @param type $id *
* @param type Template $template * @param type $id
* @param type Template $template
* @param type Languages $language * @param type Languages $language
*
* @return type Response * @return type Response
*/ */
public function listdirectories() { public function listdirectories()
{
$path = '../resources/views/emails/'; $path = '../resources/views/emails/';
$directories = scandir($path); $directories = scandir($path);
$directory = str_replace('/', '-', $path); $directory = str_replace('/', '-', $path);
return view('themes.default1.admin.helpdesk.emails.template.listdirectories', compact('directories', 'directory')); return view('themes.default1.admin.helpdesk.emails.template.listdirectories', compact('directories', 'directory'));
} }
public function listtemplates($template, $path) { public function listtemplates($template, $path)
{
$paths = str_replace('-', '/', $path); $paths = str_replace('-', '/', $path);
$directory2 = $paths . $template; $directory2 = $paths.$template;
$templates = scandir($directory2); $templates = scandir($directory2);
$directory = str_replace('/', '-', $directory2 . '/'); $directory = str_replace('/', '-', $directory2.'/');
return view('themes.default1.admin.helpdesk.emails.template.listtemplates', compact('templates', 'directory')); return view('themes.default1.admin.helpdesk.emails.template.listtemplates', compact('templates', 'directory'));
} }
public function readtemplate($template, $path) { public function readtemplate($template, $path)
{
$directory = str_replace('-', '/', $path); $directory = str_replace('-', '/', $path);
$handle = fopen($directory . $template, "r"); $handle = fopen($directory.$template, 'r');
$contents = fread($handle, filesize($directory . $template)); $contents = fread($handle, filesize($directory.$template));
fclose($handle); fclose($handle);
return view('themes.default1.admin.helpdesk.emails.template.readtemplates', compact('contents', 'template', 'path')); return view('themes.default1.admin.helpdesk.emails.template.readtemplates', compact('contents', 'template', 'path'));
} }
public function createtemplate() { public function createtemplate()
{
$directory = '../resources/views/emails/'; $directory = '../resources/views/emails/';
$fname = Input::get('folder_name'); $fname = Input::get('folder_name');
$filename = $directory . $fname; $filename = $directory.$fname;
// images folder creation using php // images folder creation using php
// $mydir = dirname( __FILE__ )."/html/images"; // $mydir = dirname( __FILE__ )."/html/images";
@@ -147,32 +169,37 @@ class TemplateController extends Controller {
if (!file_exists($filename)) { if (!file_exists($filename)) {
mkdir($filename, 0777); mkdir($filename, 0777);
} }
$files = array_filter(scandir($directory . 'default')); $files = array_filter(scandir($directory.'default'));
foreach ($files as $file) { foreach ($files as $file) {
if ($file === '.' or $file === '..') if ($file === '.' or $file === '..') {
continue; continue;
}
if (!is_dir($file)) { if (!is_dir($file)) {
// $file_to_go = str_replace("code/resources/views/emails/",'code/resources/views/emails/'.$fname,$file); // $file_to_go = str_replace("code/resources/views/emails/",'code/resources/views/emails/'.$fname,$file);
$destination = $directory . $fname . '/'; $destination = $directory.$fname.'/';
copy($directory . 'default/' . $file, $destination . $file); copy($directory.'default/'.$file, $destination.$file);
} }
} }
return \Redirect::back()->with('success', 'Successfully copied'); return \Redirect::back()->with('success', 'Successfully copied');
} }
public function writetemplate($template, $path) { public function writetemplate($template, $path)
{
$directory = str_replace('-', '/', $path); $directory = str_replace('-', '/', $path);
$b = Input::get('templatedata'); $b = Input::get('templatedata');
file_put_contents($directory . $template, print_r($b, true)); file_put_contents($directory.$template, print_r($b, true));
return \Redirect::back()->with('success', 'Successfully updated'); return \Redirect::back()->with('success', 'Successfully updated');
} }
public function deletetemplate($template, $path) { public function deletetemplate($template, $path)
{
$directory = str_replace('-', '/', $path); $directory = str_replace('-', '/', $path);
$dir = $directory . $template; $dir = $directory.$template;
$status = \DB::table('settings_email')->first(); $status = \DB::table('settings_email')->first();
if ($template == 'default' or $template == $status->template) { if ($template == 'default' or $template == $status->template) {
return \Redirect::back()->with('fails', 'You cannot delete a default or active directory!'); return \Redirect::back()->with('fails', 'You cannot delete a default or active directory!');
@@ -180,26 +207,31 @@ class TemplateController extends Controller {
if (is_dir($dir)) { if (is_dir($dir)) {
$objects = scandir($dir); $objects = scandir($dir);
foreach ($objects as $object) { foreach ($objects as $object) {
if ($object != "." && $object != "..") { if ($object != '.' && $object != '..') {
unlink($dir . "/" . $object); unlink($dir.'/'.$object);
} }
} }
rmdir($dir); rmdir($dir);
} else { } else {
rmdir($dir); rmdir($dir);
} }
return \Redirect::back()->with('success', 'Successfully Deleted'); return \Redirect::back()->with('success', 'Successfully Deleted');
} }
public function activateset($setname) { public function activateset($setname)
\DB::table('settings_email')->update(array('template' => $setname)); {
\DB::table('settings_email')->update(['template' => $setname]);
return \Redirect::back()->with('success', 'You have Successfully Activated this Set'); return \Redirect::back()->with('success', 'You have Successfully Activated this Set');
} }
public function edit($id, Template $template, Languages $language) { public function edit($id, Template $template, Languages $language)
{
try { try {
$templates = $template->whereId($id)->first(); $templates = $template->whereId($id)->first();
$languages = $language->get(); $languages = $language->get();
return view('themes.default1.admin.helpdesk.emails.template.edit', compact('templates', 'languages')); return view('themes.default1.admin.helpdesk.emails.template.edit', compact('templates', 'languages'));
} catch (Exception $e) { } catch (Exception $e) {
return view('404'); return view('404');
@@ -208,12 +240,15 @@ class TemplateController extends Controller {
/** /**
* Update the specified resource in storage. * Update the specified resource in storage.
* @param type int $id *
* @param type Template $template * @param type int $id
* @param type Template $template
* @param type TemplateUdate $request * @param type TemplateUdate $request
*
* @return type Response * @return type Response
*/ */
public function update($id, Template $template, TemplateUdate $request) { public function update($id, Template $template, TemplateUdate $request)
{
try { try {
//TODO validation //TODO validation
$templates = $template->whereId($id)->first(); $templates = $template->whereId($id)->first();
@@ -233,11 +268,14 @@ class TemplateController extends Controller {
/** /**
* Remove the specified resource from storage. * Remove the specified resource from storage.
* @param type int $id *
* @param type int $id
* @param type Template $template * @param type Template $template
*
* @return type Response * @return type Response
*/ */
public function destroy($id, Template $template) { public function destroy($id, Template $template)
{
try { try {
$templates = $template->whereId($id)->first(); $templates = $template->whereId($id)->first();
/* Check whether function success or not */ /* Check whether function success or not */
@@ -256,12 +294,16 @@ class TemplateController extends Controller {
/** /**
* Form for Email connection checking. * Form for Email connection checking.
*
* @param type Emails $email * @param type Emails $email
*
* @return type Response * @return type Response
*/ */
public function formDiagno(Emails $email) { public function formDiagno(Emails $email)
{
try { try {
$emails = $email->get(); $emails = $email->get();
return view('themes.default1.admin.helpdesk.emails.template.formDiagno', compact('emails')); return view('themes.default1.admin.helpdesk.emails.template.formDiagno', compact('emails'));
} catch (Exception $e) { } catch (Exception $e) {
return view('404'); return view('404');
@@ -269,11 +311,14 @@ class TemplateController extends Controller {
} }
/** /**
* function to send emails * function to send emails.
*
* @param type Request $request * @param type Request $request
*
* @return type * @return type
*/ */
public function postDiagno(Request $request) { public function postDiagno(Request $request)
{
$email = $request->input('to'); $email = $request->input('to');
if ($email == null) { if ($email == null) {
return redirect('getdiagno')->with('fails', 'Please provide E-mail address !'); return redirect('getdiagno')->with('fails', 'Please provide E-mail address !');
@@ -283,5 +328,4 @@ class TemplateController extends Controller {
return redirect('getdiagno')->with('success', 'Please check your mail. An E-mail has been sent to your E-mail address'); return redirect('getdiagno')->with('success', 'Please check your mail. An E-mail has been sent to your E-mail address');
} }
} }

View File

@@ -11,21 +11,22 @@ use App\Model\helpdesk\Ticket_thread;
use Exception; use Exception;
/** /**
* ThreadController * ThreadController.
* *
* @package Controllers
* @subpackage Controller
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class ThreadController extends Controller { class ThreadController extends Controller
{
/** /**
* get the values from ticket_thread Table and direct to view page * get the values from ticket_thread Table and direct to view page.
*
* @param type Ticket_thread $thread * @param type Ticket_thread $thread
* @param type Priority $priority * @param type Priority $priority
* @return type Response *
* @return type Response
*/ */
public function getTickets(Ticket_thread $thread, Priority $priority) { public function getTickets(Ticket_thread $thread, Priority $priority)
{
try { try {
/* get the values of Ticket_thread from Ticket_thread Table */ /* get the values of Ticket_thread from Ticket_thread Table */
$threads = $thread->get(); $threads = $thread->get();
@@ -37,5 +38,4 @@ class ThreadController extends Controller {
return view('404'); return view('404');
} }
} }
} }

View File

@@ -14,25 +14,25 @@ use App\User;
use Exception; use Exception;
/** /**
* CannedController * CannedController.
* *
* This controller is for all the functionalities of Canned response for Agents in the Agent Panel * This controller is for all the functionalities of Canned response for Agents in the Agent Panel
* *
* @package Controllers
* @subpackage Controller
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class CannedController extends Controller { class CannedController extends Controller
{
/** /**
* Create a new controller instance. * Create a new controller instance.
* constructor to check * constructor to check
* 1. authentication * 1. authentication
* 2. user roles * 2. user roles
* 3. roles must be agent * 3. roles must be agent.
*
* @return void * @return void
*/ */
public function __construct() { public function __construct()
{
// checking authentication // checking authentication
$this->middleware('auth'); $this->middleware('auth');
// checking if role is agent // checking if role is agent
@@ -41,27 +41,34 @@ class CannedController extends Controller {
/** /**
* Display a listing of the Canned Responses. * Display a listing of the Canned Responses.
*
* @return type View * @return type View
*/ */
public function index() { public function index()
{
return view('themes.default1.agent.helpdesk.canned.index'); return view('themes.default1.agent.helpdesk.canned.index');
} }
/** /**
* Show the form for creating a new Canned Response * Show the form for creating a new Canned Response.
*
* @return type View * @return type View
*/ */
public function create() { public function create()
{
return view('themes.default1.agent.helpdesk.canned.create'); return view('themes.default1.agent.helpdesk.canned.create');
} }
/** /**
* Store a newly created Canned Response. * Store a newly created Canned Response.
* @param type CannedRequest $request *
* @param type Canned $canned * @param type CannedRequest $request
* @param type Canned $canned
*
* @return type Redirect * @return type Redirect
*/ */
public function store(CannedRequest $request, Canned $canned) { public function store(CannedRequest $request, Canned $canned)
{
// fetching all the requested inputs // fetching all the requested inputs
$canned->user_id = \Auth::user()->id; $canned->user_id = \Auth::user()->id;
$canned->title = $request->input('title'); $canned->title = $request->input('title');
@@ -69,6 +76,7 @@ class CannedController extends Controller {
try { try {
// saving inputs // saving inputs
$canned->save(); $canned->save();
return redirect()->route('canned.list')->with('success', 'Added Successfully'); return redirect()->route('canned.list')->with('success', 'Added Successfully');
} catch (Exception $e) { } catch (Exception $e) {
return redirect()->route('canned.list')->with('fails', $e->errorInfo[2]); return redirect()->route('canned.list')->with('fails', $e->errorInfo[2]);
@@ -77,24 +85,31 @@ class CannedController extends Controller {
/** /**
* Show the form for editing the Canned Response. * Show the form for editing the Canned Response.
* @param type $id *
* @param type Canned $canned * @param type $id
* @param type Canned $canned
*
* @return type View * @return type View
*/ */
public function edit($id, Canned $canned) { public function edit($id, Canned $canned)
{
// fetching requested canned response // fetching requested canned response
$canned = $canned->where('user_id', '=', \Auth::user()->id)->where('id', '=', $id)->first(); $canned = $canned->where('user_id', '=', \Auth::user()->id)->where('id', '=', $id)->first();
return view('themes.default1.agent.helpdesk.canned.edit', compact('canned')); return view('themes.default1.agent.helpdesk.canned.edit', compact('canned'));
} }
/** /**
* Update the Canned Response in database. * Update the Canned Response in database.
* @param type $id *
* @param type CannedUpdateRequest $request * @param type $id
* @param type Canned $canned * @param type CannedUpdateRequest $request
* @param type Canned $canned
*
* @return type Redirect * @return type Redirect
*/ */
public function update($id, CannedUpdateRequest $request, Canned $canned) { public function update($id, CannedUpdateRequest $request, Canned $canned)
{
/* select the field where id = $id(request Id) */ /* select the field where id = $id(request Id) */
$canned = $canned->where('id', '=', $id)->where('user_id', '=', \Auth::user()->id)->first(); $canned = $canned->where('id', '=', $id)->where('user_id', '=', \Auth::user()->id)->first();
// fetching all the requested inputs // fetching all the requested inputs
@@ -104,6 +119,7 @@ class CannedController extends Controller {
try { try {
// saving inputs // saving inputs
$canned->save(); $canned->save();
return redirect()->route('canned.list')->with('success', 'Updated Successfully'); return redirect()->route('canned.list')->with('success', 'Updated Successfully');
} catch (Exception $e) { } catch (Exception $e) {
return redirect()->route('canned.list')->with('fails', $e->errorInfo[2]); return redirect()->route('canned.list')->with('fails', $e->errorInfo[2]);
@@ -112,11 +128,14 @@ class CannedController extends Controller {
/** /**
* Delete the Canned Response from storage. * Delete the Canned Response from storage.
* @param type $id *
* @param type Canned $canned * @param type $id
* @param type Canned $canned
*
* @return type Redirect * @return type Redirect
*/ */
public function destroy($id, Canned $canned) { public function destroy($id, Canned $canned)
{
/* select the field where id = $id(request Id) */ /* select the field where id = $id(request Id) */
$canned = $canned->whereId($id)->first(); $canned = $canned->whereId($id)->first();
/* delete the selected field */ /* delete the selected field */
@@ -133,20 +152,22 @@ class CannedController extends Controller {
/** /**
* Fetch Canned Response in the ticket detail page. * Fetch Canned Response in the ticket detail page.
* @param type $id *
* @param type $id
*
* @return type json * @return type json
*/ */
public function get_canned($id) { public function get_canned($id)
{
// checking for the canned response with requested value // checking for the canned response with requested value
if ($id != "zzz") { if ($id != 'zzz') {
// fetching canned response // fetching canned response
$canned = Canned::where('id', '=', $id)->where('user_id', '=', \Auth::user()->id)->first(); $canned = Canned::where('id', '=', $id)->where('user_id', '=', \Auth::user()->id)->first();
$msg = $canned->message; $msg = $canned->message;
} else { } else {
$msg = ""; $msg = '';
} }
// returning the canned response in JSON format // returning the canned response in JSON format
return \Response::json($msg); return \Response::json($msg);
} }
} }

View File

@@ -5,35 +5,32 @@ namespace App\Http\Controllers\Agent\helpdesk;
// controllers // controllers
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
// models // models
use App\Model\helpdesk\Settings\Company;
use App\Model\helpdesk\Ticket\Ticket_Collaborator;
use App\Model\helpdesk\Email\Emails;
use App\User; use App\User;
// classes // classes
use DB;
use View;
use Auth; use Auth;
use DB;
use Exception; use Exception;
use View;
/** /**
* DashboardController * DashboardController
* This controlleris used to fetch dashboard in the agent panel * This controlleris used to fetch dashboard in the agent panel.
* *
* @package Controllers
* @subpackage Controller
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class DashboardController extends Controller { class DashboardController extends Controller
{
/** /**
* Create a new controller instance. * Create a new controller instance.
* constructor to check * constructor to check
* 1. authentication * 1. authentication
* 2. user roles * 2. user roles
* 3. roles must be agent * 3. roles must be agent.
*
* @return void * @return void
*/ */
public function __construct() { public function __construct()
{
// checking for authentication // checking for authentication
$this->middleware('auth'); $this->middleware('auth');
// checking if the role is agent // checking if the role is agent
@@ -41,12 +38,14 @@ class DashboardController extends Controller {
} }
/** /**
* Get the dashboard page * Get the dashboard page.
*
* @return type view * @return type view
*/ */
public function index() { public function index()
{
// if(Auth::user()->role == "user"){ // if(Auth::user()->role == "user"){
// return \Redirect::route('home'); // return \Redirect::route('home');
// } // }
try { try {
return View::make('themes.default1.agent.helpdesk.dashboard.dashboard'); return View::make('themes.default1.agent.helpdesk.dashboard.dashboard');
@@ -56,10 +55,12 @@ class DashboardController extends Controller {
} }
/** /**
* Fetching dashboard graph data to implement graph * Fetching dashboard graph data to implement graph.
*
* @return type Json * @return type Json
*/ */
public function ChartData($date111 = "", $date122 = "") { public function ChartData($date111 = '', $date122 = '')
{
$date11 = strtotime($date122); $date11 = strtotime($date122);
$date12 = strtotime($date111); $date12 = strtotime($date111);
if ($date11 && $date12) { if ($date11 && $date12) {
@@ -67,29 +68,29 @@ class DashboardController extends Controller {
$date1 = $date11; $date1 = $date11;
} else { } else {
// generating current date // generating current date
$date2 = strtotime(Date('Y-m-d')); $date2 = strtotime(date('Y-m-d'));
$date3 = Date('Y-m-d'); $date3 = date('Y-m-d');
$format = 'Y-m-d'; $format = 'Y-m-d';
// generating a date range of 1 month // generating a date range of 1 month
$date1 = strtotime(Date($format, strtotime('-1 month' . $date3))); $date1 = strtotime(date($format, strtotime('-1 month'.$date3)));
} }
$return = ""; $return = '';
$last = ""; $last = '';
for ($i = $date1; $i <= $date2; $i = $i + 86400) { for ($i = $date1; $i <= $date2; $i = $i + 86400) {
$thisDate = date('Y-m-d', $i); $thisDate = date('Y-m-d', $i);
$created = \DB::table('tickets')->select('created_at')->where('created_at', 'LIKE', '%' . $thisDate . '%')->count(); $created = \DB::table('tickets')->select('created_at')->where('created_at', 'LIKE', '%'.$thisDate.'%')->count();
$closed = \DB::table('tickets')->select('closed_at')->where('closed_at', 'LIKE', '%' . $thisDate . '%')->count(); $closed = \DB::table('tickets')->select('closed_at')->where('closed_at', 'LIKE', '%'.$thisDate.'%')->count();
$reopened = \DB::table('tickets')->select('reopened_at')->where('reopened_at', 'LIKE', '%' . $thisDate . '%')->count(); $reopened = \DB::table('tickets')->select('reopened_at')->where('reopened_at', 'LIKE', '%'.$thisDate.'%')->count();
$value = ['date' => $thisDate, 'open' => $created, 'closed' => $closed, 'reopened' => $reopened]; $value = ['date' => $thisDate, 'open' => $created, 'closed' => $closed, 'reopened' => $reopened];
$array = array_map('htmlentities', $value); $array = array_map('htmlentities', $value);
$json = html_entity_decode(json_encode($array)); $json = html_entity_decode(json_encode($array));
$return .= $json . ','; $return .= $json.',';
} }
$last = rtrim($return, ','); $last = rtrim($return, ',');
return '[' . $last . ']'; return '['.$last.']';
// $ticketlist = DB::table('tickets') // $ticketlist = DB::table('tickets')
// ->select(DB::raw('MONTH(updated_at) as month'),DB::raw('SUM(CASE WHEN status = 3 THEN 1 ELSE 0 END) as closed'),DB::raw('SUM(CASE WHEN status = 2 THEN 1 ELSE 0 END) as reopened'),DB::raw('SUM(CASE WHEN status = 1 THEN 1 ELSE 0 END) as open'),DB::raw('SUM(CASE WHEN status = 5 THEN 1 ELSE 0 END) as deleted'), // ->select(DB::raw('MONTH(updated_at) as month'),DB::raw('SUM(CASE WHEN status = 3 THEN 1 ELSE 0 END) as closed'),DB::raw('SUM(CASE WHEN status = 2 THEN 1 ELSE 0 END) as reopened'),DB::raw('SUM(CASE WHEN status = 1 THEN 1 ELSE 0 END) as open'),DB::raw('SUM(CASE WHEN status = 5 THEN 1 ELSE 0 END) as deleted'),
@@ -99,5 +100,4 @@ class DashboardController extends Controller {
// ->get(); // ->get();
// return $ticketlist; // return $ticketlist;
} }
} }

View File

@@ -3,57 +3,50 @@
namespace App\Http\Controllers\Agent\helpdesk; namespace App\Http\Controllers\Agent\helpdesk;
// controllers // controllers
use App\Http\Controllers\Controller; use App;
use App\Http\Controllers\Agent\helpdesk\TicketController;
// models // models
use App\User; use App\Http\Controllers\Controller;
use App\Model\helpdesk\Email\Emails; use App\Model\helpdesk\Email\Emails;
use App\Model\helpdesk\Manage\Help_topic;
use App\Model\helpdesk\Settings\Email; use App\Model\helpdesk\Settings\Email;
use App\Model\helpdesk\Ticket\Ticket_attachments;
use App\Model\helpdesk\Ticket\Ticket_Thread;
use App\Model\helpdesk\Settings\System; use App\Model\helpdesk\Settings\System;
use App\Model\helpdesk\Settings\Ticket; use App\Model\helpdesk\Settings\Ticket;
use App\Model\helpdesk\Manage\Help_topic; use App\Model\helpdesk\Ticket\Ticket_attachments;
use App\Model\helpdesk\Utility\MailboxProtocol;
use App\Model\helpdesk\Ticket\Ticket_source; use App\Model\helpdesk\Ticket\Ticket_source;
use App\Model\helpdesk\Ticket\Ticket_Priority; use App\Model\helpdesk\Ticket\Ticket_Thread;
use App\Model\helpdesk\Ticket\Tickets; use App\Model\helpdesk\Ticket\Tickets;
// classes // classes
use PhpImap\Mailbox as ImapMailbox; use App\Model\helpdesk\Utility\MailboxProtocol;
use PhpImap\IncomingMail;
use PhpImap\IncomingMailAttachment;
use \ForceUTF8\Encoding;
use App;
use DB;
use Crypt; use Crypt;
use Schedule;
use File; use File;
use Artisan; use ForceUTF8\Encoding;
use Exception; use PhpImap\Mailbox as ImapMailbox;
/** /**
* MailController * MailController.
* *
* @package Controllers
* @subpackage Controller
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class MailController extends Controller { class MailController extends Controller
{
/** /**
* constructor * constructor
* Create a new controller instance. * Create a new controller instance.
*
* @param type TicketController $TicketController * @param type TicketController $TicketController
*/ */
public function __construct(TicketController $TicketController) { public function __construct(TicketController $TicketController)
{
$this->TicketController = $TicketController; $this->TicketController = $TicketController;
} }
/** /**
* Reademails * Reademails.
*
* @return type * @return type
*/ */
public function readmails(Emails $emails, Email $settings_email, System $system, Ticket $ticket) { public function readmails(Emails $emails, Email $settings_email, System $system, Ticket $ticket)
{
// $path_url = $system->first()->url; // $path_url = $system->first()->url;
if ($settings_email->first()->email_fetching == 1) { if ($settings_email->first()->email_fetching == 1) {
if ($settings_email->first()->all_emails == 1) { if ($settings_email->first()->all_emails == 1) {
@@ -86,11 +79,11 @@ class MailController extends Controller {
$protocol = $e_mail->mailbox_protocol; $protocol = $e_mail->mailbox_protocol;
$get_mailboxprotocol = MailboxProtocol::where('id', '=', $protocol)->first(); $get_mailboxprotocol = MailboxProtocol::where('id', '=', $protocol)->first();
$protocol = $get_mailboxprotocol->value; $protocol = $get_mailboxprotocol->value;
$imap_config = '{' . $host . ':' . $port . $protocol . '}INBOX'; $imap_config = '{'.$host.':'.$port.$protocol.'}INBOX';
$password = Crypt::decrypt($e_mail->password); $password = Crypt::decrypt($e_mail->password);
$mailbox = new ImapMailbox($imap_config, $e_mail->email_address, $password, __DIR__); $mailbox = new ImapMailbox($imap_config, $e_mail->email_address, $password, __DIR__);
$mails = array(); $mails = [];
$mailsIds = $mailbox->searchMailBox('SINCE ' . date('d-M-Y', strtotime("-1 day"))); $mailsIds = $mailbox->searchMailBox('SINCE '.date('d-M-Y', strtotime('-1 day')));
if (!$mailsIds) { if (!$mailsIds) {
die('Mailbox is empty'); die('Mailbox is empty');
} }
@@ -112,15 +105,15 @@ class MailController extends Controller {
} }
$date = $mail->date; $date = $mail->date;
$datetime = $overview[0]->date; $datetime = $overview[0]->date;
$date_time = explode(" ", $datetime); $date_time = explode(' ', $datetime);
$date = $date_time[1] . "-" . $date_time[2] . "-" . $date_time[3] . " " . $date_time[4]; $date = $date_time[1].'-'.$date_time[2].'-'.$date_time[3].' '.$date_time[4];
$date = date('Y-m-d H:i:s', strtotime($date)); $date = date('Y-m-d H:i:s', strtotime($date));
// dd($date); // dd($date);
if (isset($mail->subject)) { if (isset($mail->subject)) {
$subject = $mail->subject; $subject = $mail->subject;
} else { } else {
$subject = "No Subject"; $subject = 'No Subject';
} }
// dd($subject); // dd($subject);
@@ -128,7 +121,7 @@ class MailController extends Controller {
$fromaddress = $mail->fromAddress; $fromaddress = $mail->fromAddress;
$ticket_source = Ticket_source::where('name', '=', 'email')->first(); $ticket_source = Ticket_source::where('name', '=', 'email')->first();
$source = $ticket_source->id; $source = $ticket_source->id;
$phone = ""; $phone = '';
$assign = $get_helptopic->auto_assign; $assign = $get_helptopic->auto_assign;
$form_data = null; $form_data = null;
@@ -141,7 +134,7 @@ class MailController extends Controller {
$thread_id = $thread_id; $thread_id = $thread_id;
foreach ($mail->getAttachments() as $attachment) { foreach ($mail->getAttachments() as $attachment) {
$support = "support"; $support = 'support';
// echo $_SERVER['DOCUMENT_ROOT']; // echo $_SERVER['DOCUMENT_ROOT'];
$dir_img_paths = __DIR__; $dir_img_paths = __DIR__;
$dir_img_path = explode('/code', $dir_img_paths); $dir_img_path = explode('/code', $dir_img_paths);
@@ -150,7 +143,7 @@ class MailController extends Controller {
// var_dump($attachment->filePath); // var_dump($attachment->filePath);
// dd($filepath); // dd($filepath);
// $path = $dir_img_path[0]."/code/public/".$filepath[1]; // $path = $dir_img_path[0]."/code/public/".$filepath[1];
$path = public_path() . $filepath[1]; $path = public_path().$filepath[1];
// dd($path); // dd($path);
$filesize = filesize($path); $filesize = filesize($path);
$file_data = file_get_contents($path); $file_data = file_get_contents($path);
@@ -159,28 +152,28 @@ class MailController extends Controller {
$string = str_replace('-', '', $attachment->name); $string = str_replace('-', '', $attachment->name);
$filename = explode('src', $attachment->filePath); $filename = explode('src', $attachment->filePath);
$filename = str_replace('\\', '', $filename); $filename = str_replace('\\', '', $filename);
$body = str_replace("cid:" . $imageid, $filepath[1], $body); $body = str_replace('cid:'.$imageid, $filepath[1], $body);
$pos = strpos($body, $filepath[1]); $pos = strpos($body, $filepath[1]);
if ($pos == false) { if ($pos == false) {
if ($settings_email->first()->attachment == 1) { if ($settings_email->first()->attachment == 1) {
$upload = new Ticket_attachments; $upload = new Ticket_attachments();
$upload->file = $file_data; $upload->file = $file_data;
$upload->thread_id = $thread_id; $upload->thread_id = $thread_id;
$upload->name = $filepath[1]; $upload->name = $filepath[1];
$upload->type = $ext; $upload->type = $ext;
$upload->size = $filesize; $upload->size = $filesize;
$upload->poster = "ATTACHMENT"; $upload->poster = 'ATTACHMENT';
$upload->save(); $upload->save();
} }
} else { } else {
$upload = new Ticket_attachments; $upload = new Ticket_attachments();
$upload->file = $file_data; $upload->file = $file_data;
$upload->thread_id = $thread_id; $upload->thread_id = $thread_id;
$upload->name = $filepath[1]; $upload->name = $filepath[1];
$upload->type = $ext; $upload->type = $ext;
$upload->size = $filesize; $upload->size = $filesize;
$upload->poster = "INLINE"; $upload->poster = 'INLINE';
$upload->save(); $upload->save();
} }
unlink($path); unlink($path);
@@ -198,35 +191,45 @@ class MailController extends Controller {
} }
/** /**
* separate reply * separate reply.
* @param type $body *
* @param type $body
*
* @return type string * @return type string
*/ */
public function separate_reply($body) { public function separate_reply($body)
{
$body2 = explode('---Reply above this line---', $body); $body2 = explode('---Reply above this line---', $body);
$body3 = $body2[0]; $body3 = $body2[0];
return $body3; return $body3;
} }
/** /**
* Decode Imap text * Decode Imap text.
*
* @param type $str * @param type $str
*
* @return type string * @return type string
*/ */
public function decode_imap_text($str) { public function decode_imap_text($str)
{
$result = ''; $result = '';
$decode_header = imap_mime_header_decode($str); $decode_header = imap_mime_header_decode($str);
foreach ($decode_header AS $obj) { foreach ($decode_header as $obj) {
$result .= htmlspecialchars(rtrim($obj->text, "\t")); $result .= htmlspecialchars(rtrim($obj->text, "\t"));
} }
return $result; return $result;
} }
/** /**
* fetch_attachments * fetch_attachments.
*
* @return type * @return type
*/ */
public function fetch_attachments() { public function fetch_attachments()
{
$uploads = Upload::all(); $uploads = Upload::all();
foreach ($uploads as $attachment) { foreach ($uploads as $attachment) {
$image = @imagecreatefromstring($attachment->file); $image = @imagecreatefromstring($attachment->file);
@@ -234,24 +237,26 @@ class MailController extends Controller {
imagejpeg($image, null, 80); imagejpeg($image, null, 80);
$data = ob_get_contents(); $data = ob_get_contents();
ob_end_clean(); ob_end_clean();
$var = '<a href="" target="_blank"><img src="data:image/jpg;base64,' . base64_encode($data) . '"/></a>'; $var = '<a href="" target="_blank"><img src="data:image/jpg;base64,'.base64_encode($data).'"/></a>';
echo '<br/><span class="mailbox-attachment-icon has-img">' . $var . '</span>'; echo '<br/><span class="mailbox-attachment-icon has-img">'.$var.'</span>';
} }
} }
/** /**
* function to load data * function to load data.
* @param type $id *
* @param type $id
*
* @return type file * @return type file
*/ */
public function get_data($id) { public function get_data($id)
{
$attachments = App\Model\helpdesk\Ticket\Ticket_attachments::where('id', '=', $id)->get(); $attachments = App\Model\helpdesk\Ticket\Ticket_attachments::where('id', '=', $id)->get();
foreach ($attachments as $attachment) { foreach ($attachments as $attachment) {
header('Content-type: application/' . $attachment->type . ''); header('Content-type: application/'.$attachment->type.'');
header('Content-Disposition: inline; filename=' . $attachment->name . ''); header('Content-Disposition: inline; filename='.$attachment->name.'');
header('Content-Transfer-Encoding: binary'); header('Content-Transfer-Encoding: binary');
echo $attachment->file; echo $attachment->file;
} }
} }
} }

View File

@@ -5,38 +5,35 @@ namespace App\Http\Controllers\Agent\helpdesk;
// controllers // controllers
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
// Model // Model
use App\User;
use App\Model\helpdesk\Settings\Company;
use App\Model\helpdesk\Agent\Teams;
use App\Model\helpdesk\Agent\Department; use App\Model\helpdesk\Agent\Department;
use App\Model\helpdesk\Utility\Log_notification; use App\Model\helpdesk\Agent\Teams;
use App\Model\helpdesk\Settings\Company;
use App\Model\helpdesk\settings\Email; use App\Model\helpdesk\settings\Email;
use App\Model\helpdesk\Utility\Log_notification;
use App\User;
// classes // classes
use Exception;
/** /**
* NotificationController * NotificationController
* This controller is used to send daily notifications * This controller is used to send daily notifications.
* *
* @package Controllers
* @subpackage Controller
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class NotificationController extends Controller { class NotificationController extends Controller
{
/** /**
* This function is for sending daily report/notification about the system * This function is for sending daily report/notification about the system.
* */ * */
public function send_notification() { public function send_notification()
{
//fetching email settings //fetching email settings
$email = Email::where('id', '=', '1')->first(); $email = Email::where('id', '=', '1')->first();
// checking if the daily notification is enabled or not // checking if the daily notification is enabled or not
if ($email->notification_cron == 1) { if ($email->notification_cron == 1) {
// checking if current date is equal to the last entered daily notification log // checking if current date is equal to the last entered daily notification log
$notification = Log_notification::where('log', '=', 'NOT-1')->orderBy('id', 'DESC')->first(); $notification = Log_notification::where('log', '=', 'NOT-1')->orderBy('id', 'DESC')->first();
$date = explode(" ", $notification->created_at); $date = explode(' ', $notification->created_at);
if (Date('Y-m-d') == $date[0]) { if (date('Y-m-d') == $date[0]) {
} else { } else {
// creating a daily notification log // creating a daily notification log
Log_notification::create(['log' => 'NOT-1']); Log_notification::create(['log' => 'NOT-1']);
@@ -54,28 +51,33 @@ class NotificationController extends Controller {
} }
/** /**
* Admin Notification/Report * Admin Notification/Report.
*
* @param company * @param company
*
* @return mail * @return mail
* */ * */
public function send_notification_to_admin($company) { public function send_notification_to_admin($company)
{
// get all admin users // get all admin users
$users = User::where('role', '=', 'admin')->get(); $users = User::where('role', '=', 'admin')->get();
foreach ($users as $user) { foreach ($users as $user) {
// Send notification details to admin // Send notification details to admin
$email = $user->email; $email = $user->email;
$user_name = $user->first_name . " " . $user->last_name; $user_name = $user->first_name.' '.$user->last_name;
\Mail::send('emails.notifications.admin', ['company' => $company, 'name' => $user_name], function ($message)use ($email, $user_name, $company) { \Mail::send('emails.notifications.admin', ['company' => $company, 'name' => $user_name], function ($message) use ($email, $user_name, $company) {
$message->to($email, $user_name)->subject($company . ' Daily Report '); $message->to($email, $user_name)->subject($company.' Daily Report ');
}); });
} }
} }
/** /**
* Department Manager Notification/Report * Department Manager Notification/Report.
*
* @return mail * @return mail
* */ * */
public function send_notification_to_manager($company) { public function send_notification_to_manager($company)
{
// get all department managers // get all department managers
$depts = Department::all(); $depts = Department::all();
foreach ($depts as $dept) { foreach ($depts as $dept) {
@@ -85,9 +87,9 @@ class NotificationController extends Controller {
foreach ($users as $user) { foreach ($users as $user) {
// Send notification details to manager of a department // Send notification details to manager of a department
$email = $user->email; $email = $user->email;
$user_name = $user->first_name . " " . $user->last_name; $user_name = $user->first_name.' '.$user->last_name;
\Mail::send('emails.notifications.manager', ['company' => $company, 'name' => $user_name, 'dept_id' => $dept->id, 'dept_name' => $dept->name], function ($message)use ($email, $user_name, $company, $dept_name) { \Mail::send('emails.notifications.manager', ['company' => $company, 'name' => $user_name, 'dept_id' => $dept->id, 'dept_name' => $dept->name], function ($message) use ($email, $user_name, $company, $dept_name) {
$message->to($email, $user_name)->subject($company . ' Daily Report for department manager of ' . $dept_name . ' department.'); $message->to($email, $user_name)->subject($company.' Daily Report for department manager of '.$dept_name.' department.');
}); });
} }
} }
@@ -95,10 +97,12 @@ class NotificationController extends Controller {
} }
/** /**
* Team Lead Notification/Report * Team Lead Notification/Report.
*
* @return mail * @return mail
* */ * */
public function send_notification_to_team_lead($company) { public function send_notification_to_team_lead($company)
{
// get all Team leads // get all Team leads
$teams = Teams::all(); $teams = Teams::all();
foreach ($teams as $team) { foreach ($teams as $team) {
@@ -108,9 +112,9 @@ class NotificationController extends Controller {
foreach ($users as $user) { foreach ($users as $user) {
// Send notification details to team lead // Send notification details to team lead
$email = $user->email; $email = $user->email;
$user_name = $user->first_name . " " . $user->last_name; $user_name = $user->first_name.' '.$user->last_name;
\Mail::send('emails.notifications.lead', ['company' => $company, 'name' => $user_name, 'team_id' => $team->id], function ($message)use ($email, $user_name, $company, $team_name) { \Mail::send('emails.notifications.lead', ['company' => $company, 'name' => $user_name, 'team_id' => $team->id], function ($message) use ($email, $user_name, $company, $team_name) {
$message->to($email, $user_name)->subject($company . ' Daily Report for Team Lead of team ' . $team_name); $message->to($email, $user_name)->subject($company.' Daily Report for Team Lead of team '.$team_name);
}); });
} }
} }
@@ -118,35 +122,40 @@ class NotificationController extends Controller {
} }
/** /**
* Agent Notification/Report * Agent Notification/Report.
*
* @return mail * @return mail
* */ * */
public function send_notification_to_agent($company) { public function send_notification_to_agent($company)
{
// get all agents users // get all agents users
$users = User::where('role', '=', 'agent')->get(); $users = User::where('role', '=', 'agent')->get();
foreach ($users as $user) { foreach ($users as $user) {
// Send notification details to all the agents // Send notification details to all the agents
$email = $user->email; $email = $user->email;
$user_name = $user->first_name . " " . $user->last_name; $user_name = $user->first_name.' '.$user->last_name;
\Mail::send('emails.notifications.agent', ['company' => $company, 'name' => $user_name, 'user_id' => 1], function ($message)use ($email, $user_name, $company) { \Mail::send('emails.notifications.agent', ['company' => $company, 'name' => $user_name, 'user_id' => 1], function ($message) use ($email, $user_name, $company) {
$message->to($email, $user_name)->subject($company . ' Daily Report for Agents'); $message->to($email, $user_name)->subject($company.' Daily Report for Agents');
}); });
} }
} }
/** /**
* Fetching company name * Fetching company name.
*
* @return type variable * @return type variable
*/ */
public function company() { public function company()
{
// fetching comapny model // fetching comapny model
$company = Company::Where('id', '=', '1')->first(); $company = Company::Where('id', '=', '1')->first();
// fetching company name // fetching company name
if ($company->company_name == null) { if ($company->company_name == null) {
$company = "Support Center"; $company = 'Support Center';
} else { } else {
$company = $company->company_name; $company = $company->company_name;
} }
return $company; return $company;
} }

View File

@@ -6,13 +6,11 @@ namespace App\Http\Controllers\Agent\helpdesk;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
// requests // requests
use App\Http\Requests\helpdesk\OrganizationRequest; use App\Http\Requests\helpdesk\OrganizationRequest;
/* include organization model */ /* include organization model */
use App\Http\Requests\helpdesk\OrganizationUpdate; use App\Http\Requests\helpdesk\OrganizationUpdate;
// models // models
/* Define OrganizationRequest to validate the create form */ /* Define OrganizationRequest to validate the create form */
use App\Model\helpdesk\Agent_panel\Organization; use App\Model\helpdesk\Agent_panel\Organization;
/* Define OrganizationUpdate to validate the create form */ /* Define OrganizationUpdate to validate the create form */
use App\Model\helpdesk\Agent_panel\User_org; use App\Model\helpdesk\Agent_panel\User_org;
// classes // classes
@@ -22,21 +20,21 @@ use Exception;
* OrganizationController * OrganizationController
* This controller is used to CRUD organization detail. * This controller is used to CRUD organization detail.
* *
* @package Controllers
* @subpackage Controller
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class OrganizationController extends Controller { class OrganizationController extends Controller
{
/** /**
* Create a new controller instance. * Create a new controller instance.
* constructor to check * constructor to check
* 1. authentication * 1. authentication
* 2. user roles * 2. user roles
* 3. roles must be agent * 3. roles must be agent.
*
* @return void * @return void
*/ */
public function __construct() { public function __construct()
{
// checking for authentication // checking for authentication
$this->middleware('auth'); $this->middleware('auth');
// checking if the role is agent // checking if the role is agent
@@ -45,10 +43,13 @@ class OrganizationController extends Controller {
/** /**
* Display a listing of the resource. * Display a listing of the resource.
*
* @param type Organization $org * @param type Organization $org
*
* @return type Response * @return type Response
*/ */
public function index() { public function index()
{
try { try {
/* get all values of table organization */ /* get all values of table organization */
return view('themes.default1.agent.helpdesk.organization.index'); return view('themes.default1.agent.helpdesk.organization.index');
@@ -58,10 +59,12 @@ class OrganizationController extends Controller {
} }
/** /**
* This function is used to display the list of Organizations * This function is used to display the list of Organizations.
*
* @return datatable * @return datatable
*/ */
public function org_list() { public function org_list()
{
// chumper datable package call to display Advance datatable // chumper datable package call to display Advance datatable
return \Datatable::collection(Organization::all()) return \Datatable::collection(Organization::all())
/* searchable name */ /* searchable name */
@@ -73,28 +76,31 @@ class OrganizationController extends Controller {
// return $model->name; // return $model->name;
if (strlen($model->name) > 20) { if (strlen($model->name) > 20) {
$orgname = substr($model->name, 0, 25); $orgname = substr($model->name, 0, 25);
$orgname = substr($orgname, 0, strrpos($orgname, ' ')) . ' ...'; $orgname = substr($orgname, 0, strrpos($orgname, ' ')).' ...';
} else { } else {
$orgname = $model->name; $orgname = $model->name;
} }
return $orgname; return $orgname;
}) })
/* column website */ /* column website */
->addColumn('website', function ($model) { ->addColumn('website', function ($model) {
$website = $model->website; $website = $model->website;
return $website; return $website;
}) })
/* column phone number */ /* column phone number */
->addColumn('phone', function ($model) { ->addColumn('phone', function ($model) {
$phone = $model->phone; $phone = $model->phone;
return $phone; return $phone;
}) })
/* column action buttons */ /* column action buttons */
->addColumn('Actions', function ($model) { ->addColumn('Actions', function ($model) {
// displaying action buttons // displaying action buttons
// modal popup to delete data // modal popup to delete data
return '<span data-toggle="modal" data-target="#deletearticle' . $model->id . '"><a href="#" ><button class="btn btn-danger btn-xs"></a> ' . \Lang::get('lang.delete') . ' </button></span>&nbsp;<a href="' . route('organizations.edit', $model->id) . '" class="btn btn-warning btn-xs">' . \Lang::get('lang.edit') . '</a>&nbsp;<a href="' . route('organizations.show', $model->id) . '" class="btn btn-primary btn-xs">' . \Lang::get('lang.view') . '</a> return '<span data-toggle="modal" data-target="#deletearticle'.$model->id.'"><a href="#" ><button class="btn btn-danger btn-xs"></a> '.\Lang::get('lang.delete').' </button></span>&nbsp;<a href="'.route('organizations.edit', $model->id).'" class="btn btn-warning btn-xs">'.\Lang::get('lang.edit').'</a>&nbsp;<a href="'.route('organizations.show', $model->id).'" class="btn btn-primary btn-xs">'.\Lang::get('lang.view').'</a>
<div class="modal fade" id="deletearticle' . $model->id . '"> <div class="modal fade" id="deletearticle'.$model->id.'">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
@@ -102,11 +108,11 @@ class OrganizationController extends Controller {
<h4 class="modal-title">Are You Sure ?</h4> <h4 class="modal-title">Are You Sure ?</h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
' . $model->user_name . ' '.$model->user_name.'
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">Close</button> <button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">Close</button>
<a href="' . route('org.delete', $model->id) . '"><button class="btn btn-danger">delete</button></a> <a href="'.route('org.delete', $model->id).'"><button class="btn btn-danger">delete</button></a>
</div> </div>
</div><!-- /.modal-content --> </div><!-- /.modal-content -->
</div><!-- /.modal-dialog --> </div><!-- /.modal-dialog -->
@@ -117,9 +123,11 @@ class OrganizationController extends Controller {
/** /**
* Show the form for creating a new organization. * Show the form for creating a new organization.
*
* @return type Response * @return type Response
*/ */
public function create() { public function create()
{
try { try {
return view('themes.default1.agent.helpdesk.organization.create'); return view('themes.default1.agent.helpdesk.organization.create');
} catch (Exception $e) { } catch (Exception $e) {
@@ -129,11 +137,14 @@ class OrganizationController extends Controller {
/** /**
* Store a newly created organization in storage. * Store a newly created organization in storage.
* @param type Organization $org *
* @param type Organization $org
* @param type OrganizationRequest $request * @param type OrganizationRequest $request
*
* @return type Redirect * @return type Redirect
*/ */
public function store(Organization $org, OrganizationRequest $request) { public function store(Organization $org, OrganizationRequest $request)
{
try { try {
/* Insert the all input request to organization table */ /* Insert the all input request to organization table */
/* Check whether function success or not */ /* Check whether function success or not */
@@ -152,11 +163,14 @@ class OrganizationController extends Controller {
/** /**
* Display the specified organization. * Display the specified organization.
* @param type $id *
* @param type $id
* @param type Organization $org * @param type Organization $org
*
* @return type view * @return type view
*/ */
public function show($id, Organization $org) { public function show($id, Organization $org)
{
try { try {
/* select the field by id */ /* select the field by id */
$orgs = $org->whereId($id)->first(); $orgs = $org->whereId($id)->first();
@@ -169,11 +183,14 @@ class OrganizationController extends Controller {
/** /**
* Show the form for editing the specified organization. * Show the form for editing the specified organization.
* @param type $id *
* @param type $id
* @param type Organization $org * @param type Organization $org
*
* @return type view * @return type view
*/ */
public function edit($id, Organization $org) { public function edit($id, Organization $org)
{
try { try {
/* select the field by id */ /* select the field by id */
$orgs = $org->whereId($id)->first(); $orgs = $org->whereId($id)->first();
@@ -186,12 +203,15 @@ class OrganizationController extends Controller {
/** /**
* Update the specified organization in storage. * Update the specified organization in storage.
* @param type $id *
* @param type Organization $org * @param type $id
* @param type Organization $org
* @param type OrganizationUpdate $request * @param type OrganizationUpdate $request
*
* @return type Redirect * @return type Redirect
*/ */
public function update($id, Organization $org, OrganizationUpdate $request) { public function update($id, Organization $org, OrganizationUpdate $request)
{
/* select the field by id */ /* select the field by id */
$orgs = $org->whereId($id)->first(); $orgs = $org->whereId($id)->first();
@@ -213,10 +233,13 @@ class OrganizationController extends Controller {
/** /**
* Delete a specified organization from storage. * Delete a specified organization from storage.
*
* @param type int $id * @param type int $id
*
* @return type Redirect * @return type Redirect
*/ */
public function destroy($id, Organization $org, User_org $user_org) { public function destroy($id, Organization $org, User_org $user_org)
{
/* select the field by id */ /* select the field by id */
$orgs = $org->whereId($id)->first(); $orgs = $org->whereId($id)->first();
@@ -237,11 +260,14 @@ class OrganizationController extends Controller {
} }
/** /**
* Soring an organization head * Soring an organization head.
* @param type $id *
* @param type $id
*
* @return type boolean * @return type boolean
*/ */
public function Head_Org($id) { public function Head_Org($id)
{
// get the user to make organization head // get the user to make organization head
$head_user = \Input::get('user'); $head_user = \Input::get('user');
// get an instance of the selected organization // get an instance of the selected organization
@@ -249,7 +275,7 @@ class OrganizationController extends Controller {
$org_head->head = $head_user; $org_head->head = $head_user;
// save the user to organization head // save the user to organization head
$org_head->save(); $org_head->save();
return 1; return 1;
} }
} }

View File

@@ -3,56 +3,39 @@
namespace App\Http\Controllers\Agent\helpdesk; namespace App\Http\Controllers\Agent\helpdesk;
// controllers // controllers
use App\Http\Controllers\Controller; use App\Http\Controllers\Common\SettingsController;use App\Http\Controllers\Controller;
use App\Http\Controllers\Agent\helpdesk\TicketController;
use App\Http\Controllers\Common\SettingsController;
// requests // requests
use App\Http\Requests\helpdesk\CreateTicketRequest;
use App\Http\Requests\helpdesk\TicketRequest;
use App\Http\Requests\helpdesk\TicketEditRequest;
// models // models
use App\Model\helpdesk\Email\Banlist;
use App\Model\helpdesk\Ticket\Tickets;
use App\Model\helpdesk\Ticket\Ticket_attachments;
use App\Model\helpdesk\Ticket\Ticket_Collaborator;
use App\Model\helpdesk\Ticket\Ticket_Thread;
use App\Model\helpdesk\Settings\Company;
use App\Model\helpdesk\Settings\System;
use App\Model\helpdesk\Settings\Alert;
use App\Model\helpdesk\Ticket\Ticket_Status;
use App\Model\helpdesk\Email\Emails;
use App\Model\helpdesk\Agent\Department; use App\Model\helpdesk\Agent\Department;
use App\User; use App\User;
// classes // classes
use Auth; use Auth;
use Hash;
use Input;
use Mail;
use PDF;
/** /**
* TicketController2 * TicketController2.
* *
* @package Controllers
* @subpackage Controller
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class Ticket2Controller extends Controller { class Ticket2Controller extends Controller
{
/** /**
* Create a new controller instance. * Create a new controller instance.
*
* @return type response * @return type response
*/ */
public function __construct() { public function __construct()
{
SettingsController::smtp(); SettingsController::smtp();
$this->middleware('auth'); $this->middleware('auth');
} }
/** /**
* Show the Inbox ticket list page * Show the Inbox ticket list page.
*
* @return type response * @return type response
*/ */
public function deptopen($id) { public function deptopen($id)
{
$dept = Department::where('name', '=', $id)->first(); $dept = Department::where('name', '=', $id)->first();
if (Auth::user()->role == 'agent') { if (Auth::user()->role == 'agent') {
if (Auth::user()->dept_id == $dept->id) { if (Auth::user()->dept_id == $dept->id) {
@@ -66,10 +49,12 @@ class Ticket2Controller extends Controller {
} }
/** /**
* Show the Inbox ticket list page * Show the Inbox ticket list page.
*
* @return type response * @return type response
*/ */
public function deptclose($id) { public function deptclose($id)
{
$dept = Department::where('name', '=', $id)->first(); $dept = Department::where('name', '=', $id)->first();
if (Auth::user()->role == 'agent') { if (Auth::user()->role == 'agent') {
if (Auth::user()->dept_id == $dept->id) { if (Auth::user()->dept_id == $dept->id) {
@@ -83,10 +68,12 @@ class Ticket2Controller extends Controller {
} }
/** /**
* Show the Inbox ticket list page * Show the Inbox ticket list page.
*
* @return type response * @return type response
*/ */
public function deptinprogress($id) { public function deptinprogress($id)
{
$dept = Department::where('name', '=', $id)->first(); $dept = Department::where('name', '=', $id)->first();
if (Auth::user()->role == 'agent') { if (Auth::user()->role == 'agent') {
if (Auth::user()->dept_id == $dept->id) { if (Auth::user()->dept_id == $dept->id) {
@@ -98,5 +85,4 @@ class Ticket2Controller extends Controller {
return view('themes.default1.agent.helpdesk.dept-ticket.inprogress', compact('id')); return view('themes.default1.agent.helpdesk.dept-ticket.inprogress', compact('id'));
} }
} }
} }

File diff suppressed because it is too large Load Diff

View File

@@ -19,30 +19,30 @@ use App\Model\helpdesk\Agent_panel\User_org;
use App\User; use App\User;
// classes // classes
use Auth; use Auth;
use Exception;
use Hash; use Hash;
use Input; use Input;
use Redirect; use Redirect;
use Exception;
/** /**
* UserController * UserController
* This controller is used to CRUD an User details, and proile management of an agent * This controller is used to CRUD an User details, and proile management of an agent.
* *
* @package Controllers
* @subpackage Controller
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class UserController extends Controller { class UserController extends Controller
{
/** /**
* Create a new controller instance. * Create a new controller instance.
* constructor to check * constructor to check
* 1. authentication * 1. authentication
* 2. user roles * 2. user roles
* 3. roles must be agent * 3. roles must be agent.
*
* @return void * @return void
*/ */
public function __construct() { public function __construct()
{
// checking authentication // checking authentication
$this->middleware('auth'); $this->middleware('auth');
// checking if role is agent // checking if role is agent
@@ -51,10 +51,13 @@ class UserController extends Controller {
/** /**
* Display all list of the users. * Display all list of the users.
*
* @param type User $user * @param type User $user
*
* @return type view * @return type view
*/ */
public function index() { public function index()
{
try { try {
/* get all values in Sys_user */ /* get all values in Sys_user */
return view('themes.default1.agent.helpdesk.user.index'); return view('themes.default1.agent.helpdesk.user.index');
@@ -64,10 +67,12 @@ class UserController extends Controller {
} }
/** /**
* This function is used to display the list of users using chumper datatables * This function is used to display the list of users using chumper datatables.
*
* @return datatable * @return datatable
*/ */
public function user_list() { public function user_list()
{
// displaying list of users with chumper datatables // displaying list of users with chumper datatables
return \Datatable::collection(User::where('role', '!=', 'admin')->where('role', '!=', 'agent')->get()) return \Datatable::collection(User::where('role', '!=', 'admin')->where('role', '!=', 'agent')->get())
/* searchable column username */ /* searchable column username */
@@ -78,28 +83,31 @@ class UserController extends Controller {
->addColumn('user_name', function ($model) { ->addColumn('user_name', function ($model) {
if (strlen($model->user_name) > 20) { if (strlen($model->user_name) > 20) {
$username = substr($model->user_name, 0, 30); $username = substr($model->user_name, 0, 30);
$username = substr($username, 0, strrpos($username, ' ')) . ' ...'; $username = substr($username, 0, strrpos($username, ' ')).' ...';
} else { } else {
$username = $model->user_name; $username = $model->user_name;
} }
return $username; return $username;
}) })
/* column email */ /* column email */
->addColumn('email', function ($model) { ->addColumn('email', function ($model) {
$email = $model->email; $email = $model->email;
return $email; return $email;
}) })
/* column phone */ /* column phone */
->addColumn('phone', function ($model) { ->addColumn('phone', function ($model) {
$phone = ""; $phone = '';
if ($model->phone_number) { if ($model->phone_number) {
$phone = $model->ext . ' ' . $model->phone_number; $phone = $model->ext.' '.$model->phone_number;
} }
$mobile = ""; $mobile = '';
if ($model->mobile) { if ($model->mobile) {
$mobile = $model->mobile; $mobile = $model->mobile;
} }
$phone = $phone . "&nbsp;&nbsp;&nbsp;" . $mobile; $phone = $phone.'&nbsp;&nbsp;&nbsp;'.$mobile;
return $phone; return $phone;
}) })
/* column account status */ /* column account status */
@@ -110,6 +118,7 @@ class UserController extends Controller {
} else { } else {
$stat = '<button class="btn btn-danger btn-xs">Inactive</button>'; $stat = '<button class="btn btn-danger btn-xs">Inactive</button>';
} }
return $stat; return $stat;
}) })
/* column ban status */ /* column ban status */
@@ -120,25 +129,29 @@ class UserController extends Controller {
} else { } else {
$stat = '<button class="btn btn-success btn-xs">Active</button>'; $stat = '<button class="btn btn-success btn-xs">Active</button>';
} }
return $stat; return $stat;
}) })
/* column last login date */ /* column last login date */
->addColumn('lastlogin', function ($model) { ->addColumn('lastlogin', function ($model) {
$t = $model->updated_at; $t = $model->updated_at;
return TicketController::usertimezone($t); return TicketController::usertimezone($t);
}) })
/* column actions */ /* column actions */
->addColumn('Actions', function ($model) { ->addColumn('Actions', function ($model) {
return '<a href="' . route('user.edit', $model->id) . '" class="btn btn-warning btn-xs">' . \Lang::get('lang.edit') . '</a>&nbsp; <a href="' . route('user.show', $model->id) . '" class="btn btn-primary btn-xs">' . \Lang::get('lang.view') . '</a>'; return '<a href="'.route('user.edit', $model->id).'" class="btn btn-warning btn-xs">'.\Lang::get('lang.edit').'</a>&nbsp; <a href="'.route('user.show', $model->id).'" class="btn btn-primary btn-xs">'.\Lang::get('lang.view').'</a>';
}) })
->make(); ->make();
} }
/** /**
* Show the form for creating a new users. * Show the form for creating a new users.
*
* @return type view * @return type view
*/ */
public function create() { public function create()
{
try { try {
return view('themes.default1.agent.helpdesk.user.create'); return view('themes.default1.agent.helpdesk.user.create');
} catch (Exception $e) { } catch (Exception $e) {
@@ -148,11 +161,14 @@ class UserController extends Controller {
/** /**
* Store a newly created users in storage. * Store a newly created users in storage.
* @param type User $user *
* @param type User $user
* @param type Sys_userRequest $request * @param type Sys_userRequest $request
*
* @return type redirect * @return type redirect
*/ */
public function store(User $user, Sys_userRequest $request) { public function store(User $user, Sys_userRequest $request)
{
/* insert the input request to sys_user table */ /* insert the input request to sys_user table */
/* Check whether function success or not */ /* Check whether function success or not */
$user->email = $request->input('email'); $user->email = $request->input('email');
@@ -175,14 +191,18 @@ class UserController extends Controller {
/** /**
* Display the specified users. * Display the specified users.
*
* @param type int $id * @param type int $id
* @param type User $user * @param type User $user
*
* @return type view * @return type view
*/ */
public function show($id, User $user) { public function show($id, User $user)
{
try { try {
/* select the field where id = $id(request Id) */ /* select the field where id = $id(request Id) */
$users = $user->whereId($id)->first(); $users = $user->whereId($id)->first();
return view('themes.default1.agent.helpdesk.user.show', compact('users')); return view('themes.default1.agent.helpdesk.user.show', compact('users'));
} catch (Exception $e) { } catch (Exception $e) {
return view('404'); return view('404');
@@ -191,14 +211,18 @@ class UserController extends Controller {
/** /**
* Show the form for editing the specified resource. * Show the form for editing the specified resource.
* @param type int $id *
* @param type int $id
* @param type User $user * @param type User $user
*
* @return type Response * @return type Response
*/ */
public function edit($id, User $user) { public function edit($id, User $user)
{
try { try {
/* select the field where id = $id(request Id) */ /* select the field where id = $id(request Id) */
$users = $user->whereId($id)->first(); $users = $user->whereId($id)->first();
return view('themes.default1.agent.helpdesk.user.edit', compact('users')); return view('themes.default1.agent.helpdesk.user.edit', compact('users'));
} catch (Exception $e) { } catch (Exception $e) {
return redirect()->back()->with('fails', $e->errorInfo[2]); return redirect()->back()->with('fails', $e->errorInfo[2]);
@@ -207,12 +231,15 @@ class UserController extends Controller {
/** /**
* Update the specified user in storage. * Update the specified user in storage.
* @param type int $id *
* @param type User $user * @param type int $id
* @param type User $user
* @param type Sys_userUpdate $request * @param type Sys_userUpdate $request
*
* @return type Response * @return type Response
*/ */
public function update($id, User $user, Sys_userUpdate $request) { public function update($id, User $user, Sys_userUpdate $request)
{
/* select the field where id = $id(request Id) */ /* select the field where id = $id(request Id) */
$users = $user->whereId($id)->first(); $users = $user->whereId($id)->first();
@@ -229,10 +256,12 @@ class UserController extends Controller {
} }
/** /**
* get agent profile page * get agent profile page.
*
* @return type view * @return type view
*/ */
public function getProfile() { public function getProfile()
{
$user = Auth::user(); $user = Auth::user();
try { try {
return view('themes.default1.agent.helpdesk.user.profile', compact('user')); return view('themes.default1.agent.helpdesk.user.profile', compact('user'));
@@ -242,10 +271,12 @@ class UserController extends Controller {
} }
/** /**
* get profile edit page * get profile edit page.
*
* @return type view * @return type view
*/ */
public function getProfileedit() { public function getProfileedit()
{
$user = Auth::user(); $user = Auth::user();
try { try {
return view('themes.default1.agent.helpdesk.user.profile-edit', compact('user')); return view('themes.default1.agent.helpdesk.user.profile-edit', compact('user'));
@@ -255,12 +286,15 @@ class UserController extends Controller {
} }
/** /**
* post profile edit * post profile edit.
* @param type int $id *
* @param type int $id
* @param type ProfileRequest $request * @param type ProfileRequest $request
*
* @return type Redirect * @return type Redirect
*/ */
public function postProfileedit(ProfileRequest $request) { public function postProfileedit(ProfileRequest $request)
{
// geet authenticated user details // geet authenticated user details
$user = Auth::user(); $user = Auth::user();
$user->gender = $request->input('gender'); $user->gender = $request->input('gender');
@@ -284,7 +318,7 @@ class UserController extends Controller {
// fetching upload destination path // fetching upload destination path
$destinationPath = 'lb-faveo/media/profilepic'; $destinationPath = 'lb-faveo/media/profilepic';
// adding a random value to profile picture filename // adding a random value to profile picture filename
$fileName = rand(0000, 9999) . '.' . $name; $fileName = rand(0000, 9999).'.'.$name;
// moving the picture to a destination folder // moving the picture to a destination folder
Input::file('profile_pic')->move($destinationPath, $fileName); Input::file('profile_pic')->move($destinationPath, $fileName);
// saving filename to database // saving filename to database
@@ -292,6 +326,7 @@ class UserController extends Controller {
} else { } else {
try { try {
$user->fill($request->except('profile_pic', 'gender'))->save(); $user->fill($request->except('profile_pic', 'gender'))->save();
return Redirect::route('profile')->with('success', 'Profile Updated sucessfully'); return Redirect::route('profile')->with('success', 'Profile Updated sucessfully');
} catch (Exception $e) { } catch (Exception $e) {
return Redirect::route('profile')->with('success', $e->errorInfo[2]); return Redirect::route('profile')->with('success', $e->errorInfo[2]);
@@ -303,19 +338,23 @@ class UserController extends Controller {
} }
/** /**
* Post profile password * Post profile password.
* @param type int $id *
* @param type int $id
* @param type ProfilePassword $request * @param type ProfilePassword $request
*
* @return type Redirect * @return type Redirect
*/ */
public function postProfilePassword($id, ProfilePassword $request) { public function postProfilePassword($id, ProfilePassword $request)
// get authenticated user {
// get authenticated user
$user = Auth::user(); $user = Auth::user();
// checking if the old password matches the new password // checking if the old password matches the new password
if (Hash::check($request->input('old_password'), $user->getAuthPassword())) { if (Hash::check($request->input('old_password'), $user->getAuthPassword())) {
$user->password = Hash::make($request->input('new_password')); $user->password = Hash::make($request->input('new_password'));
try { try {
$user->save(); $user->save();
return redirect('profile-edit')->with('success1', 'Password Updated sucessfully'); return redirect('profile-edit')->with('success1', 'Password Updated sucessfully');
} catch (Exception $e) { } catch (Exception $e) {
return redirect('profile-edit')->with('fails', $e->errorInfo[2]); return redirect('profile-edit')->with('fails', $e->errorInfo[2]);
@@ -326,25 +365,32 @@ class UserController extends Controller {
} }
/** /**
* Assigning an user to an organization * Assigning an user to an organization.
* @param type $id *
* @param type $id
*
* @return type boolean * @return type boolean
*/ */
public function UserAssignOrg($id) { public function UserAssignOrg($id)
{
$org = Input::get('org'); $org = Input::get('org');
$user_org = new User_org; $user_org = new User_org();
$user_org->org_id = $org; $user_org->org_id = $org;
$user_org->user_id = $id; $user_org->user_id = $id;
$user_org->save(); $user_org->save();
return 1; return 1;
} }
/** /**
* creating an organization in user profile page via modal popup * creating an organization in user profile page via modal popup.
* @param type $id *
* @param type $id
*
* @return type * @return type
*/ */
public function User_Create_Org($id) { public function User_Create_Org($id)
{
// checking if the entered value for website is available in database // checking if the entered value for website is available in database
if (Input::get('website') != null) { if (Input::get('website') != null) {
// checking website // checking website
@@ -356,14 +402,14 @@ class UserController extends Controller {
$check2 = Organization::where('name', '=', Input::get('name'))->first(); $check2 = Organization::where('name', '=', Input::get('name'))->first();
// if any of the fields is not available then return false // if any of the fields is not available then return false
if (\Input::get('name') == null) { if (\Input::get('name') == null) {
return "Name is required"; return 'Name is required';
} elseif ($check2 != null) { } elseif ($check2 != null) {
return "Name should be Unique"; return 'Name should be Unique';
} elseif ($check != null) { } elseif ($check != null) {
return "Website should be Unique"; return 'Website should be Unique';
} else { } else {
// storing organization details and assigning the current user to that organization // storing organization details and assigning the current user to that organization
$org = new Organization; $org = new Organization();
$org->name = Input::get('name'); $org->name = Input::get('name');
$org->phone = Input::get('phone'); $org->phone = Input::get('phone');
$org->website = Input::get('website'); $org->website = Input::get('website');
@@ -371,7 +417,7 @@ class UserController extends Controller {
$org->internal_notes = Input::get('internal'); $org->internal_notes = Input::get('internal');
$org->save(); $org->save();
$user_org = new User_org; $user_org = new User_org();
$user_org->org_id = $org->id; $user_org->org_id = $org->id;
$user_org->user_id = $id; $user_org->user_id = $id;
$user_org->save(); $user_org->save();
@@ -379,5 +425,4 @@ class UserController extends Controller {
return 0; return 0;
} }
} }
} }

View File

@@ -3,47 +3,46 @@
namespace App\Http\Controllers\Agent\kb; namespace App\Http\Controllers\Agent\kb;
// Controllers // Controllers
use App\Http\Controllers\Controller;
use App\Http\Controllers\Agent\kb\SettingsController;
use App\Http\Controllers\Client\kb\UserController;
use App\Http\Controllers\Agent\helpdesk\TicketController; use App\Http\Controllers\Agent\helpdesk\TicketController;
use App\Http\Controllers\Controller;
// Requests // Requests
use App\Http\Requests\kb\ArticleRequest; use App\Http\Requests\kb\ArticleRequest;
use App\Http\Requests\kb\ArticleUpdate; use App\Http\Requests\kb\ArticleUpdate;
// Models // Models
use App\Model\kb\Article; use App\Model\kb\Article;
use App\Model\kb\Category; use App\Model\kb\Category;
use App\Model\kb\Comment;
use App\Model\kb\Relationship; use App\Model\kb\Relationship;
use App\Model\kb\Settings; use App\Model\kb\Settings;
use App\Model\kb\Comment;
// Classes // Classes
use Auth; use Auth;
use Chumper\Datatable\Table; use Chumper\Datatable\Table;
use Datatable; use Datatable;
use DB; use DB;
use Exception;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Redirect; use Redirect;
use Exception;
/** /**
* ArticleController * ArticleController
* This controller is used to CRUD Articles * This controller is used to CRUD Articles.
* *
* @package Controllers
* @subpackage Controller
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class ArticleController extends Controller { class ArticleController extends Controller
{
/** /**
* Create a new controller instance. * Create a new controller instance.
* constructor to check * constructor to check
* 1. authentication * 1. authentication
* 2. user roles * 2. user roles
* 3. roles must be agent * 3. roles must be agent.
*
* @return void * @return void
*/ */
public function __construct() { public function __construct()
{
// checking authentication // checking authentication
$this->middleware('auth'); $this->middleware('auth');
// checking roles // checking roles
@@ -51,16 +50,19 @@ class ArticleController extends Controller {
SettingsController::language(); SettingsController::language();
} }
public function test() { public function test()
{
//$table = $this->setDatatable(); //$table = $this->setDatatable();
return view('themes.default1.agent.kb.article.test'); return view('themes.default1.agent.kb.article.test');
} }
/** /**
* Fetching all the list of articles in a chumper datatable format * Fetching all the list of articles in a chumper datatable format.
*
* @return type void * @return type void
*/ */
public function getData() { public function getData()
{
// returns chumper datatable // returns chumper datatable
return Datatable::collection(Article::All()) return Datatable::collection(Article::All())
/* searcable column name */ /* searcable column name */
@@ -74,13 +76,14 @@ class ArticleController extends Controller {
/* add column Created */ /* add column Created */
->addColumn('Created', function ($model) { ->addColumn('Created', function ($model) {
$t = $model->created_at; $t = $model->created_at;
return TicketController::usertimezone($t); return TicketController::usertimezone($t);
}) })
/* add column action */ /* add column action */
->addColumn('Actions', function ($model) { ->addColumn('Actions', function ($model) {
/* here are all the action buttons and modal popup to delete articles with confirmations */ /* here are all the action buttons and modal popup to delete articles with confirmations */
return '<span data-toggle="modal" data-target="#deletearticle' . $model->id . '"><a href="#" ><button class="btn btn-danger btn-xs"></a> ' . \Lang::get('lang.delete') . ' </button></span>&nbsp;<a href=article/' . $model->id . '/edit class="btn btn-warning btn-xs">' . \Lang::get('lang.edit') . '</a>&nbsp;<a href=show/' . $model->slug . ' class="btn btn-primary btn-xs">' . \Lang::get('lang.view') . '</a> return '<span data-toggle="modal" data-target="#deletearticle'.$model->id.'"><a href="#" ><button class="btn btn-danger btn-xs"></a> '.\Lang::get('lang.delete').' </button></span>&nbsp;<a href=article/'.$model->id.'/edit class="btn btn-warning btn-xs">'.\Lang::get('lang.edit').'</a>&nbsp;<a href=show/'.$model->slug.' class="btn btn-primary btn-xs">'.\Lang::get('lang.view').'</a>
<div class="modal fade" id="deletearticle' . $model->id . '"> <div class="modal fade" id="deletearticle'.$model->id.'">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
@@ -88,11 +91,11 @@ class ArticleController extends Controller {
<h4 class="modal-title">Are You Sure ?</h4> <h4 class="modal-title">Are You Sure ?</h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
' . $model->name . ' '.$model->name.'
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">Close</button> <button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">Close</button>
<a href="article/delete/' . $model->slug . '"><button class="btn btn-danger">delete</button></a> <a href="article/delete/'.$model->slug.'"><button class="btn btn-danger">delete</button></a>
</div> </div>
</div><!-- /.modal-content --> </div><!-- /.modal-content -->
</div><!-- /.modal-dialog --> </div><!-- /.modal-dialog -->
@@ -102,10 +105,12 @@ class ArticleController extends Controller {
} }
/** /**
* List of Articles * List of Articles.
*
* @return type view * @return type view
*/ */
public function index() { public function index()
{
/* show article list */ /* show article list */
try { try {
return view('themes.default1.agent.kb.article.index'); return view('themes.default1.agent.kb.article.index');
@@ -115,11 +120,14 @@ class ArticleController extends Controller {
} }
/** /**
* Creating a Article * Creating a Article.
*
* @param type Category $category * @param type Category $category
*
* @return type view * @return type view
*/ */
public function create(Category $category) { public function create(Category $category)
{
/* get the attributes of the category */ /* get the attributes of the category */
$category = $category->lists('id', 'name'); $category = $category->lists('id', 'name');
/* get the create page */ /* get the create page */
@@ -131,17 +139,20 @@ class ArticleController extends Controller {
} }
/** /**
* Insert the values to the article * Insert the values to the article.
* @param type Article $article *
* @param type Article $article
* @param type ArticleRequest $request * @param type ArticleRequest $request
*
* @return type redirect * @return type redirect
*/ */
public function store(Article $article, ArticleRequest $request) { public function store(Article $article, ArticleRequest $request)
{
// requesting the values to store article data // requesting the values to store article data
$publishTime = $request->input('year') . '-' . $request->input('month') . '-' . $request->input('day') . ' ' . $request->input('hour') . ':' . $request->input('minute') . ':00'; $publishTime = $request->input('year').'-'.$request->input('month').'-'.$request->input('day').' '.$request->input('hour').':'.$request->input('minute').':00';
$sl = $request->input('slug'); $sl = $request->input('slug');
$slug = str_slug($sl, "-"); $slug = str_slug($sl, '-');
$article->slug = $slug; $article->slug = $slug;
$article->publish_time = $publishTime; $article->publish_time = $publishTime;
$article->fill($request->except('created_at', 'slug'))->save(); $article->fill($request->except('created_at', 'slug'))->save();
@@ -155,21 +166,25 @@ class ArticleController extends Controller {
/* insert the values to the article table */ /* insert the values to the article table */
try { try {
$article->fill($request->except('slug'))->save(); $article->fill($request->except('slug'))->save();
return redirect('article')->with('success', 'Article Inserted Successfully'); return redirect('article')->with('success', 'Article Inserted Successfully');
} catch (Exception $e) { } catch (Exception $e) {
return redirect('article')->with('fails', 'Article Not Inserted' . '<li>' . $e->errorInfo[2] . '</li>'); return redirect('article')->with('fails', 'Article Not Inserted'.'<li>'.$e->errorInfo[2].'</li>');
} }
} }
/** /**
* Edit an Article by id * Edit an Article by id.
* @param type Integer $id *
* @param type Article $article * @param type Integer $id
* @param type Article $article
* @param type Relationship $relation * @param type Relationship $relation
* @param type Category $category * @param type Category $category
*
* @return view * @return view
*/ */
public function edit($slug, Article $article, Relationship $relation, Category $category) { public function edit($slug, Article $article, Relationship $relation, Category $category)
{
$aid = $article->where('id', $slug)->first(); $aid = $article->where('id', $slug)->first();
$id = $aid->id; $id = $aid->id;
/* define the selected fields */ /* define the selected fields */
@@ -188,20 +203,23 @@ class ArticleController extends Controller {
} }
/** /**
* Update an Artile by id * Update an Artile by id.
* @param type Integer $id *
* @param type Article $article * @param type Integer $id
* @param type Relationship $relation * @param type Article $article
* @param type Relationship $relation
* @param type ArticleRequest $request * @param type ArticleRequest $request
*
* @return Response * @return Response
*/ */
public function update($slug, Article $article, Relationship $relation, ArticleUpdate $request) { public function update($slug, Article $article, Relationship $relation, ArticleUpdate $request)
{
$aid = $article->where('id', $slug)->first(); $aid = $article->where('id', $slug)->first();
$publishTime = $request->input('year') . '-' . $request->input('month') . '-' . $request->input('day') . ' ' . $request->input('hour') . ':' . $request->input('minute') . ':00'; $publishTime = $request->input('year').'-'.$request->input('month').'-'.$request->input('day').' '.$request->input('hour').':'.$request->input('minute').':00';
$id = $aid->id; $id = $aid->id;
$sl = $request->input('slug'); $sl = $request->input('slug');
$slug = str_slug($sl, "-"); $slug = str_slug($sl, '-');
// dd($slug); // dd($slug);
$article->slug = $slug; $article->slug = $slug;
@@ -221,26 +239,31 @@ class ArticleController extends Controller {
$article->slug = $slug; $article->slug = $slug;
$article->publish_time = $publishTime; $article->publish_time = $publishTime;
$article->save(); $article->save();
return redirect('article')->with('success', 'Article Updated Successfully'); return redirect('article')->with('success', 'Article Updated Successfully');
} catch (Exception $e) { } catch (Exception $e) {
return redirect('article')->with('fails', 'Article Not Updated' . '<li>' . $e->errorInfo[2] . '</li>'); return redirect('article')->with('fails', 'Article Not Updated'.'<li>'.$e->errorInfo[2].'</li>');
} }
} }
/** /**
* Delete an Agent by id * Delete an Agent by id.
* @param type $id *
* @param type $id
* @param type Article $article * @param type Article $article
*
* @return Response * @return Response
*/ */
public function destroy($slug, Article $article, Relationship $relation, Comment $comment) { public function destroy($slug, Article $article, Relationship $relation, Comment $comment)
{
/* delete the selected article from the table */ /* delete the selected article from the table */
$article = $article->where('slug', $slug)->first(); //get the selected article via id $article = $article->where('slug', $slug)->first(); //get the selected article via id
$id = $article->id; $id = $article->id;
$comments = $comment->where('article_id', $id)->get(); $comments = $comment->where('article_id', $id)->get();
if ($comments) { if ($comments) {
foreach ($comments as $comment) foreach ($comments as $comment) {
$comment->delete(); $comment->delete();
}
} }
// deleting relationship // deleting relationship
$relation = $relation->where('article_id', $id)->first(); $relation = $relation->where('article_id', $id)->first();
@@ -260,11 +283,14 @@ class ArticleController extends Controller {
/** /**
* user time zone * user time zone
* fetching timezone * fetching timezone.
*
* @param type $utc * @param type $utc
*
* @return type * @return type
*/ */
static function usertimezone($utc) { public static function usertimezone($utc)
{
$user = Auth::user(); $user = Auth::user();
$tz = $user->timezone; $tz = $user->timezone;
$set = Settings::whereId('1')->first(); $set = Settings::whereId('1')->first();
@@ -275,5 +301,4 @@ class ArticleController extends Controller {
$date = date($format, strtotime($utc) + $offset); $date = date($format, strtotime($utc) + $offset);
echo $date; echo $date;
} }
} }

View File

@@ -3,11 +3,8 @@
namespace App\Http\Controllers\Agent\kb; namespace App\Http\Controllers\Agent\kb;
// Controllers // Controllers
use App\Http\Controllers\client\kb\UserController;
use App\Http\Controllers\admin\kb\ArticleController;
use App\Http\Controllers\Controller;
use App\Http\Controllers\Agent\kb\SettingsController;
use App\Http\Controllers\Agent\helpdesk\TicketController; use App\Http\Controllers\Agent\helpdesk\TicketController;
use App\Http\Controllers\Controller;
// Requests // Requests
use App\Http\Requests\kb\CategoryRequest; use App\Http\Requests\kb\CategoryRequest;
use App\Http\Requests\kb\CategoryUpdate; use App\Http\Requests\kb\CategoryUpdate;
@@ -16,28 +13,28 @@ use App\Model\kb\Category;
use App\Model\kb\Relationship; use App\Model\kb\Relationship;
// Classes // Classes
use Datatable; use Datatable;
use Redirect;
use Exception; use Exception;
use Redirect;
/** /**
* CategoryController * CategoryController
* This controller is used to CRUD category * This controller is used to CRUD category.
* *
* @package Controllers
* @subpackage Controller
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class CategoryController extends Controller { class CategoryController extends Controller
{
/** /**
* Create a new controller instance. * Create a new controller instance.
* constructor to check * constructor to check
* 1. authentication * 1. authentication
* 2. user roles * 2. user roles
* 3. roles must be agent * 3. roles must be agent.
*
* @return void * @return void
*/ */
public function __construct() { public function __construct()
{
// checking authentication // checking authentication
$this->middleware('auth'); $this->middleware('auth');
// checking roles // checking roles
@@ -46,11 +43,14 @@ class CategoryController extends Controller {
} }
/** /**
* Indexing all Category * Indexing all Category.
*
* @param type Category $category * @param type Category $category
*
* @return Response * @return Response
*/ */
public function index() { public function index()
{
/* get the view of index of the catogorys with all attributes /* get the view of index of the catogorys with all attributes
of category model */ of category model */
try { try {
@@ -61,10 +61,12 @@ class CategoryController extends Controller {
} }
/** /**
* fetching category list in chumper datatables * fetching category list in chumper datatables.
*
* @return type chumper datatable * @return type chumper datatable
*/ */
public function getData() { public function getData()
{
/* fetching chumper datatables */ /* fetching chumper datatables */
return Datatable::collection(Category::All()) return Datatable::collection(Category::All())
/* search column name */ /* search column name */
@@ -78,13 +80,14 @@ class CategoryController extends Controller {
/* add column Created */ /* add column Created */
->addColumn('Created', function ($model) { ->addColumn('Created', function ($model) {
$t = $model->created_at; $t = $model->created_at;
return TicketController::usertimezone($t); return TicketController::usertimezone($t);
}) })
/* add column Actions */ /* add column Actions */
/* there are action buttons and modal popup to delete a data column */ /* there are action buttons and modal popup to delete a data column */
->addColumn('Actions', function ($model) { ->addColumn('Actions', function ($model) {
return '<span data-toggle="modal" data-target="#deletecategory' . $model->slug . '"><a href="#" ><button class="btn btn-danger btn-xs"></a>' . \Lang::get("lang.delete") . '</button></span>&nbsp;<a href=category/' . $model->id . '/edit class="btn btn-warning btn-xs">' . \Lang::get("lang.edit") . '</a>&nbsp;<a href=article-list class="btn btn-primary btn-xs">' . \Lang::get("lang.view") . '</a> return '<span data-toggle="modal" data-target="#deletecategory'.$model->slug.'"><a href="#" ><button class="btn btn-danger btn-xs"></a>'.\Lang::get('lang.delete').'</button></span>&nbsp;<a href=category/'.$model->id.'/edit class="btn btn-warning btn-xs">'.\Lang::get('lang.edit').'</a>&nbsp;<a href=article-list class="btn btn-primary btn-xs">'.\Lang::get('lang.view').'</a>
<div class="modal fade" id="deletecategory' . $model->slug . '"> <div class="modal fade" id="deletecategory'.$model->slug.'">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
@@ -92,11 +95,11 @@ class CategoryController extends Controller {
<h4 class="modal-title">Are You Sure ?</h4> <h4 class="modal-title">Are You Sure ?</h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
' . $model->name . ' '.$model->name.'
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">Close</button> <button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">Close</button>
<a href="category/delete/' . $model->id . '"><button class="btn btn-danger">delete</button></a> <a href="category/delete/'.$model->id.'"><button class="btn btn-danger">delete</button></a>
</div> </div>
</div> </div>
</div> </div>
@@ -106,11 +109,14 @@ class CategoryController extends Controller {
} }
/** /**
* Create a Category * Create a Category.
*
* @param type Category $category * @param type Category $category
*
* @return type view * @return type view
*/ */
public function create(Category $category) { public function create(Category $category)
{
/* Get the all attributes in the category model */ /* Get the all attributes in the category model */
$category = $category->get(); $category = $category->get();
/* get the view page to create new category with all attributes /* get the view page to create new category with all attributes
@@ -123,32 +129,39 @@ class CategoryController extends Controller {
} }
/** /**
* To store the selected category * To store the selected category.
* @param type Category $category *
* @param type CategoryRequest $request * @param type Category $category
* @param type CategoryRequest $request
*
* @return type Redirect * @return type Redirect
*/ */
public function store(Category $category, CategoryRequest $request) { public function store(Category $category, CategoryRequest $request)
{
/* Get the whole request from the form and insert into table via model */ /* Get the whole request from the form and insert into table via model */
$sl = $request->input('slug'); $sl = $request->input('slug');
$slug = str_slug($sl, "-"); $slug = str_slug($sl, '-');
$category->slug = $slug; $category->slug = $slug;
// send success message to index page // send success message to index page
try { try {
$category->fill($request->except('slug'))->save(); $category->fill($request->except('slug'))->save();
return Redirect::back()->with('success', 'Category Inserted Successfully'); return Redirect::back()->with('success', 'Category Inserted Successfully');
} catch (Exception $e) { } catch (Exception $e) {
return Redirect::back()->with('fails', 'Category Not Inserted' . '<li>' . $e->errorInfo[2] . '</li>'); return Redirect::back()->with('fails', 'Category Not Inserted'.'<li>'.$e->errorInfo[2].'</li>');
} }
} }
/** /**
* Show the form for editing the specified category. * Show the form for editing the specified category.
* @param type $slug *
* @param type Category $category * @param type $slug
* @param type Category $category
*
* @return type view * @return type view
*/ */
public function edit($slug, Category $category) { public function edit($slug, Category $category)
{
// fetch the category // fetch the category
$cid = $category->where('id', $slug)->first(); $cid = $category->where('id', $slug)->first();
$id = $cid->id; $id = $cid->id;
@@ -160,17 +173,20 @@ class CategoryController extends Controller {
/** /**
* Update the specified Category in storage. * Update the specified Category in storage.
* @param type $slug *
* @param type Category $category * @param type $slug
* @param type CategoryUpdate $request * @param type Category $category
* @param type CategoryUpdate $request
*
* @return type redirect * @return type redirect
*/ */
public function update($slug, Category $category, CategoryUpdate $request) { public function update($slug, Category $category, CategoryUpdate $request)
{
/* Edit the selected category via id */ /* Edit the selected category via id */
$category = $category->where('id', $slug)->first(); $category = $category->where('id', $slug)->first();
$sl = $request->input('slug'); $sl = $request->input('slug');
$slug = str_slug($sl, "-"); $slug = str_slug($sl, '-');
// dd($slug); // dd($slug);
$category->slug = $slug; $category->slug = $slug;
/* update the values at the table via model according with the request */ /* update the values at the table via model according with the request */
@@ -179,22 +195,25 @@ class CategoryController extends Controller {
$category->fill($request->all())->save(); $category->fill($request->all())->save();
$category->slug = $slug; $category->slug = $slug;
$category->save(); $category->save();
return redirect('category')->with('success', 'Category Updated Successfully'); return redirect('category')->with('success', 'Category Updated Successfully');
} catch (Exception $e) { } catch (Exception $e) {
//redirect to index with fails message //redirect to index with fails message
return redirect('category')->with('fails', 'Category Not Updated' . '<li>' . $e->errorInfo[2] . '</li>'); return redirect('category')->with('fails', 'Category Not Updated'.'<li>'.$e->errorInfo[2].'</li>');
} }
} }
/** /**
* Remove the specified category from storage. * Remove the specified category from storage.
* @param type $id *
* @param type Category $category * @param type $id
* @param type Relationship $relation * @param type Category $category
* @param type Relationship $relation
*
* @return type Redirect * @return type Redirect
*/ */
public function destroy($id, Category $category, Relationship $relation) { public function destroy($id, Category $category, Relationship $relation)
{
$relation = $relation->where('category_id', $id)->first(); $relation = $relation->where('category_id', $id)->first();
if ($relation != null) { if ($relation != null) {
return Redirect::back()->with('fails', 'Category Not Deleted'); return Redirect::back()->with('fails', 'Category Not Deleted');
@@ -204,11 +223,11 @@ class CategoryController extends Controller {
// redirect to index with success message // redirect to index with success message
try { try {
$category->delete(); $category->delete();
return Redirect::back()->with('success', 'Category Deleted Successfully'); return Redirect::back()->with('success', 'Category Deleted Successfully');
} catch (Exception $e) { } catch (Exception $e) {
return Redirect::back()->with('fails', 'Category Not Deleted' . '<li>' . $e->errorInfo[2] . '</li>'); return Redirect::back()->with('fails', 'Category Not Deleted'.'<li>'.$e->errorInfo[2].'</li>');
} }
} }
} }
} }

View File

@@ -2,41 +2,37 @@
namespace App\Http\Controllers\Agent\kb; namespace App\Http\Controllers\Agent\kb;
// controllers // controllersuse App\Http\Controllers\Agent\helpdesk\TicketController;
use App\Http\Controllers\client\kb\UserController;
use App\Http\Controllers\Agent\kb\ArticleController;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Http\Controllers\Agent\kb\SettingsController;
use App\Http\Controllers\Agent\helpdesk\TicketController;
// request // request
use App\Http\Requests\kb\PageRequest; use App\Http\Requests\kb\PageRequest;
use App\Http\Requests\kb\PageUpdate; use App\Http\Requests\kb\PageUpdate;
use Illuminate\Http\Request;
// Model
use App\Model\kb\Page; use App\Model\kb\Page;
// classes // Model
use Datatable; use Datatable;
// classes
use Exception; use Exception;
use Illuminate\Http\Request;
/** /**
* PageController * PageController
* This controller is used to CRUD Pages * This controller is used to CRUD Pages.
* *
* @package Controllers
* @subpackage Controller
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class PageController extends Controller { class PageController extends Controller
{
/** /**
* Create a new controller instance. * Create a new controller instance.
* constructor to check * constructor to check
* 1. authentication * 1. authentication
* 2. user roles * 2. user roles
* 3. roles must be agent * 3. roles must be agent.
*
* @return void * @return void
*/ */
public function __construct(Page $page) { public function __construct(Page $page)
{
// checking authentication // checking authentication
$this->middleware('auth'); $this->middleware('auth');
// checking roles // checking roles
@@ -46,10 +42,12 @@ class PageController extends Controller {
} }
/** /**
* Display the list of pages * Display the list of pages.
*
* @return type * @return type
*/ */
public function index() { public function index()
{
$pages = $this->page->paginate(3); $pages = $this->page->paginate(3);
$pages->setPath('page'); $pages->setPath('page');
try { try {
@@ -60,10 +58,12 @@ class PageController extends Controller {
} }
/** /**
* fetching pages list in chumper datatables * fetching pages list in chumper datatables.
*
* @return type * @return type
*/ */
public function getData() { public function getData()
{
/* fetching chumper datatables */ /* fetching chumper datatables */
return Datatable::collection(Page::All()) return Datatable::collection(Page::All())
/* search column name */ /* search column name */
@@ -77,13 +77,14 @@ class PageController extends Controller {
/* add column Created */ /* add column Created */
->addColumn('Created', function ($model) { ->addColumn('Created', function ($model) {
$t = $model->created_at; $t = $model->created_at;
return TicketController::usertimezone($t); return TicketController::usertimezone($t);
}) })
/* add column Actions */ /* add column Actions */
/* there are action buttons and modal popup to delete a data column */ /* there are action buttons and modal popup to delete a data column */
->addColumn('Actions', function ($model) { ->addColumn('Actions', function ($model) {
return '<span data-toggle="modal" data-target="#deletepage' . $model->id . '"><a href="#" ><button class="btn btn-danger btn-xs"></a> ' . \Lang::get('lang.delete') . '</button></span>&nbsp;<a href=page/' . $model->slug . '/edit class="btn btn-warning btn-xs">' . \Lang::get('lang.edit') . '</a>&nbsp;<a href=pages/' . $model->slug . ' class="btn btn-primary btn-xs">' . \Lang::get('lang.view') . '</a> return '<span data-toggle="modal" data-target="#deletepage'.$model->id.'"><a href="#" ><button class="btn btn-danger btn-xs"></a> '.\Lang::get('lang.delete').'</button></span>&nbsp;<a href=page/'.$model->slug.'/edit class="btn btn-warning btn-xs">'.\Lang::get('lang.edit').'</a>&nbsp;<a href=pages/'.$model->slug.' class="btn btn-primary btn-xs">'.\Lang::get('lang.view').'</a>
<div class="modal fade" id="deletepage' . $model->id . '"> <div class="modal fade" id="deletepage'.$model->id.'">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
@@ -91,11 +92,11 @@ class PageController extends Controller {
<h4 class="modal-title">Are You Sure ?</h4> <h4 class="modal-title">Are You Sure ?</h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
' . $model->name . ' '.$model->name.'
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">Close</button> <button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">Close</button>
<a href="page/delete/' . $model->id . '"><button class="btn btn-danger">delete</button></a> <a href="page/delete/'.$model->id.'"><button class="btn btn-danger">delete</button></a>
</div> </div>
</div> </div>
</div> </div>
@@ -106,23 +107,29 @@ class PageController extends Controller {
/** /**
* Show the form for creating a new resource. * Show the form for creating a new resource.
*
* @return type view * @return type view
*/ */
public function create() { public function create()
{
return view('themes.default1.agent.kb.pages.create'); return view('themes.default1.agent.kb.pages.create');
} }
/** /**
* To insert a value to the table Page * To insert a value to the table Page.
*
* @param type Request $request * @param type Request $request
*
* @return type * @return type
*/ */
public function store(PageRequest $request) { public function store(PageRequest $request)
{
$sl = $request->input('slug'); $sl = $request->input('slug');
$slug = str_slug($sl, "-"); $slug = str_slug($sl, '-');
$this->page->slug = $slug; $this->page->slug = $slug;
try { try {
$this->page->fill($request->except('slug'))->save(); $this->page->fill($request->except('slug'))->save();
return redirect('page')->with('success', 'Page created successfully'); return redirect('page')->with('success', 'Page created successfully');
} catch (Exception $e) { } catch (Exception $e) {
return redirect('page')->with('fails', $e->errorInfo[2]); return redirect('page')->with('fails', $e->errorInfo[2]);
@@ -130,13 +137,17 @@ class PageController extends Controller {
} }
/** /**
* To edit a page * To edit a page.
* @param type $slug *
* @param type $slug
*
* @return type view * @return type view
*/ */
public function edit($slug) { public function edit($slug)
{
try { try {
$page = $this->page->where('slug', $slug)->first(); $page = $this->page->where('slug', $slug)->first();
return view('themes.default1.agent.kb.pages.edit', compact('page')); return view('themes.default1.agent.kb.pages.edit', compact('page'));
} catch (Exception $e) { } catch (Exception $e) {
return redirect('page')->with('fails', $e->errorInfo[2]); return redirect('page')->with('fails', $e->errorInfo[2]);
@@ -144,21 +155,25 @@ class PageController extends Controller {
} }
/** /**
* To update a page * To update a page.
* @param type $slug *
* @param type PageUpdate $request * @param type $slug
* @param type PageUpdate $request
*
* @return type redirect * @return type redirect
*/ */
public function update($slug, PageUpdate $request) { public function update($slug, PageUpdate $request)
{
// get pages with respect to slug // get pages with respect to slug
$pages = $this->page->where('slug', $slug)->first(); $pages = $this->page->where('slug', $slug)->first();
$sl = $request->input('slug'); $sl = $request->input('slug');
$slug = str_slug($sl, "-"); $slug = str_slug($sl, '-');
$this->page->slug = $slug; $this->page->slug = $slug;
try { try {
$pages->fill($request->all())->save(); $pages->fill($request->all())->save();
$pages->slug = $slug; $pages->slug = $slug;
$pages->save(); $pages->save();
return redirect('page')->with('success', 'Your Page Updated Successfully'); return redirect('page')->with('success', 'Your Page Updated Successfully');
} catch (Exception $e) { } catch (Exception $e) {
return redirect('page')->with('fails', $e->errorInfo[2]); return redirect('page')->with('fails', $e->errorInfo[2]);
@@ -166,19 +181,22 @@ class PageController extends Controller {
} }
/** /**
* To Delete a Page * To Delete a Page.
* @param type $id *
* @param type $id
*
* @return type redirect * @return type redirect
*/ */
public function destroy($id) { public function destroy($id)
{
try { try {
// get the page to be deleted // get the page to be deleted
$page = $this->page->whereId($id)->first(); $page = $this->page->whereId($id)->first();
$page->delete(); $page->delete();
return redirect('page')->with('success', 'Page Deleted Successfully'); return redirect('page')->with('success', 'Page Deleted Successfully');
} catch (Exception $e) { } catch (Exception $e) {
return redirect('page')->with('fails', $e->errorInfo[2]); return redirect('page')->with('fails', $e->errorInfo[2]);
} }
} }
} }

View File

@@ -2,54 +2,45 @@
namespace App\Http\Controllers\Agent\kb; namespace App\Http\Controllers\Agent\kb;
// Controllers // Controllersuse App\Http\Controllers\Agent\helpdesk\TicketController;
use App\Http\Controllers\Agent\kb\ArticleController;
use App\Http\Controllers\Agent\helpdesk\TicketController;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
// Request // Request
use App\Http\Requests\kb\FooterRequest;
use App\Http\Requests\kb\ProfilePassword; use App\Http\Requests\kb\ProfilePassword;
use App\Http\Requests\kb\ProfileRequest; use App\Http\Requests\kb\ProfileRequest;
use App\Http\Requests\kb\SettingsRequests; use App\Http\Requests\kb\SettingsRequests;
use App\Http\Requests\kb\SocialRequest;
use Illuminate\Http\Request;
// Model
use App\Model\kb\Comment;
use App\Model\kb\Faq;
use App\Model\kb\Settings;
use App\Model\kb\Side1;
use App\Model\kb\Side2;
use App\Model\kb\Social;
use App\Model\helpdesk\Utility\Timezones;
use App\Model\helpdesk\Utility\Date_format; use App\Model\helpdesk\Utility\Date_format;
// Classes // Model
use App\Model\helpdesk\Utility\Timezones;
use App\Model\kb\Comment;
use App\Model\kb\Settings;
use Auth; use Auth;
// Classes
use Config; use Config;
use Datatable; use Exception;
use Hash; use Hash;
use Illuminate\Http\Request;
use Image; use Image;
use Input; use Input;
use Exception;
/** /**
* SettingsController * SettingsController
* This controller is used to perform settings in the setting page of knowledgebase * This controller is used to perform settings in the setting page of knowledgebase.
* *
* @package Controllers
* @subpackage Controller
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class SettingsController extends Controller { class SettingsController extends Controller
{
/** /**
* Create a new controller instance. * Create a new controller instance.
* constructor to check * constructor to check
* 1. authentication * 1. authentication
* 2. user roles * 2. user roles
* 3. roles must be agent * 3. roles must be agent.
*
* @return void * @return void
*/ */
public function __construct() { public function __construct()
{
// checking authentication // checking authentication
$this->middleware('auth'); $this->middleware('auth');
// checking roles // checking roles
@@ -58,11 +49,12 @@ class SettingsController extends Controller {
} }
/** /**
* to get the settings page * to get the settings page.
*
* @return response * @return response
* @package default
*/ */
public function settings(Settings $settings, Timezones $time, Date_format $date) { public function settings(Settings $settings, Timezones $time, Date_format $date)
{
/* get the setting where the id == 1 */ /* get the setting where the id == 1 */
$settings = $settings->whereId('1')->first(); $settings = $settings->whereId('1')->first();
$time = $time->get(); $time = $time->get();
@@ -73,40 +65,42 @@ class SettingsController extends Controller {
/** /**
* Update the specified resource in storage. * Update the specified resource in storage.
* *
* @param int $id * @param int $id
*
* @return Response * @return Response
*/ */
public function postSettings($id, Settings $settings, SettingsRequests $request) { public function postSettings($id, Settings $settings, SettingsRequests $request)
{
try { try {
/* fetch the values of company request */ /* fetch the values of company request */
$settings = $settings->whereId('1')->first(); $settings = $settings->whereId('1')->first();
if (Input::file('logo')) { if (Input::file('logo')) {
$name = Input::file('logo')->getClientOriginalName(); $name = Input::file('logo')->getClientOriginalName();
$destinationPath = 'lb-faveo/dist/image'; $destinationPath = 'lb-faveo/dist/image';
$fileName = rand(0000, 9999) . '.' . $name; $fileName = rand(0000, 9999).'.'.$name;
//echo $fileName; //echo $fileName;
Input::file('logo')->move($destinationPath, $fileName); Input::file('logo')->move($destinationPath, $fileName);
$settings->logo = $fileName; $settings->logo = $fileName;
//$thDestinationPath = 'dist/th'; //$thDestinationPath = 'dist/th';
Image::make($destinationPath . '/' . $fileName, array( Image::make($destinationPath.'/'.$fileName, [
'width' => 300, 'width' => 300,
'height' => 300, 'height' => 300,
'grayscale' => false, 'grayscale' => false,
))->save('lb-faveo/dist/image/' . $fileName); ])->save('lb-faveo/dist/image/'.$fileName);
} }
if (Input::file('background')) { if (Input::file('background')) {
$name = Input::file('background')->getClientOriginalName(); $name = Input::file('background')->getClientOriginalName();
$destinationPath = 'lb-faveo/dist/image'; $destinationPath = 'lb-faveo/dist/image';
$fileName = rand(0000, 9999) . '.' . $name; $fileName = rand(0000, 9999).'.'.$name;
echo $fileName; echo $fileName;
Input::file('background')->move($destinationPath, $fileName); Input::file('background')->move($destinationPath, $fileName);
$settings->background = $fileName; $settings->background = $fileName;
//$thDestinationPath = 'dist/th'; //$thDestinationPath = 'dist/th';
Image::make($destinationPath . '/' . $fileName, array( Image::make($destinationPath.'/'.$fileName, [
'width' => 300, 'width' => 300,
'height' => 300, 'height' => 300,
'grayscale' => false, 'grayscale' => false,
))->save('lb-faveo/dist/image/' . $fileName); ])->save('lb-faveo/dist/image/'.$fileName);
} }
/* Check whether function success or not */ /* Check whether function success or not */
if ($settings->fill($request->except('logo', 'background'))->save() == true) { if ($settings->fill($request->except('logo', 'background'))->save() == true) {
@@ -123,19 +117,24 @@ class SettingsController extends Controller {
} }
/** /**
* To Moderate the commenting * To Moderate the commenting.
*
* @param type Comment $comment * @param type Comment $comment
*
* @return Response * @return Response
*/ */
public function comment(Comment $comment) { public function comment(Comment $comment)
{
return view('themes.default1.agent.kb.settings.comment'); return view('themes.default1.agent.kb.settings.comment');
} }
/** /**
* getdata * getdata.
* @return type *
* @return type
*/ */
public function getData() { public function getData()
{
return \Datatable::collection(Comment::All()) return \Datatable::collection(Comment::All())
->searchColumns('name', 'email', 'comment', 'created') ->searchColumns('name', 'email', 'comment', 'created')
->orderColumns('name') ->orderColumns('name')
@@ -154,67 +153,79 @@ class SettingsController extends Controller {
->addColumn('status', function ($model) { ->addColumn('status', function ($model) {
$status = $model->status; $status = $model->status;
if ($status == 1) { if ($status == 1) {
return '<p style="color:blue"">' . \Lang::get('lang.published'); return '<p style="color:blue"">'.\Lang::get('lang.published');
} else { } else {
return '<p style="color:red"">' . \Lang::get('lang.not_published'); return '<p style="color:red"">'.\Lang::get('lang.not_published');
} }
}) })
->addColumn('Created', function ($model) { ->addColumn('Created', function ($model) {
return TicketController::usertimezone(date($model->created_at)); return TicketController::usertimezone(date($model->created_at));
}) })
->addColumn('Actions', function ($model) { ->addColumn('Actions', function ($model) {
return '<a href=comment/delete/' . $model->id . ' class="btn btn-danger btn-xs">' . \Lang::get('lang.delete') . '</a>&nbsp;<a href=published/' . $model->id . ' class="btn btn-warning btn-xs">' . \Lang::get('lang.publish') . '</a>'; return '<a href=comment/delete/'.$model->id.' class="btn btn-danger btn-xs">'.\Lang::get('lang.delete').'</a>&nbsp;<a href=published/'.$model->id.' class="btn btn-warning btn-xs">'.\Lang::get('lang.publish').'</a>';
}) })
->make(); ->make();
} }
/** /**
* Admin can publish the comment * Admin can publish the comment.
* @param type $id *
* @param type $id
* @param type Comment $comment * @param type Comment $comment
*
* @return bool * @return bool
*/ */
public function publish($id, Comment $comment) { public function publish($id, Comment $comment)
{
$comment = $comment->whereId($id)->first(); $comment = $comment->whereId($id)->first();
$comment->status = 1; $comment->status = 1;
if ($comment->save()) { if ($comment->save()) {
return redirect('comment')->with('success', $comment->name . '-' . 'Comment Published'); return redirect('comment')->with('success', $comment->name.'-'.'Comment Published');
} else { } else {
return redirect('comment')->with('fails', 'Can not Process'); return redirect('comment')->with('fails', 'Can not Process');
} }
} }
/** /**
* delete the comment * delete the comment.
* @param type $id *
* @param type $id
* @param type Comment $comment * @param type Comment $comment
*
* @return type * @return type
*/ */
public function delete($id, Comment $comment) { public function delete($id, Comment $comment)
{
$comment = $comment->whereId($id)->first(); $comment = $comment->whereId($id)->first();
if ($comment->delete()) { if ($comment->delete()) {
return redirect('comment')->with('success', $comment->name . "'s!" . 'Comment Deleted'); return redirect('comment')->with('success', $comment->name."'s!".'Comment Deleted');
} else { } else {
return redirect('comment')->with('fails', 'Can not Process'); return redirect('comment')->with('fails', 'Can not Process');
} }
} }
/** /**
* get profile page * get profile page.
*
* @return type view * @return type view
*/ */
public function getProfile() { public function getProfile()
{
$time = Timezone::all(); $time = Timezone::all();
$user = Auth::user(); $user = Auth::user();
return view('themes.default1.agent.kb.settings.profile', compact('user', 'time')); return view('themes.default1.agent.kb.settings.profile', compact('user', 'time'));
} }
/** /**
* Post profile page * Post profile page.
* @param type ProfileRequest $request *
* @param type ProfileRequest $request
*
* @return type redirect * @return type redirect
*/ */
public function postProfile(ProfileRequest $request) { public function postProfile(ProfileRequest $request)
{
$user = Auth::user(); $user = Auth::user();
$user->gender = $request->input('gender'); $user->gender = $request->input('gender');
$user->save(); $user->save();
@@ -233,12 +244,13 @@ class SettingsController extends Controller {
//$extension = Input::file('profile_pic')->getClientOriginalExtension(); //$extension = Input::file('profile_pic')->getClientOriginalExtension();
$name = Input::file('profile_pic')->getClientOriginalName(); $name = Input::file('profile_pic')->getClientOriginalName();
$destinationPath = 'lb-faveo/dist/img'; $destinationPath = 'lb-faveo/dist/img';
$fileName = rand(0000, 9999) . '.' . $name; $fileName = rand(0000, 9999).'.'.$name;
//echo $fileName; //echo $fileName;
Input::file('profile_pic')->move($destinationPath, $fileName); Input::file('profile_pic')->move($destinationPath, $fileName);
$user->profile_pic = $fileName; $user->profile_pic = $fileName;
} else { } else {
$user->fill($request->except('profile_pic', 'gender'))->save(); $user->fill($request->except('profile_pic', 'gender'))->save();
return redirect()->back()->with('success1', 'Profile Updated sucessfully'); return redirect()->back()->with('success1', 'Profile Updated sucessfully');
} }
if ($user->fill($request->except('profile_pic'))->save()) { if ($user->fill($request->except('profile_pic'))->save()) {
@@ -249,18 +261,22 @@ class SettingsController extends Controller {
} }
/** /**
* post profile password * post profile password.
* @param type $id *
* @param type ProfilePassword $request * @param type $id
* @param type ProfilePassword $request
*
* @return type redirect * @return type redirect
*/ */
public function postProfilePassword($id, ProfilePassword $request) { public function postProfilePassword($id, ProfilePassword $request)
{
$user = Auth::user(); $user = Auth::user();
//echo $user->password; //echo $user->password;
if (Hash::check($request->input('old_password'), $user->getAuthPassword())) { if (Hash::check($request->input('old_password'), $user->getAuthPassword())) {
$user->password = Hash::make($request->input('new_password')); $user->password = Hash::make($request->input('new_password'));
$user->save(); $user->save();
return redirect('profile')->with('success2', 'Password Updated sucessfully'); return redirect('profile')->with('success2', 'Password Updated sucessfully');
} else { } else {
return redirect('profile')->with('fails2', 'Old password Wrong'); return redirect('profile')->with('fails2', 'Old password Wrong');
@@ -268,14 +284,15 @@ class SettingsController extends Controller {
} }
/** /**
* het locale for language * het locale for language.
*
* @return type config set * @return type config set
*/ */
static function language() { public static function language()
{
// $set = Settings::whereId(1)->first(); // $set = Settings::whereId(1)->first();
// $lang = $set->language; // $lang = $set->language;
Config::set('app.locale', 'en'); Config::set('app.locale', 'en');
Config::get('app'); Config::get('app');
} }
} }

File diff suppressed because it is too large Load Diff

View File

@@ -5,52 +5,42 @@ namespace App\Http\Controllers\Api\v1;
// controllers // controllers
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
// requests // requests
use Illuminate\Http\Request;
use App\Http\Requests\helpdesk\InstallerRequest;
// models
use App\User;
use App\Model\helpdesk\Settings\System; use App\Model\helpdesk\Settings\System;
use App\Model\helpdesk\Form\Form_details; // models
use App\Model\helpdesk\Utility\Date_time_format; use App\Model\helpdesk\Utility\Date_time_format;
use App\Model\helpdesk\Utility\Timezones; use App\Model\helpdesk\Utility\Timezones;
// classes use App\User;
use App;
use Artisan; use Artisan;
// classes
use Config; use Config;
use File; use File;
use Hash; use Hash;
use Input; use Illuminate\Http\Request;
use Redirect;
use Session;
use View;
use Exception;
/** /**
* |======================================================================= * |=======================================================================
* |Class: InstallController * |Class: InstallController
* |======================================================================= * |=======================================================================.
* *
* Class to perform the first install operation without this the database * Class to perform the first install operation without this the database
* settings could not be started * settings could not be started
* *
* @package Faveo HELPDESK
* @subpackage Controller
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*
*/ */
class InstallerApiController extends Controller { class InstallerApiController extends Controller
{
/** /**
* config_database * config_database
* This function is to configure the database and install the application via API call. * This function is to configure the database and install the application via API call.
*
* @return type Json * @return type Json
*/ */
public function config_database(Request $request) { public function config_database(Request $request)
{
error_reporting(E_ALL & ~E_NOTICE); error_reporting(E_ALL & ~E_NOTICE);
// Check for pre install // Check for pre install
if (\Config::get('database.install') == '%0%') { if (\Config::get('database.install') == '%0%') {
$default = $request->database; $default = $request->database;
$host = $request->host; $host = $request->host;
$database = $request->databasename; $database = $request->databasename;
@@ -74,7 +64,7 @@ class InstallerApiController extends Controller {
} }
// Write environment file // Write environment file
$fp = fopen(base_path() . "/.env", 'w'); $fp = fopen(base_path().'/.env', 'w');
fwrite($fp, $config); fwrite($fp, $config);
fclose($fp); fclose($fp);
@@ -90,9 +80,11 @@ class InstallerApiController extends Controller {
/** /**
* config_database * config_database
* This function is to configure the database and install the application via API call. * This function is to configure the database and install the application via API call.
*
* @return type Json * @return type Json
*/ */
public function config_system(Request $request) { public function config_system(Request $request)
{
// Check for pre install // Check for pre install
if (\Config::get('database.install') == '%0%') { if (\Config::get('database.install') == '%0%') {
$firstname = $request->firstname; $firstname = $request->firstname;
@@ -104,8 +96,8 @@ class InstallerApiController extends Controller {
$datetime = $request->datetime; $datetime = $request->datetime;
// Migrate database // Migrate database
Artisan::call('migrate', array('--force' => true)); Artisan::call('migrate', ['--force' => true]);
Artisan::call('db:seed', array('--force' => true)); Artisan::call('db:seed', ['--force' => true]);
// checking requested timezone for the admin and system // checking requested timezone for the admin and system
$timezones = Timezones::where('name', '=', $timezone)->first(); $timezones = Timezones::where('name', '=', $timezone)->first();
@@ -118,7 +110,7 @@ class InstallerApiController extends Controller {
return ['response' => 'fail', 'reason' => 'invalid date-time format', 'status' => '0']; return ['response' => 'fail', 'reason' => 'invalid date-time format', 'status' => '0'];
} }
// Creating minum settings for system // Creating minum settings for system
$system = new System; $system = new System();
$system->status = 1; $system->status = 1;
$system->department = 1; $system->department = 1;
$system->date_time_format = $date_time_format->id; $system->date_time_format = $date_time_format->id;
@@ -126,17 +118,17 @@ class InstallerApiController extends Controller {
$system->save(); $system->save();
// Creating user // Creating user
$user = User::create(array( $user = User::create([
'first_name' => $firstname, 'first_name' => $firstname,
'last_name' => $lastname, 'last_name' => $lastname,
'email' => $email, 'email' => $email,
'user_name' => $username, 'user_name' => $username,
'password' => Hash::make($password), 'password' => Hash::make($password),
'active' => 1, 'active' => 1,
'role' => 'admin', 'role' => 'admin',
'assign_group' => 1, 'assign_group' => 1,
'primary_dpt' => 1, 'primary_dpt' => 1,
)); ]);
// Setting database installed status // Setting database installed status
$value = '1'; $value = '1';
@@ -165,5 +157,4 @@ class InstallerApiController extends Controller {
return ['response' => 'fail', 'reason' => 'this system is already installed', 'status' => '0']; return ['response' => 'fail', 'reason' => 'this system is already installed', 'status' => '0'];
} }
} }
} }

View File

@@ -2,26 +2,26 @@
namespace App\Http\Controllers\Api\v1; namespace App\Http\Controllers\Api\v1;
use App\Http\Requests;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Exception;
class TestController extends Controller {
class TestController extends Controller
{
public $server; public $server;
public function __construct() { public function __construct()
{
$server = new Request(); $server = new Request();
$url = $_SERVER['REQUEST_URI']; $url = $_SERVER['REQUEST_URI'];
$server = parse_url($url); $server = parse_url($url);
$server["path"] = dirname($server["path"]); $server['path'] = dirname($server['path']);
$server = parse_url($server["path"]); $server = parse_url($server['path']);
$server["path"] = dirname($server["path"]); $server['path'] = dirname($server['path']);
$this->server = "http://" . $_SERVER['HTTP_HOST'] . $server['path'] . "/"; $this->server = 'http://'.$_SERVER['HTTP_HOST'].$server['path'].'/';
} }
static function callGetApi($url) { public static function callGetApi($url)
{
//dd($url); //dd($url);
$curl = curl_init($url); $curl = curl_init($url);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
@@ -31,14 +31,15 @@ class TestController extends Controller {
$response = curl_exec($curl); $response = curl_exec($curl);
if (curl_errno($curl)) { if (curl_errno($curl)) {
echo 'error:' . curl_error($curl); echo 'error:'.curl_error($curl);
} }
return $response; return $response;
curl_close($curl); curl_close($curl);
} }
static function callPostApi($url, $data) { public static function callPostApi($url, $data)
{
//dd($url); //dd($url);
$curl = curl_init($url); $curl = curl_init($url);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
@@ -49,22 +50,23 @@ class TestController extends Controller {
$response = curl_exec($curl); $response = curl_exec($curl);
if (curl_errno($curl)) { if (curl_errno($curl)) {
echo 'error:' . curl_error($curl); echo 'error:'.curl_error($curl);
} }
return $response; return $response;
curl_close($curl); curl_close($curl);
} }
public function ticketReply() { public function ticketReply()
{
//$file = file_get_contents(base_path() . '/../lb-faveo/Img/Ladybird.png'); //$file = file_get_contents(base_path() . '/../lb-faveo/Img/Ladybird.png');
$data = [ $data = [
'ticket_ID' => '1', 'ticket_ID' => '1',
'reply_content' => 'reply for the ticket id', 'reply_content' => 'reply for the ticket id',
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN', 'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN',
// 'attachments' => [ // 'attachments' => [
// [ // [
// 'name' => 'ladybird', // 'name' => 'ladybird',
@@ -82,28 +84,30 @@ class TestController extends Controller {
]; ];
$data = http_build_query($data, '', '&'); $data = http_build_query($data, '', '&');
$url = $this->server . "helpdesk/reply?token=" . \Config::get('app.token'); $url = $this->server.'helpdesk/reply?token='.\Config::get('app.token');
$_this = new self(); $_this = new self();
$respose = $_this->callPostApi($url, $data); $respose = $_this->callPostApi($url, $data);
return $respose; return $respose;
} }
public function createTicket() { public function createTicket()
{
//$file = file_get_contents(base_path() . '/../lb-faveo/Img/Ladybird.png'); //$file = file_get_contents(base_path() . '/../lb-faveo/Img/Ladybird.png');
$data = [ $data = [
'user_id' => 1, 'user_id' => 1,
'subject' => 'Api create via faveo api', 'subject' => 'Api create via faveo api',
'body' => 'Test me when call api', 'body' => 'Test me when call api',
'helptopic' => '1', 'helptopic' => '1',
'sla' => '1', 'sla' => '1',
'priority' => '1', 'priority' => '1',
'headers' => [0 => 'vijaycodename47@gmail.com'], 'headers' => [0 => 'vijaycodename47@gmail.com'],
'dept' => '1', 'dept' => '1',
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN', 'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN',
/** if attachment */ /* if attachment */
// 'attachments' => [ // 'attachments' => [
// [ // [
// 'name' => 'ladybird', // 'name' => 'ladybird',
@@ -121,280 +125,331 @@ class TestController extends Controller {
]; ];
$data = http_build_query($data, '', '&'); $data = http_build_query($data, '', '&');
$url = $this->server . "helpdesk/create?token=" . \Config::get('app.token'); $url = $this->server.'helpdesk/create?token='.\Config::get('app.token');
$_this = new self(); $_this = new self();
$respose = $_this->callPostApi($url, $data); $respose = $_this->callPostApi($url, $data);
return $respose; return $respose;
} }
public function generateToken() { public function generateToken()
{
$data = [ $data = [
//'email'=>'vijaycodename47@gmail.com', //'email'=>'vijaycodename47@gmail.com',
'username' => 'vijay', 'username' => 'vijay',
'password' => 'manjapra', 'password' => 'manjapra',
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN' 'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN',
]; ];
$data = http_build_query($data, '', '&'); $data = http_build_query($data, '', '&');
$url = $this->server . "authenticate"; $url = $this->server.'authenticate';
//dd($url); //dd($url);
$_this = new self(); $_this = new self();
$respose = $_this->callPostApi($url, $data); $respose = $_this->callPostApi($url, $data);
return $respose; return $respose;
} }
public function createUser() { public function createUser()
{
$data = [ $data = [
'email' => 'vijaycodename@gmail.com', 'email' => 'vijaycodename@gmail.com',
'password' => 'manjapra', 'password' => 'manjapra',
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN' 'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN',
]; ];
$data = http_build_query($data, '', '&'); $data = http_build_query($data, '', '&');
$url = $this->server . "register"; $url = $this->server.'register';
$_this = new self(); $_this = new self();
$respose = $_this->callPostApi($url, $data); $respose = $_this->callPostApi($url, $data);
return $respose; return $respose;
} }
public function getAuthUser() { public function getAuthUser()
{
$url = $this->server . "authenticate/user?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token'); $url = $this->server.'authenticate/user?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token='.\Config::get('app.token');
$_this = new self(); $_this = new self();
$respose = $_this->callGetApi($url); $respose = $_this->callGetApi($url);
return $respose; return $respose;
} }
public function editTicket() { public function editTicket()
{
$data = [ $data = [
'ticket_id' => '13', 'ticket_id' => '13',
'subject' => 'Api editing ticket via faveo api', 'subject' => 'Api editing ticket via faveo api',
'sla_plan' => '2', 'sla_plan' => '2',
'help_topic' => '2', 'help_topic' => '2',
'ticket_source' => '2', 'ticket_source' => '2',
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN', 'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN',
'ticket_priority' => '2', 'ticket_priority' => '2',
]; ];
$data = http_build_query($data, '', '&'); $data = http_build_query($data, '', '&');
$url = $this->server . "helpdesk/edit?token=" . \Config::get('app.token'); $url = $this->server.'helpdesk/edit?token='.\Config::get('app.token');
$_this = new self(); $_this = new self();
$respose = $_this->callPostApi($url, $data); $respose = $_this->callPostApi($url, $data);
return $respose; return $respose;
} }
public function deleteTicket() { public function deleteTicket()
{
$data = [ $data = [
'ticket_id' => [11], 'ticket_id' => [11],
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN' 'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN',
]; ];
$data = http_build_query($data, '', '&'); $data = http_build_query($data, '', '&');
$url = $this->server . "helpdesk/delete?token=" . \Config::get('app.token'); $url = $this->server.'helpdesk/delete?token='.\Config::get('app.token');
$_this = new self(); $_this = new self();
$respose = $_this->callPostApi($url, $data); $respose = $_this->callPostApi($url, $data);
return $respose; return $respose;
} }
public function openedTickets() { public function openedTickets()
$url = $this->server . "helpdesk/open?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token'); {
$url = $this->server.'helpdesk/open?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token='.\Config::get('app.token');
$_this = new self(); $_this = new self();
$respose = $_this->callGetApi($url); $respose = $_this->callGetApi($url);
return $respose; return $respose;
} }
public function unassignedTickets() { public function unassignedTickets()
{
//dd('dsdf'); //dd('dsdf');
$url = $this->server . "helpdesk/unassigned?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token'); $url = $this->server.'helpdesk/unassigned?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token='.\Config::get('app.token');
$_this = new self(); $_this = new self();
$respose = $_this->callGetApi($url); $respose = $_this->callGetApi($url);
//dd($respose); //dd($respose);
return $respose; return $respose;
} }
public function closeTickets() { public function closeTickets()
$url = $this->server . "helpdesk/closed?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token'); {
$url = $this->server.'helpdesk/closed?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token='.\Config::get('app.token');
$_this = new self(); $_this = new self();
$respose = $_this->callGetApi($url); $respose = $_this->callGetApi($url);
return $respose; return $respose;
} }
public function getAgents() { public function getAgents()
$url = $this->server . "helpdesk/agents?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token'); {
$url = $this->server.'helpdesk/agents?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token='.\Config::get('app.token');
$_this = new self(); $_this = new self();
$respose = $_this->callGetApi($url); $respose = $_this->callGetApi($url);
return $respose; return $respose;
} }
public function getTeams() { public function getTeams()
$url = $this->server . "helpdesk/teams?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token'); {
$url = $this->server.'helpdesk/teams?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token='.\Config::get('app.token');
$_this = new self(); $_this = new self();
$respose = $_this->callGetApi($url); $respose = $_this->callGetApi($url);
return $respose; return $respose;
} }
public function assignTicket() { public function assignTicket()
{
$data = [ $data = [
'ticket_id' => 1, 'ticket_id' => 1,
'user' => 'vijay.sebastian@ladybirdweb.com', 'user' => 'vijay.sebastian@ladybirdweb.com',
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN' 'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN',
]; ];
$data = http_build_query($data, '', '&'); $data = http_build_query($data, '', '&');
$url = $this->server . "helpdesk/assign?token=" . \Config::get('app.token'); $url = $this->server.'helpdesk/assign?token='.\Config::get('app.token');
$_this = new self(); $_this = new self();
$respose = $_this->callPostApi($url, $data); $respose = $_this->callPostApi($url, $data);
return $respose; return $respose;
} }
public function getCustomers() { public function getCustomers()
{
$search = [ $search = [
'search' => 'vij', 'search' => 'vij',
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN' 'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN',
]; ];
$data = http_build_query($search, '', '&'); $data = http_build_query($search, '', '&');
$url = $this->server . "helpdesk/customers?token=" . \Config::get('app.token'); $url = $this->server.'helpdesk/customers?token='.\Config::get('app.token');
$url = $url . '&' . $data; $url = $url.'&'.$data;
$_this = new self(); $_this = new self();
$respose = $_this->callGetApi($url); $respose = $_this->callGetApi($url);
return $respose; return $respose;
} }
public function getCustomer() { public function getCustomer()
{
$search = [ $search = [
'user_id' => '1', 'user_id' => '1',
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN' 'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN',
]; ];
$data = http_build_query($search, '', '&'); $data = http_build_query($search, '', '&');
$url = $this->server . "helpdesk/customer?token=" . \Config::get('app.token'); $url = $this->server.'helpdesk/customer?token='.\Config::get('app.token');
$url = $url . '&' . $data; $url = $url.'&'.$data;
$_this = new self(); $_this = new self();
$respose = $_this->callGetApi($url); $respose = $_this->callGetApi($url);
return $respose; return $respose;
} }
public function getSearch() { public function getSearch()
{
$search = [ $search = [
'search' => 'api', 'search' => 'api',
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN' 'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN',
]; ];
$data = http_build_query($search, '', '&'); $data = http_build_query($search, '', '&');
$url = $this->server . "helpdesk/ticket-search?token=" . \Config::get('app.token'); $url = $this->server.'helpdesk/ticket-search?token='.\Config::get('app.token');
$url = $url . '&' . $data; $url = $url.'&'.$data;
$_this = new self(); $_this = new self();
$respose = $_this->callGetApi($url); $respose = $_this->callGetApi($url);
return $respose; return $respose;
} }
public function ticketThreads() { public function ticketThreads()
{
$search = [ $search = [
'id' => '1', 'id' => '1',
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN' 'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN',
]; ];
$data = http_build_query($search, '', '&'); $data = http_build_query($search, '', '&');
$url = $this->server . "helpdesk/ticket-thread?token=" . \Config::get('app.token'); $url = $this->server.'helpdesk/ticket-thread?token='.\Config::get('app.token');
$url = $url . '&' . $data; $url = $url.'&'.$data;
$_this = new self(); $_this = new self();
$respose = $_this->callGetApi($url); $respose = $_this->callGetApi($url);
return $respose; return $respose;
} }
public function url() { public function url()
{
$search = [ $search = [
'url' => 'http://localhost/faveo-helpdesk-github/public/', 'url' => 'http://localhost/faveo-helpdesk-github/public/',
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN' 'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN',
]; ];
$data = http_build_query($search, '', '&'); $data = http_build_query($search, '', '&');
$url = $this->server . "helpdesk/url?token=" . \Config::get('app.token'); $url = $this->server.'helpdesk/url?token='.\Config::get('app.token');
$url = $url . '&' . $data; $url = $url.'&'.$data;
$_this = new self(); $_this = new self();
$respose = $_this->callGetApi($url); $respose = $_this->callGetApi($url);
return $respose; return $respose;
} }
public function generateApiKey() { public function generateApiKey()
$url = $this->server . "helpdesk/api_key?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token'); {
$url = $this->server.'helpdesk/api_key?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token='.\Config::get('app.token');
$_this = new self(); $_this = new self();
$respose = $_this->callGetApi($url); $respose = $_this->callGetApi($url);
return $respose; return $respose;
} }
public function getHelpTopic() { public function getHelpTopic()
$url = $this->server . "helpdesk/help-topic?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token'); {
$url = $this->server.'helpdesk/help-topic?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token='.\Config::get('app.token');
$_this = new self(); $_this = new self();
$respose = $_this->callGetApi($url); $respose = $_this->callGetApi($url);
return $respose; return $respose;
} }
public function getSlaPlan() { public function getSlaPlan()
$url = $this->server . "helpdesk/sla-plan?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token'); {
$url = $this->server.'helpdesk/sla-plan?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token='.\Config::get('app.token');
$_this = new self(); $_this = new self();
$respose = $_this->callGetApi($url); $respose = $_this->callGetApi($url);
return $respose; return $respose;
} }
public function getPriority() { public function getPriority()
$url = $this->server . "helpdesk/priority?api_key=clYbe1g7BYVEJznBdvCEBR0xDCLDqKgg&token=" . \Config::get('app.token'); {
$url = $this->server.'helpdesk/priority?api_key=clYbe1g7BYVEJznBdvCEBR0xDCLDqKgg&token='.\Config::get('app.token');
$_this = new self(); $_this = new self();
$respose = $_this->callGetApi($url); $respose = $_this->callGetApi($url);
return $respose; return $respose;
} }
public function getDepartment() { public function getDepartment()
$url = $this->server . "helpdesk/department?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token'); {
$url = $this->server.'helpdesk/department?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token='.\Config::get('app.token');
$_this = new self(); $_this = new self();
$respose = $_this->callGetApi($url); $respose = $_this->callGetApi($url);
return $respose; return $respose;
} }
public function getTickets() { public function getTickets()
$url = $this->server . "helpdesk/tickets?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token'); {
$url = $this->server.'helpdesk/tickets?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token='.\Config::get('app.token');
$_this = new self(); $_this = new self();
$respose = $_this->callGetApi($url); $respose = $_this->callGetApi($url);
return $respose; return $respose;
} }
public function inbox() { public function inbox()
$url = $this->server . "helpdesk/inbox?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token'); {
$url = $this->server.'helpdesk/inbox?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token='.\Config::get('app.token');
$_this = new self(); $_this = new self();
$respose = $_this->callGetApi($url); $respose = $_this->callGetApi($url);
return $respose; return $respose;
} }
public function internalNote() { public function internalNote()
{
$data = [ $data = [
'ticketid' => '1', 'ticketid' => '1',
'userid' => 1, 'userid' => 1,
'body' => 'Testing the api internal note', 'body' => 'Testing the api internal note',
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN' 'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN',
]; ];
$data = http_build_query($data, '', '&'); $data = http_build_query($data, '', '&');
$url = $this->server . "helpdesk/internal-note?token=" . \Config::get('app.token'); $url = $this->server.'helpdesk/internal-note?token='.\Config::get('app.token');
$_this = new self(); $_this = new self();
$respose = $_this->callPostApi($url, $data); $respose = $_this->callPostApi($url, $data);
return $respose; return $respose;
} }
public function trash() { public function trash()
$url = $this->server . "helpdesk/trash?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token'); {
$url = $this->server.'helpdesk/trash?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token='.\Config::get('app.token');
$_this = new self(); $_this = new self();
$respose = $_this->callGetApi($url); $respose = $_this->callGetApi($url);
return $respose; return $respose;
} }
public function myTickets(){ public function myTickets()
try{ {
$url = $this->server . "helpdesk/my-tickets?user_id=1&api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token'); try {
$url = $this->server.'helpdesk/my-tickets?user_id=1&api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token='.\Config::get('app.token');
$_this = new self(); $_this = new self();
$respose = $_this->callGetApi($url); $respose = $_this->callGetApi($url);
return $respose; return $respose;
} catch (\Exception $e) { } catch (\Exception $e) {
$error = $e->getMessage(); $error = $e->getMessage();
$line = $e->getLine(); $line = $e->getLine();
$file = $e->getFile(); $file = $e->getFile();
return response()->json(compact('error', 'file', 'line')); return response()->json(compact('error', 'file', 'line'));
} }
} }
} }

View File

@@ -2,70 +2,72 @@
namespace App\Http\Controllers\Api\v1; namespace App\Http\Controllers\Api\v1;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Model\helpdesk\Ticket\Tickets;
use App\Model\helpdesk\Settings\Company;
use App\User;
use App\Model\helpdesk\Ticket\Ticket_Collaborator;
use App\Model\helpdesk\Ticket\Ticket_Thread;
use App\Http\Controllers\Common\PhpMailController; use App\Http\Controllers\Common\PhpMailController;
use Auth; use App\Http\Controllers\Controller;
use Mail;
use Input;
use App\Model\helpdesk\Ticket\Ticket_Status;
use App\Model\helpdesk\Ticket\Ticket_attachments;
use App\Model\helpdesk\Settings\System;
use App\Model\helpdesk\Settings\Alert; use App\Model\helpdesk\Settings\Alert;
use App\Model\helpdesk\Settings\Company;
use App\Model\helpdesk\Settings\System;
use App\Model\helpdesk\Ticket\Ticket_attachments;
use App\Model\helpdesk\Ticket\Ticket_Collaborator;
use App\Model\helpdesk\Ticket\Ticket_Status;
use App\Model\helpdesk\Ticket\Ticket_Thread;
use App\Model\helpdesk\Ticket\Tickets;
use App\User;
use Auth;
use Hash; use Hash;
use Input;
use Mail;
/** /**
* ----------------------------------------------------------------------------- * -----------------------------------------------------------------------------
* Ticket Controller * Ticket Controller
* ----------------------------------------------------------------------------- * -----------------------------------------------------------------------------.
* *
* *
* @author Vijay Sebastian <vijay.sebastian@ladybirdweb.com> * @author Vijay Sebastian <vijay.sebastian@ladybirdweb.com>
* @copyright (c) 2016, Ladybird Web Solution * @copyright (c) 2016, Ladybird Web Solution
* @name Faveo HELPDESK * @name Faveo HELPDESK
*
* @version v1 * @version v1
*
*
*/ */
class TicketController extends Controller { class TicketController extends Controller
{
/** /**
* Create a new controller instance. * Create a new controller instance.
*
* @return type response * @return type response
*/ */
public function __construct() { public function __construct()
$PhpMailController = new PhpMailController(); {
$PhpMailController = new PhpMailController();
$this->PhpMailController = $PhpMailController; $this->PhpMailController = $PhpMailController;
} }
/** /**
* Create Ticket * Create Ticket.
*
* @param type $user_id * @param type $user_id
* @param type $subject * @param type $subject
* @param type $body * @param type $body
* @param type $helptopic * @param type $helptopic
* @param type $sla * @param type $sla
* @param type $priority * @param type $priority
*
* @return type string * @return type string
*/ */
public function createTicket($user_id, $subject, $body, $helptopic, $sla, $priority, $source, $headers, $dept, $assignto, $form_data, $attach = '') { public function createTicket($user_id, $subject, $body, $helptopic, $sla, $priority, $source, $headers, $dept, $assignto, $form_data, $attach = '')
{
try { try {
$max_number = Tickets::whereRaw('id = (select max(`id`) from tickets)')->first(); $max_number = Tickets::whereRaw('id = (select max(`id`) from tickets)')->first();
//dd($max_number); //dd($max_number);
if ($max_number == null) { if ($max_number == null) {
$ticket_number = "AAAA-9999-9999999"; $ticket_number = 'AAAA-9999-9999999';
} else { } else {
foreach ($max_number as $number) { foreach ($max_number as $number) {
$ticket_number = $max_number->ticket_number; $ticket_number = $max_number->ticket_number;
} }
} }
$ticket = new Tickets; $ticket = new Tickets();
$ticket->ticket_number = $this->ticketNumber($ticket_number); $ticket->ticket_number = $this->ticketNumber($ticket_number);
//dd($this->ticketNumber($ticket_number)); //dd($this->ticketNumber($ticket_number));
$ticket->user_id = $user_id; $ticket->user_id = $user_id;
@@ -86,7 +88,7 @@ class TicketController extends Controller {
foreach ($form_data as $key => $form_details) { foreach ($form_data as $key => $form_details) {
foreach ($forms as $from) { foreach ($forms as $from) {
if ($from->name == $key) { if ($from->name == $key) {
$form_value = new Ticket_Form_Data; $form_value = new Ticket_Form_Data();
$form_value->ticket_id = $id; $form_value->ticket_id = $id;
$form_value->title = $from->label; $form_value->title = $from->label;
$form_value->content = $form_details; $form_value->content = $form_details;
@@ -96,27 +98,30 @@ class TicketController extends Controller {
} }
} }
$this->storeCollaborators($headers, $id); $this->storeCollaborators($headers, $id);
$thread = $this->ticketThread($subject, $body, $id, $user_id); $thread = $this->ticketThread($subject, $body, $id, $user_id);
if (!empty($attach)) { if (!empty($attach)) {
$this->attach($thread, $attach); $this->attach($thread, $attach);
} }
return $thread; return $thread;
} catch (\Exception $e) { } catch (\Exception $e) {
dd($e); dd($e);
return $e->getMessage(); return $e->getMessage();
} }
} }
/** /**
* store_collaborators * store_collaborators.
* @param type $headers *
* @param type $headers
*
* @return type * @return type
*/ */
public function storeCollaborators($headers, $id) { public function storeCollaborators($headers, $id)
{
try { try {
$company = $this->company(); $company = $this->company();
if (isset($headers)) { if (isset($headers)) {
@@ -124,11 +129,11 @@ class TicketController extends Controller {
$name = $name; $name = $name;
$email = $email; $email = $email;
if ($this->checkEmail($email) == false) { if ($this->checkEmail($email) == false) {
$create_user = new User; $create_user = new User();
$create_user->user_name = $name; $create_user->user_name = $name;
$create_user->email = $email; $create_user->email = $email;
$create_user->active = 1; $create_user->active = 1;
$create_user->role = "user"; $create_user->role = 'user';
$password = $this->generateRandomString(); $password = $this->generateRandomString();
$create_user->password = Hash::make($password); $create_user->password = Hash::make($password);
$create_user->save(); $create_user->save();
@@ -138,19 +143,19 @@ class TicketController extends Controller {
// }); // });
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $name, 'email' => $email], $message = ['subject' => 'password', 'scenario' => 'registration-notification'], $template_variables = ['user' => $name, 'email_address' => $email, 'user_password' => $password]); $this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $name, 'email' => $email], $message = ['subject' => 'password', 'scenario' => 'registration-notification'], $template_variables = ['user' => $name, 'email_address' => $email, 'user_password' => $password]);
} else { } else {
$user = $this->checkEmail($email); $user = $this->checkEmail($email);
$user_id = $user->id; $user_id = $user->id;
} }
$collaborator_store = new Ticket_Collaborator; $collaborator_store = new Ticket_Collaborator();
$collaborator_store->isactive = 1; $collaborator_store->isactive = 1;
$collaborator_store->ticket_id = $id; $collaborator_store->ticket_id = $id;
$collaborator_store->user_id = $user_id; $collaborator_store->user_id = $user_id;
$collaborator_store->role = "ccc"; $collaborator_store->role = 'ccc';
$collaborator_store->save(); $collaborator_store->save();
} }
} }
return true; return true;
} catch (\Exception $e) { } catch (\Exception $e) {
return $e->getMessage(); return $e->getMessage();
@@ -158,22 +163,26 @@ class TicketController extends Controller {
} }
/** /**
* Generate Ticket Thread * Generate Ticket Thread.
*
* @param type $subject * @param type $subject
* @param type $body * @param type $body
* @param type $id * @param type $id
* @param type $user_id * @param type $user_id
*
* @return type * @return type
*/ */
public function ticketThread($subject, $body, $id, $user_id) { public function ticketThread($subject, $body, $id, $user_id)
{
try { try {
$thread = new Ticket_Thread; $thread = new Ticket_Thread();
$thread->user_id = $user_id; $thread->user_id = $user_id;
$thread->ticket_id = $id; $thread->ticket_id = $id;
$thread->poster = 'client'; $thread->poster = 'client';
$thread->title = $subject; $thread->title = $subject;
$thread->body = $body; $thread->body = $body;
$thread->save(); $thread->save();
return $thread->id; return $thread->id;
} catch (\Exception $e) { } catch (\Exception $e) {
return $e->getMessage(); return $e->getMessage();
@@ -181,11 +190,14 @@ class TicketController extends Controller {
} }
/** /**
* Generates Ticket Number * Generates Ticket Number.
*
* @param type $ticket_number * @param type $ticket_number
*
* @return type integer * @return type integer
*/ */
public function ticketNumber($ticket_number) { public function ticketNumber($ticket_number)
{
try { try {
//dd($ticket_number); //dd($ticket_number);
$number = $ticket_number; $number = $ticket_number;
@@ -207,21 +219,26 @@ class TicketController extends Controller {
$number3++; $number3++;
$number2 = sprintf('%04s', $number2); $number2 = sprintf('%04s', $number2);
$number3 = sprintf('%07s', $number3); $number3 = sprintf('%07s', $number3);
$array = array($number1, $number2, $number3); $array = [$number1, $number2, $number3];
$number = implode('-', $array); $number = implode('-', $array);
return $number; return $number;
} catch (\Exception $e) { } catch (\Exception $e) {
dd($e); dd($e);
return $e->getMessage(); return $e->getMessage();
} }
} }
/** /**
* Generate a random string for password * Generate a random string for password.
*
* @param type $length * @param type $length
*
* @return type string * @return type string
*/ */
public function generateRandomString($length = 10) { public function generateRandomString($length = 10)
{
try { try {
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$charactersLength = strlen($characters); $charactersLength = strlen($characters);
@@ -229,6 +246,7 @@ class TicketController extends Controller {
for ($i = 0; $i < $length; $i++) { for ($i = 0; $i < $length; $i++) {
$randomString .= $characters[rand(0, $charactersLength - 1)]; $randomString .= $characters[rand(0, $charactersLength - 1)];
} }
return $randomString; return $randomString;
} catch (\Exception $e) { } catch (\Exception $e) {
return $e->getMessage(); return $e->getMessage();
@@ -236,14 +254,16 @@ class TicketController extends Controller {
} }
/** /**
* Replying a ticket * Replying a ticket.
*
* @param type Ticket_Thread $thread * @param type Ticket_Thread $thread
* @param type TicketRequest $request * @param type TicketRequest $request
*
* @return type bool * @return type bool
*/ */
public function reply($thread, $request, $ta, $attach = '') { public function reply($thread, $request, $ta, $attach = '')
{
try { try {
$check_attachment = null; $check_attachment = null;
$eventthread = $thread->where('ticket_id', $request->input('ticket_ID'))->first(); $eventthread = $thread->where('ticket_id', $request->input('ticket_ID'))->first();
$eventuserid = $eventthread->user_id; $eventuserid = $eventthread->user_id;
@@ -266,11 +286,11 @@ class TicketController extends Controller {
if ($tickets->assigned_to == 0) { if ($tickets->assigned_to == 0) {
$tickets->assigned_to = Auth::user()->id; $tickets->assigned_to = Auth::user()->id;
$tickets->save(); $tickets->save();
$thread2 = New Ticket_Thread; $thread2 = new Ticket_Thread();
$thread2->ticket_id = $thread->ticket_id; $thread2->ticket_id = $thread->ticket_id;
$thread2->user_id = Auth::user()->id; $thread2->user_id = Auth::user()->id;
$thread2->is_internal = 1; $thread2->is_internal = 1;
$thread2->body = "This Ticket have been assigned to " . Auth::user()->first_name . " " . Auth::user()->last_name; $thread2->body = 'This Ticket have been assigned to '.Auth::user()->first_name.' '.Auth::user()->last_name;
$thread2->save(); $thread2->save();
} }
if ($tickets->status > 1) { if ($tickets->status > 1) {
@@ -280,7 +300,6 @@ class TicketController extends Controller {
} }
$thread->save(); $thread->save();
if (!empty($attach)) { if (!empty($attach)) {
$check_attachment = $this->attach($thread->id, $attach); $check_attachment = $this->attach($thread->id, $attach);
} }
@@ -313,22 +332,20 @@ class TicketController extends Controller {
// }, true); // }, true);
try { try {
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('0', $ticketdata->dept_id), $to = ['name' => $username, 'email' => $emailadd], $message = ['subject' => $updated_subject, 'scenario' => 'create-ticket-by-agent', 'body' => $body], $template_variables = ['agent_sign' => Auth::user()->agent_sign, 'ticket_number' => $ticket_number2]); $this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('0', $ticketdata->dept_id), $to = ['name' => $username, 'email' => $emailadd], $message = ['subject' => $updated_subject, 'scenario' => 'create-ticket-by-agent', 'body' => $body], $template_variables = ['agent_sign' => Auth::user()->agent_sign, 'ticket_number' => $ticket_number2]);
} catch (\Exception $e) { } catch (\Exception $e) {
}
}
$collaborators = Ticket_Collaborator::where('ticket_id', '=', $ticket_id)->get(); $collaborators = Ticket_Collaborator::where('ticket_id', '=', $ticket_id)->get();
foreach ($collaborators as $collaborator) { foreach ($collaborators as $collaborator) {
//mail to collaborators //mail to collaborators
$collab_user_id = $collaborator->user_id; $collab_user_id = $collaborator->user_id;
$user_id_collab = User::where('id', '=', $collab_user_id)->first(); $user_id_collab = User::where('id', '=', $collab_user_id)->first();
$collab_email = $user_id_collab->email; $collab_email = $user_id_collab->email;
if ($user_id_collab->role == "user") { if ($user_id_collab->role == 'user') {
$collab_user_name = $user_id_collab->user_name; $collab_user_name = $user_id_collab->user_name;
} else { } else {
$collab_user_name = $user_id_collab->first_name . " " . $user_id_collab->last_name; $collab_user_name = $user_id_collab->first_name.' '.$user_id_collab->last_name;
} }
// Mail::send('emails.ticket_re-reply', ['content' => $reply_content, 'ticket_number' => $ticket_number, 'From' => $company, 'name' => $collab_user_name, 'Agent_Signature' => $agentsign], function ($message) use ($collab_email, $collab_user_name, $ticket_number, $ticket_subject, $check_attachment) { // Mail::send('emails.ticket_re-reply', ['content' => $reply_content, 'ticket_number' => $ticket_number, 'From' => $company, 'name' => $collab_user_name, 'Agent_Signature' => $agentsign], function ($message) use ($collab_email, $collab_user_name, $ticket_number, $ticket_subject, $check_attachment) {
// $message->to($collab_email, $collab_user_name)->subject($ticket_subject . '[#' . $ticket_number . ']'); // $message->to($collab_email, $collab_user_name)->subject($ticket_subject . '[#' . $ticket_number . ']');
@@ -341,13 +358,11 @@ try {
// }, true); // }, true);
try { try {
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('0', $ticketdata->dept_id), $to = ['user' => $admin_user, 'email' => $admin_email], $message = ['subject' => $updated_subject, 'body' => $body, 'scenario' => $mail], $template_variables = ['ticket_agent_name' => $admin_user, 'ticket_client_name' => $username, 'ticket_client_email' => $emailadd, 'user' => $admin_user, 'ticket_number' => $ticket_number2, 'email_address' => $emailadd, 'name' => $ticket_creator]); $this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('0', $ticketdata->dept_id), $to = ['user' => $admin_user, 'email' => $admin_email], $message = ['subject' => $updated_subject, 'body' => $body, 'scenario' => $mail], $template_variables = ['ticket_agent_name' => $admin_user, 'ticket_client_name' => $username, 'ticket_client_email' => $emailadd, 'user' => $admin_user, 'ticket_number' => $ticket_number2, 'email_address' => $emailadd, 'name' => $ticket_creator]);
} catch (\Exception $e) { } catch (\Exception $e) {
}
}
} }
return $thread; return $thread;
} catch (\Exception $e) { } catch (\Exception $e) {
return $e->getMessage(); return $e->getMessage();
@@ -355,17 +370,20 @@ try {
} }
/** /**
* company * company.
*
* @return type * @return type
*/ */
public function company() { public function company()
{
try { try {
$company = Company::Where('id', '=', '1')->first(); $company = Company::Where('id', '=', '1')->first();
if ($company->company_name == null) { if ($company->company_name == null) {
$company = "Support Center"; $company = 'Support Center';
} else { } else {
$company = $company->company_name; $company = $company->company_name;
} }
return $company; return $company;
} catch (\Exception $e) { } catch (\Exception $e) {
return $e->getMessage(); return $e->getMessage();
@@ -373,25 +391,28 @@ try {
} }
/** /**
* Ticket edit and save ticket data * Ticket edit and save ticket data.
* @param type $ticket_id *
* @param type $ticket_id
* @param type Ticket_Thread $thread * @param type Ticket_Thread $thread
*
* @return type bool * @return type bool
*/ */
public function ticketEditPost($ticket_id, $thread, $ticket) { public function ticketEditPost($ticket_id, $thread, $ticket)
{
try { try {
$ticket = $ticket->where('id', '=', $ticket_id)->first(); $ticket = $ticket->where('id', '=', $ticket_id)->first();
$ticket->sla = Input::get("sla_plan"); $ticket->sla = Input::get('sla_plan');
$ticket->help_topic_id = Input::get("help_topic"); $ticket->help_topic_id = Input::get('help_topic');
$ticket->source = Input::get("ticket_source"); $ticket->source = Input::get('ticket_source');
$ticket->priority_id = Input::get("ticket_priority"); $ticket->priority_id = Input::get('ticket_priority');
$ticket->save(); $ticket->save();
$threads = $thread->where('ticket_id', '=', $ticket_id)->first(); $threads = $thread->where('ticket_id', '=', $ticket_id)->first();
$threads->title = Input::get("subject"); $threads->title = Input::get('subject');
$threads->save(); $threads->save();
return $threads; return $threads;
} catch (\Exception $e) { } catch (\Exception $e) {
return $e->getMessage(); return $e->getMessage();
@@ -399,11 +420,14 @@ try {
} }
/** /**
* function to assign ticket * function to assign ticket.
*
* @param type $id * @param type $id
*
* @return type bool * @return type bool
*/ */
public function assign($id) { public function assign($id)
{
try { try {
$UserEmail = Input::get('user'); $UserEmail = Input::get('user');
//dd($UserEmail); //dd($UserEmail);
@@ -425,11 +449,11 @@ try {
return ['error' => 'No thread not found']; return ['error' => 'No thread not found'];
} }
$ticket_subject = $ticket_thread->title; $ticket_subject = $ticket_thread->title;
$thread = New Ticket_Thread; $thread = new Ticket_Thread();
$thread->ticket_id = $ticket->id; $thread->ticket_id = $ticket->id;
$thread->user_id = Auth::user()->id; $thread->user_id = Auth::user()->id;
$thread->is_internal = 1; $thread->is_internal = 1;
$thread->body = "This Ticket has been assigned to " . $user->first_name . " " . $user->last_name; $thread->body = 'This Ticket has been assigned to '.$user->first_name.' '.$user->last_name;
$thread->save(); $thread->save();
$company = $this->company(); $company = $this->company();
@@ -438,7 +462,7 @@ try {
$agent = $user->first_name; $agent = $user->first_name;
$agent_email = $user->email; $agent_email = $user->email;
$master = Auth::user()->first_name . " " . Auth::user()->last_name; $master = Auth::user()->first_name.' '.Auth::user()->last_name;
if (Alert::first()->internal_status == 1 || Alert::first()->internal_assigned_agent == 1) { if (Alert::first()->internal_status == 1 || Alert::first()->internal_assigned_agent == 1) {
// // ticket assigned send mail // // ticket assigned send mail
// Mail::send('emails.Ticket_assign', ['agent' => $agent, 'ticket_number' => $ticket_number, 'from' => $company, 'master' => $master, 'system' => $system], function ($message) use ($agent_email, $agent, $ticket_number, $ticket_subject) { // Mail::send('emails.Ticket_assign', ['agent' => $agent, 'ticket_number' => $ticket_number, 'from' => $company, 'master' => $master, 'system' => $system], function ($message) use ($agent_email, $agent, $ticket_number, $ticket_subject) {
@@ -446,13 +470,10 @@ try {
// }); // });
try { try {
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('0', $ticket->dept_id), $to = ['name' => $agent, 'email' => $agent_email], $message = ['subject' => $ticket_subject . '[#' . $ticket_number . ']', 'scenario' => 'assign-ticket'], $template_variables = ['ticket_agent_name' => $agent, 'ticket_number' => $ticket_number, 'ticket_assigner' => $master]); $this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('0', $ticket->dept_id), $to = ['name' => $agent, 'email' => $agent_email], $message = ['subject' => $ticket_subject.'[#'.$ticket_number.']', 'scenario' => 'assign-ticket'], $template_variables = ['ticket_agent_name' => $agent, 'ticket_number' => $ticket_number, 'ticket_assigner' => $master]);
} catch (\Exception $e) { } catch (\Exception $e) {
return 0; return 0;
} }
} }
return 1; return 1;
@@ -462,13 +483,15 @@ try {
} }
/** /**
* Function to delete ticket * Function to delete ticket.
* @param type $id *
* @param type $id
* @param type Tickets $ticket * @param type Tickets $ticket
*
* @return type string * @return type string
*/ */
public function delete($ids, $ticket) { public function delete($ids, $ticket)
{
try { try {
foreach ($ids as $id) { foreach ($ids as $id) {
$ticket_delete = $ticket->where('id', '=', $id)->first(); $ticket_delete = $ticket->where('id', '=', $id)->first();
@@ -496,29 +519,33 @@ try {
$ticket_delete->status = 5; $ticket_delete->status = 5;
$ticket_delete->save(); $ticket_delete->save();
$ticket_status_message = Ticket_Status::where('id', '=', $ticket_delete->status)->first(); $ticket_status_message = Ticket_Status::where('id', '=', $ticket_delete->status)->first();
$thread = New Ticket_Thread; $thread = new Ticket_Thread();
$thread->ticket_id = $ticket_delete->id; $thread->ticket_id = $ticket_delete->id;
$thread->user_id = Auth::user()->id; $thread->user_id = Auth::user()->id;
$thread->is_internal = 1; $thread->is_internal = 1;
$thread->body = $ticket_status_message->message . " " . Auth::user()->first_name . " " . Auth::user()->last_name; $thread->body = $ticket_status_message->message.' '.Auth::user()->first_name.' '.Auth::user()->last_name;
$thread->save(); $thread->save();
} }
} else { } else {
return "ticket not found"; return 'ticket not found';
} }
} }
return "your tickets has been deleted";
return 'your tickets has been deleted';
} catch (\Exception $e) { } catch (\Exception $e) {
return $e->getMessage(); return $e->getMessage();
} }
} }
/** /**
* check email for dublicate entry * check email for dublicate entry.
*
* @param type $email * @param type $email
*
* @return type bool * @return type bool
*/ */
public function checkEmail($email) { public function checkEmail($email)
{
try { try {
$check = User::where('email', '=', $email)->first(); $check = User::where('email', '=', $email)->first();
if ($check == true) { if ($check == true) {
@@ -532,17 +559,20 @@ try {
} }
/** /**
* system * system.
*
* @return type * @return type
*/ */
public function system() { public function system()
{
try { try {
$system = System::Where('id', '=', '1')->first(); $system = System::Where('id', '=', '1')->first();
if ($system->name == null) { if ($system->name == null) {
$system = "Support Center"; $system = 'Support Center';
} else { } else {
$system = $system->name; $system = $system->name;
} }
return $system; return $system;
} catch (\Exception $e) { } catch (\Exception $e) {
return $e->getMessage(); return $e->getMessage();
@@ -550,22 +580,25 @@ try {
} }
/** /**
* Create Attachment * Create Attachment.
*
* @param type $thread * @param type $thread
* @param type $attach * @param type $attach
*
* @return int * @return int
*/ */
public function attach($thread, $attach) { public function attach($thread, $attach)
{
try { try {
$ta = new Ticket_attachments(); $ta = new Ticket_attachments();
foreach ($attach as $file) { foreach ($attach as $file) {
$ta->create(['thread_id' => $thread, 'name' => $file['name'], 'size' => $file['size'], 'type' => $file['type'], 'file' => $file['file'], 'poster' => 'ATTACHMENT']); $ta->create(['thread_id' => $thread, 'name' => $file['name'], 'size' => $file['size'], 'type' => $file['type'], 'file' => $file['file'], 'poster' => 'ATTACHMENT']);
} }
$ta->create(['thread_id' => $thread, 'name' => $name, 'size' => $size, 'type' => $type, 'file' => $file, 'poster' => 'ATTACHMENT']); $ta->create(['thread_id' => $thread, 'name' => $name, 'size' => $size, 'type' => $type, 'file' => $file, 'poster' => 'ATTACHMENT']);
return 1; return 1;
} catch (\Exception $e) { } catch (\Exception $e) {
return $e->getMessage(); return $e->getMessage();
} }
} }
} }

View File

@@ -3,39 +3,40 @@
namespace App\Http\Controllers\Api\v1; namespace App\Http\Controllers\Api\v1;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
use JWTAuth; use JWTAuth;
use Tymon\JWTAuth\Exceptions\JWTException; use Tymon\JWTAuth\Exceptions\JWTException;
use App\Http\Requests;
use Illuminate\Http\Request;
use App\User;
use Illuminate\Support\Facades\Hash;
/** /**
* ----------------------------------------------------------------------------- * -----------------------------------------------------------------------------
* Token authenticate Controller * Token authenticate Controller
* ----------------------------------------------------------------------------- * -----------------------------------------------------------------------------.
* *
* *
* @author Vijay Sebastian <vijay.sebastian@ladybirdweb.com> * @author Vijay Sebastian <vijay.sebastian@ladybirdweb.com>
* @copyright (c) 2016, Ladybird Web Solution * @copyright (c) 2016, Ladybird Web Solution
* @name Faveo HELPDESK * @name Faveo HELPDESK
*
* @version v1 * @version v1
*
*
*/ */
class TokenAuthController extends Controller { class TokenAuthController extends Controller
{
public function __construct() { public function __construct()
{
$this->middleware('api'); $this->middleware('api');
} }
/** /**
* Authenticating user with username and password and retuen token * Authenticating user with username and password and retuen token.
*
* @param Request $request * @param Request $request
*
* @return type json * @return type json
*/ */
public function authenticate(Request $request) { public function authenticate(Request $request)
{
$usernameinput = $request->input('username'); $usernameinput = $request->input('username');
$password = $request->input('password'); $password = $request->input('password');
$field = filter_var($usernameinput, FILTER_VALIDATE_EMAIL) ? 'email' : 'user_name'; $field = filter_var($usernameinput, FILTER_VALIDATE_EMAIL) ? 'email' : 'user_name';
@@ -50,6 +51,7 @@ class TokenAuthController extends Controller {
return response()->json(['error' => 'could_not_create_token', 500]); return response()->json(['error' => 'could_not_create_token', 500]);
} catch (\Exception $e) { } catch (\Exception $e) {
$error = $e->getMessage(); $error = $e->getMessage();
return response()->json(compact('error')); return response()->json(compact('error'));
} }
@@ -58,27 +60,26 @@ class TokenAuthController extends Controller {
} }
/** /**
* Get the user details from token * Get the user details from token.
*
* @return type json * @return type json
*/ */
public function getAuthenticatedUser() { public function getAuthenticatedUser()
{
//dd(JWTAuth::parseToken()->authenticate()); //dd(JWTAuth::parseToken()->authenticate());
try { try {
if (!$user = JWTAuth::parseToken()->authenticate()) { if (!$user = JWTAuth::parseToken()->authenticate()) {
return response()->json(['user_not_found', 404]); return response()->json(['user_not_found', 404]);
} }
} catch (\Tymon\JWTAuth\Exceptions\TokenExpiredException $e) { } catch (\Tymon\JWTAuth\Exceptions\TokenExpiredException $e) {
return response()->json(['token_expired', $e->getStatusCode()]); return response()->json(['token_expired', $e->getStatusCode()]);
} catch (\Tymon\JWTAuth\Exceptions\TokenInvalidException $e) { } catch (\Tymon\JWTAuth\Exceptions\TokenInvalidException $e) {
return response()->json(['token_invalid', $e->getStatusCode()]); return response()->json(['token_invalid', $e->getStatusCode()]);
} catch (\Tymon\JWTAuth\Exceptions\JWTException $e) { } catch (\Tymon\JWTAuth\Exceptions\JWTException $e) {
return response()->json(['token_absent', $e->getStatusCode()]); return response()->json(['token_absent', $e->getStatusCode()]);
} catch (\Exception $e) { } catch (\Exception $e) {
$error = $e->getMessage(); $error = $e->getMessage();
return response()->json(compact('error')); return response()->json(compact('error'));
} }
//dd($user); //dd($user);
@@ -86,18 +87,22 @@ class TokenAuthController extends Controller {
} }
/** /**
* Register a user with username and password * Register a user with username and password.
*
* @param Request $request * @param Request $request
*
* @return type json * @return type json
*/ */
public function register(Request $request) { public function register(Request $request)
{
try { try {
$v = \Validator::make($request->all(), [ $v = \Validator::make($request->all(), [
'email' => 'required|email|unique:users', 'email' => 'required|email|unique:users',
'password' => 'required', 'password' => 'required',
]); ]);
if ($v->fails()) { if ($v->fails()) {
$error = $v->errors(); $error = $v->errors();
return response()->json(compact('error')); return response()->json(compact('error'));
} }
$newuser = $request->all(); $newuser = $request->all();
@@ -108,30 +113,34 @@ class TokenAuthController extends Controller {
return User::create($newuser); return User::create($newuser);
} catch (\Exception $e) { } catch (\Exception $e) {
$error = $e->getMessage(); $error = $e->getMessage();
return response()->json(compact('error')); return response()->json(compact('error'));
} }
} }
/** /**
* verify the url is existing or not * verify the url is existing or not.
*
* @return type json * @return type json
*/ */
public function checkUrl() { public function checkUrl()
{
try { try {
$v = \Validator::make($request->all(), [ $v = \Validator::make($request->all(), [
'url' => 'required|url' 'url' => 'required|url',
]); ]);
if ($v->fails()) { if ($v->fails()) {
$error = $v->errors(); $error = $v->errors();
return response()->json(compact('error')); return response()->json(compact('error'));
} }
$url = $this->request->input('url'); $url = $this->request->input('url');
$url = $url . '/api/v1/helpdesk/check-url'; $url = $url.'/api/v1/helpdesk/check-url';
} catch (Exception $ex) { } catch (Exception $ex) {
$error = $e->getMessage(); $error = $e->getMessage();
return response()->json(compact('error')); return response()->json(compact('error'));
} }
} }
} }

View File

@@ -3,21 +3,20 @@
namespace App\Http\Controllers\Auth; namespace App\Http\Controllers\Auth;
// controllers // controllers
use App\Http\Controllers\Controller;
use App\Http\Controllers\Common\SettingsController;
use App\Http\Controllers\Common\PhpMailController; use App\Http\Controllers\Common\PhpMailController;
use App\Http\Controllers\Common\SettingsController;
use App\Http\Controllers\Controller;
// requests // requests
use App\Http\Requests\helpdesk\LoginRequest; use App\Http\Requests\helpdesk\LoginRequest;
use App\Http\Requests\helpdesk\RegisterRequest; use App\Http\Requests\helpdesk\RegisterRequest;
use App\User; use App\User;
// classes // classes
use Auth;
use Hash; use Hash;
use Illuminate\Contracts\Auth\Guard; use Illuminate\Contracts\Auth\Guard;
use Illuminate\Contracts\Auth\Registrar; use Illuminate\Contracts\Auth\Registrar;
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers; use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;
use Mail; use Mail;
use Auth;
use Exception;
/** /**
* --------------------------------------------------- * ---------------------------------------------------
@@ -27,12 +26,10 @@ use Exception;
* authentication of existing users. By default, this controller uses * authentication of existing users. By default, this controller uses
* a simple trait to add these behaviors. Why don't you explore it? * a simple trait to add these behaviors. Why don't you explore it?
* *
* @package Controllers
* @subpackage Controller
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class AuthController extends Controller { class AuthController extends Controller
{
use AuthenticatesAndRegistersUsers; use AuthenticatesAndRegistersUsers;
/* to redirect after login */ /* to redirect after login */
@@ -47,11 +44,13 @@ class AuthController extends Controller {
/** /**
* Create a new authentication controller instance. * Create a new authentication controller instance.
* *
* @param \Illuminate\Contracts\Auth\Guard $auth * @param \Illuminate\Contracts\Auth\Guard $auth
* @param \Illuminate\Contracts\Auth\Registrar $registrar * @param \Illuminate\Contracts\Auth\Registrar $registrar
*
* @return void * @return void
*/ */
public function __construct(Guard $auth, Registrar $registrar, PhpMailController $PhpMailController) { public function __construct(Guard $auth, Registrar $registrar, PhpMailController $PhpMailController)
{
$this->PhpMailController = $PhpMailController; $this->PhpMailController = $PhpMailController;
SettingsController::smtp(); SettingsController::smtp();
$this->auth = $auth; $this->auth = $auth;
@@ -60,17 +59,19 @@ class AuthController extends Controller {
} }
/** /**
* Get the form for registration * Get the form for registration.
*
* @return type Response * @return type Response
*/ */
public function getRegister() { public function getRegister()
{
// Event for login // Event for login
\Event::fire(new \App\Events\FormRegisterEvent()); \Event::fire(new \App\Events\FormRegisterEvent());
if (Auth::user()) { if (Auth::user()) {
if (Auth::user()->role == "admin" || Auth::user()->role == "agent") { if (Auth::user()->role == 'admin' || Auth::user()->role == 'agent') {
return \Redirect::route('dashboard'); return \Redirect::route('dashboard');
} elseif (Auth::user()->role == "user") { } elseif (Auth::user()->role == 'user') {
// return view('auth.register'); // return view('auth.register');
} }
} else { } else {
return view('auth.register'); return view('auth.register');
@@ -78,12 +79,15 @@ class AuthController extends Controller {
} }
/** /**
* Post registration form * Post registration form.
* @param type User $user *
* @param type User $user
* @param type RegisterRequest $request * @param type RegisterRequest $request
*
* @return type Response * @return type Response
*/ */
public function postRegister(User $user, RegisterRequest $request) { public function postRegister(User $user, RegisterRequest $request)
{
// Event for login // Event for login
\Event::fire(new \App\Events\LoginEvent($request)); \Event::fire(new \App\Events\LoginEvent($request));
@@ -105,24 +109,26 @@ class AuthController extends Controller {
// $message->to($user->email, $user->full_name)->subject('active your account'); // $message->to($user->email, $user->full_name)->subject('active your account');
// }); // });
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $name, 'email' => $request->input('email')], $message = ['subject' => 'password', 'scenario' => 'registration-notification'], $template_variables = ['user' => $name, 'email_address' => $request->input('email'), 'password_reset_link' => url('password/reset/' . $code)]); $this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $name, 'email' => $request->input('email')], $message = ['subject' => 'password', 'scenario' => 'registration-notification'], $template_variables = ['user' => $name, 'email_address' => $request->input('email'), 'password_reset_link' => url('password/reset/'.$code)]);
return redirect('home')->with('success', 'Activate Your Account ! Click on Link that send to your mail'); return redirect('home')->with('success', 'Activate Your Account ! Click on Link that send to your mail');
} }
/** /**
* Get mail function * Get mail function.
* @param type $token *
* @param type $token
* @param type User $user * @param type User $user
*
* @return type Response * @return type Response
*/ */
public function getMail($token, User $user) { public function getMail($token, User $user)
{
$user = $user->where('remember_token', $token)->where('active', 0)->first(); $user = $user->where('remember_token', $token)->where('active', 0)->first();
if ($user) { if ($user) {
$user->active = 1; $user->active = 1;
$user->save(); $user->save();
return redirect('auth/login'); return redirect('auth/login');
} else { } else {
return redirect('auth/login'); return redirect('auth/login');
@@ -130,14 +136,16 @@ class AuthController extends Controller {
} }
/** /**
* Get login page * Get login page.
*
* @return type Response * @return type Response
*/ */
public function getLogin() { public function getLogin()
{
if (Auth::user()) { if (Auth::user()) {
if (Auth::user()->role == "admin" || Auth::user()->role == "agent") { if (Auth::user()->role == 'admin' || Auth::user()->role == 'agent') {
return \Redirect::route('dashboard'); return \Redirect::route('dashboard');
} elseif (Auth::user()->role == "user") { } elseif (Auth::user()->role == 'user') {
return \Redirect::route('home'); return \Redirect::route('home');
} }
} else { } else {
@@ -146,11 +154,14 @@ class AuthController extends Controller {
} }
/** /**
* Post of login page * Post of login page.
*
* @param type LoginRequest $request * @param type LoginRequest $request
*
* @return type Response * @return type Response
*/ */
public function postLogin(LoginRequest $request) { public function postLogin(LoginRequest $request)
{
// Set login attempts and login time // Set login attempts and login time
$loginAttempts = 1; $loginAttempts = 1;
$usernameinput = $request->input('email'); $usernameinput = $request->input('email');
@@ -186,21 +197,23 @@ class AuthController extends Controller {
return redirect()->intended($this->redirectPath()); return redirect()->intended($this->redirectPath());
} }
} }
return redirect($this->loginPath()) return redirect($this->loginPath())
->withInput($request->only('email', 'remember')) ->withInput($request->only('email', 'remember'))
->withErrors([ ->withErrors([
'email' => $this->getFailedLoginMessage(), 'email' => $this->getFailedLoginMessage(),
'password' => $this->getFailedLoginMessage(), 'password' => $this->getFailedLoginMessage(),
]); ]);
// Increment login attempts // Increment login attempts
} }
/** /**
* Get Failed login message * Get Failed login message.
*
* @return type string * @return type string
*/ */
protected function getFailedLoginMessage() { protected function getFailedLoginMessage()
{
return 'This Field do not match our records.'; return 'This Field do not match our records.';
} }
} }

View File

@@ -3,39 +3,37 @@
namespace App\Http\Controllers\Auth; namespace App\Http\Controllers\Auth;
// controllers // controllers
use App\Http\Controllers\Controller;
use App\Http\Controllers\Common\SettingsController;
use App\Http\Controllers\Common\PhpMailController; use App\Http\Controllers\Common\PhpMailController;
use App\Http\Controllers\Common\SettingsController;
use App\Http\Controllers\Controller;
// request // request
use Illuminate\Http\Request;
// model
use App\User; use App\User;
// classes // model
use Illuminate\Contracts\Auth\Guard; use Illuminate\Contracts\Auth\Guard;
// classes
use Illuminate\Contracts\Auth\PasswordBroker; use Illuminate\Contracts\Auth\PasswordBroker;
use Illuminate\Foundation\Auth\ResetsPasswords; use Illuminate\Foundation\Auth\ResetsPasswords;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Illuminate\Http\Request;
use Exception;
/** /**
* PasswordController * PasswordController.
* *
* @package Controllers
* @subpackage Controller
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class PasswordController extends Controller { class PasswordController extends Controller
{
use ResetsPasswords; use ResetsPasswords;
/** /**
* Create a new password controller instance. * Create a new password controller instance.
* *
* @param \Illuminate\Contracts\Auth\Guard $auth * @param \Illuminate\Contracts\Auth\Guard $auth
* @param \Illuminate\Contracts\Auth\PasswordBroker $passwords * @param \Illuminate\Contracts\Auth\PasswordBroker $passwords
*
* @return void * @return void
*/ */
public function __construct(Guard $auth, PasswordBroker $passwords, PhpMailController $PhpMailController) { public function __construct(Guard $auth, PasswordBroker $passwords, PhpMailController $PhpMailController)
{
$this->PhpMailController = $PhpMailController; $this->PhpMailController = $PhpMailController;
$this->auth = $auth; $this->auth = $auth;
$this->passwords = $passwords; $this->passwords = $passwords;
@@ -48,7 +46,8 @@ class PasswordController extends Controller {
* *
* @return Response * @return Response
*/ */
public function getEmail() { public function getEmail()
{
return view('auth.password'); return view('auth.password');
} }
@@ -57,7 +56,8 @@ class PasswordController extends Controller {
* *
* @return Response * @return Response
*/ */
public function postEmail(Request $request) { public function postEmail(Request $request)
{
$date = date('Y-m-d H:i:s'); $date = date('Y-m-d H:i:s');
$this->validate($request, ['email' => 'required|email']); $this->validate($request, ['email' => 'required|email']);
$user = User::where('email', '=', $request->only('email'))->first(); $user = User::where('email', '=', $request->only('email'))->first();
@@ -67,7 +67,6 @@ class PasswordController extends Controller {
$code = str_random(60); $code = str_random(60);
$password_reset_table = \DB::table('password_resets')->where('email', '=', $user->email)->first(); $password_reset_table = \DB::table('password_resets')->where('email', '=', $user->email)->first();
if (isset($password_reset_table)) { if (isset($password_reset_table)) {
$password_reset_table = \DB::table('password_resets')->where('email', '=', $user->email)->update(['token' => $code, 'created_at' => $date]); $password_reset_table = \DB::table('password_resets')->where('email', '=', $user->email)->update(['token' => $code, 'created_at' => $date]);
// $password_reset_table->token = $code; // $password_reset_table->token = $code;
// $password_reset_table->update(['token' => $code]); // $password_reset_table->update(['token' => $code]);
@@ -75,12 +74,11 @@ class PasswordController extends Controller {
$create_password_reset = \DB::table('password_resets')->insert(['email' => $user->email, 'token' => $code, 'created_at' => $date]); $create_password_reset = \DB::table('password_resets')->insert(['email' => $user->email, 'token' => $code, 'created_at' => $date]);
} }
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $user->user_name, 'email' => $user->email], $message = ['subject' => 'Your Password Reset Link', 'scenario' => 'reset-password'], $template_variables = ['user' => $user->user_name, 'email_address' => $user->email, 'password_reset_link' => url('password/reset/' . $code)]); $this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $user->user_name, 'email' => $user->email], $message = ['subject' => 'Your Password Reset Link', 'scenario' => 'reset-password'], $template_variables = ['user' => $user->user_name, 'email_address' => $user->email, 'password_reset_link' => url('password/reset/'.$code)]);
return redirect()->back()->with('status', 'We have e-mailed your password reset link!'); return redirect()->back()->with('status', 'We have e-mailed your password reset link!');
} else { } else {
return redirect()->back()->with('errors', "We can't find a user with that e-mail address."); return redirect()->back()->with('errors', "We can't find a user with that e-mail address.");
} }
} }
} }

View File

@@ -32,24 +32,23 @@ use Input;
use Redirect; use Redirect;
/** /**
* UserController * UserController.
* *
* @package Controllers
* @subpackage Controller
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class UserController extends Controller { class UserController extends Controller
{
/** /**
* Create a new controller instance. * Create a new controller instance.
* constructor to check * constructor to check
* 1. authentication * 1. authentication
* 2. user roles * 2. user roles
* 3. roles must be agent * 3. roles must be agent.
* *
* @return void * @return void
*/ */
public function __construct() { public function __construct()
{
$this->middleware('auth'); $this->middleware('auth');
$this->middleware('role.agent'); $this->middleware('role.agent');
// $this->middleware('roles'); // $this->middleware('roles');
@@ -57,10 +56,13 @@ class UserController extends Controller {
/** /**
* Display a listing of the resource. * Display a listing of the resource.
*
* @param type User $user * @param type User $user
*
* @return type Response * @return type Response
*/ */
public function index() { public function index()
{
try { try {
/* get all values in Sys_user */ /* get all values in Sys_user */
return view('themes.default1.agent.helpdesk.user.index'); return view('themes.default1.agent.helpdesk.user.index');
@@ -70,11 +72,12 @@ class UserController extends Controller {
} }
/** /**
* This function is used to display the list of users * This function is used to display the list of users.
*
* @return datatable * @return datatable
*/ */
public function user_list() { public function user_list()
{
return \Datatable::collection(User::where('role', '!=', 'admin')->where('role', '!=', 'agent')->get()) return \Datatable::collection(User::where('role', '!=', 'admin')->where('role', '!=', 'agent')->get())
->searchColumns('user_name') ->searchColumns('user_name')
->orderColumns('user_name', 'email') ->orderColumns('user_name', 'email')
@@ -83,18 +86,20 @@ class UserController extends Controller {
}) })
->addColumn('email', function ($model) { ->addColumn('email', function ($model) {
$email = $model->email; $email = $model->email;
return $email; return $email;
}) })
->addColumn('phone', function ($model) { ->addColumn('phone', function ($model) {
$phone = ""; $phone = '';
if ($model->phone_number) { if ($model->phone_number) {
$phone = $model->ext . ' ' . $model->phone_number; $phone = $model->ext.' '.$model->phone_number;
} }
$mobile = ""; $mobile = '';
if ($model->mobile) { if ($model->mobile) {
$mobile = $model->mobile; $mobile = $model->mobile;
} }
$phone = $phone . "&nbsp;&nbsp;&nbsp;" . $mobile; $phone = $phone.'&nbsp;&nbsp;&nbsp;'.$mobile;
return $phone; return $phone;
}) })
->addColumn('status', function ($model) { ->addColumn('status', function ($model) {
@@ -104,17 +109,19 @@ class UserController extends Controller {
} else { } else {
$stat = '<button class="btn btn-danger btn-xs">Inactive</button>'; $stat = '<button class="btn btn-danger btn-xs">Inactive</button>';
} }
return $stat; return $stat;
}) })
->addColumn('lastlogin', function ($model) { ->addColumn('lastlogin', function ($model) {
$t = $model->updated_at; $t = $model->updated_at;
return TicketController::usertimezone($t); return TicketController::usertimezone($t);
}) })
->addColumn('Actions', function ($model) { ->addColumn('Actions', function ($model) {
//return '<a href=article/delete/ ' . $model->id . ' class="btn btn-danger btn-flat" onclick="myFunction()">Delete</a>&nbsp;<a href=article/' . $model->id . '/edit class="btn btn-warning btn-flat">Edit</a>&nbsp;<a href=show/' . $model->id . ' class="btn btn-warning btn-flat">View</a>'; //return '<a href=article/delete/ ' . $model->id . ' class="btn btn-danger btn-flat" onclick="myFunction()">Delete</a>&nbsp;<a href=article/' . $model->id . '/edit class="btn btn-warning btn-flat">Edit</a>&nbsp;<a href=show/' . $model->id . ' class="btn btn-warning btn-flat">View</a>';
//return '<form action="article/delete/ ' . $model->id . '" method="post" onclick="alert()"><button type="sumbit" value="Delete"></button></form><a href=article/' . $model->id . '/edit class="btn btn-warning btn-flat">Edit</a>&nbsp;<a href=show/' . $model->id . ' class="btn btn-warning btn-flat">View</a>'; //return '<form action="article/delete/ ' . $model->id . '" method="post" onclick="alert()"><button type="sumbit" value="Delete"></button></form><a href=article/' . $model->id . '/edit class="btn btn-warning btn-flat">Edit</a>&nbsp;<a href=show/' . $model->id . ' class="btn btn-warning btn-flat">View</a>';
return '<span data-toggle="modal" data-target="#deletearticle' . $model->id . '"><a href="#" ><button class="btn btn-danger btn-xs"></a> ' . \Lang::get('lang.delete') . ' </button></span>&nbsp;<a href="' . route('user.edit', $model->id) . '" class="btn btn-warning btn-xs">' . \Lang::get('lang.edit') . '</a>&nbsp;<a href="' . route('user.show', $model->id) . '" class="btn btn-primary btn-xs">' . \Lang::get('lang.view') . '</a> return '<span data-toggle="modal" data-target="#deletearticle'.$model->id.'"><a href="#" ><button class="btn btn-danger btn-xs"></a> '.\Lang::get('lang.delete').' </button></span>&nbsp;<a href="'.route('user.edit', $model->id).'" class="btn btn-warning btn-xs">'.\Lang::get('lang.edit').'</a>&nbsp;<a href="'.route('user.show', $model->id).'" class="btn btn-primary btn-xs">'.\Lang::get('lang.view').'</a>
<div class="modal fade" id="deletearticle' . $model->id . '"> <div class="modal fade" id="deletearticle'.$model->id.'">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
@@ -122,11 +129,11 @@ class UserController extends Controller {
<h4 class="modal-title">Are You Sure ?</h4> <h4 class="modal-title">Are You Sure ?</h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
' . $model->user_name . ' '.$model->user_name.'
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">Close</button> <button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">Close</button>
<a href="' . route('user.delete', $model->id) . '"><button class="btn btn-danger">delete</button></a> <a href="'.route('user.delete', $model->id).'"><button class="btn btn-danger">delete</button></a>
</div> </div>
</div><!-- /.modal-content --> </div><!-- /.modal-content -->
</div><!-- /.modal-dialog --> </div><!-- /.modal-dialog -->
@@ -137,9 +144,11 @@ class UserController extends Controller {
/** /**
* Show the form for creating a new resource. * Show the form for creating a new resource.
*
* @return type Response * @return type Response
*/ */
public function create() { public function create()
{
try { try {
return view('themes.default1.agent.helpdesk.user.create'); return view('themes.default1.agent.helpdesk.user.create');
} catch (Exception $e) { } catch (Exception $e) {
@@ -149,11 +158,14 @@ class UserController extends Controller {
/** /**
* Store a newly created resource in storage. * Store a newly created resource in storage.
* @param type User $user *
* @param type User $user
* @param type Sys_userRequest $request * @param type Sys_userRequest $request
*
* @return type Response * @return type Response
*/ */
public function store(User $user, Sys_userRequest $request) { public function store(User $user, Sys_userRequest $request)
{
try { try {
/* insert the input request to sys_user table */ /* insert the input request to sys_user table */
/* Check whether function success or not */ /* Check whether function success or not */
@@ -180,14 +192,18 @@ class UserController extends Controller {
/** /**
* Display the specified resource. * Display the specified resource.
*
* @param type int $id * @param type int $id
* @param type User $user * @param type User $user
*
* @return type Response * @return type Response
*/ */
public function show($id, User $user) { public function show($id, User $user)
{
try { try {
/* select the field where id = $id(request Id) */ /* select the field where id = $id(request Id) */
$users = $user->whereId($id)->first(); $users = $user->whereId($id)->first();
return view('themes.default1.agent.helpdesk.user.show', compact('users')); return view('themes.default1.agent.helpdesk.user.show', compact('users'));
} catch (Exception $e) { } catch (Exception $e) {
return view('404'); return view('404');
@@ -196,14 +212,18 @@ class UserController extends Controller {
/** /**
* Show the form for editing the specified resource. * Show the form for editing the specified resource.
* @param type int $id *
* @param type int $id
* @param type User $user * @param type User $user
*
* @return type Response * @return type Response
*/ */
public function edit($id, User $user) { public function edit($id, User $user)
{
try { try {
/* select the field where id = $id(request Id) */ /* select the field where id = $id(request Id) */
$users = $user->whereId($id)->first(); $users = $user->whereId($id)->first();
return view('themes.default1.agent.helpdesk.user.edit', compact('users')); return view('themes.default1.agent.helpdesk.user.edit', compact('users'));
} catch (Exception $e) { } catch (Exception $e) {
return view('404'); return view('404');
@@ -212,12 +232,15 @@ class UserController extends Controller {
/** /**
* Update the specified resource in storage. * Update the specified resource in storage.
* @param type int $id *
* @param type User $user * @param type int $id
* @param type User $user
* @param type Sys_userUpdate $request * @param type Sys_userUpdate $request
*
* @return type Response * @return type Response
*/ */
public function update($id, User $user, Sys_userUpdate $request) { public function update($id, User $user, Sys_userUpdate $request)
{
try { try {
/* select the field where id = $id(request Id) */ /* select the field where id = $id(request Id) */
$users = $user->whereId($id)->first(); $users = $user->whereId($id)->first();
@@ -238,11 +261,14 @@ class UserController extends Controller {
/** /**
* Remove the specified resource from storage. * Remove the specified resource from storage.
* @param type int $id *
* @param type int $id
* @param type User $user * @param type User $user
*
* @return type Response * @return type Response
*/ */
public function destroy($id, User $user) { public function destroy($id, User $user)
{
try { try {
/* select the field where id = $id(request Id) */ /* select the field where id = $id(request Id) */
$users = $user->whereId($id)->first(); $users = $user->whereId($id)->first();
@@ -262,30 +288,39 @@ class UserController extends Controller {
} }
/** /**
* get profile page * get profile page.
*
* @return type Response * @return type Response
*/ */
public function getProfile() { public function getProfile()
{
$user = Auth::user(); $user = Auth::user();
return view('themes.default1.agent.helpdesk.user.profile', compact('user')); return view('themes.default1.agent.helpdesk.user.profile', compact('user'));
} }
/** /**
* get profile edit page * get profile edit page.
*
* @return type Response * @return type Response
*/ */
public function getProfileedit() { public function getProfileedit()
{
$user = Auth::user(); $user = Auth::user();
return view('themes.default1.agent.helpdesk.user.profile-edit', compact('user')); return view('themes.default1.agent.helpdesk.user.profile-edit', compact('user'));
} }
/** /**
* post profile page * post profile page.
* @param type int $id *
* @param type int $id
* @param type ProfileRequest $request * @param type ProfileRequest $request
*
* @return type Response * @return type Response
*/ */
public function postProfileedit(ProfileRequest $request) { public function postProfileedit(ProfileRequest $request)
{
$user = Auth::user(); $user = Auth::user();
$user->gender = $request->input('gender'); $user->gender = $request->input('gender');
$user->save(); $user->save();
@@ -304,12 +339,13 @@ class UserController extends Controller {
//$extension = Input::file('profile_pic')->getClientOriginalExtension(); //$extension = Input::file('profile_pic')->getClientOriginalExtension();
$name = Input::file('profile_pic')->getClientOriginalName(); $name = Input::file('profile_pic')->getClientOriginalName();
$destinationPath = 'lb-faveo/profilepic'; $destinationPath = 'lb-faveo/profilepic';
$fileName = rand(0000, 9999) . '.' . $name; $fileName = rand(0000, 9999).'.'.$name;
//echo $fileName; //echo $fileName;
Input::file('profile_pic')->move($destinationPath, $fileName); Input::file('profile_pic')->move($destinationPath, $fileName);
$user->profile_pic = $fileName; $user->profile_pic = $fileName;
} else { } else {
$user->fill($request->except('profile_pic', 'gender'))->save(); $user->fill($request->except('profile_pic', 'gender'))->save();
return Redirect::route('profile')->with('success', 'Profile Updated sucessfully'); return Redirect::route('profile')->with('success', 'Profile Updated sucessfully');
} }
if ($user->fill($request->except('profile_pic'))->save()) { if ($user->fill($request->except('profile_pic'))->save()) {
@@ -318,17 +354,21 @@ class UserController extends Controller {
} }
/** /**
* Post profile password * Post profile password.
* @param type int $id *
* @param type int $id
* @param type ProfilePassword $request * @param type ProfilePassword $request
*
* @return type Response * @return type Response
*/ */
public function postProfilePassword($id, ProfilePassword $request) { public function postProfilePassword($id, ProfilePassword $request)
{
$user = Auth::user(); $user = Auth::user();
//echo $user->password; //echo $user->password;
if (Hash::check($request->input('old_password'), $user->getAuthPassword())) { if (Hash::check($request->input('old_password'), $user->getAuthPassword())) {
$user->password = Hash::make($request->input('new_password')); $user->password = Hash::make($request->input('new_password'));
$user->save(); $user->save();
return redirect('profile-edit')->with('success1', 'Password Updated sucessfully'); return redirect('profile-edit')->with('success1', 'Password Updated sucessfully');
} else { } else {
return redirect('profile-edit')->with('fails1', 'Password was not Updated. Incorrect old password'); return redirect('profile-edit')->with('fails1', 'Password was not Updated. Incorrect old password');
@@ -336,25 +376,30 @@ class UserController extends Controller {
} }
/** /**
* User Assign Org * User Assign Org.
* @param type $id *
* @param type $id
*
* @return type boolean * @return type boolean
*/ */
public function UserAssignOrg($id) { public function UserAssignOrg($id)
{
$org = Input::get('org'); $org = Input::get('org');
$user_org = new User_org; $user_org = new User_org();
$user_org->org_id = $org; $user_org->org_id = $org;
$user_org->user_id = $id; $user_org->user_id = $id;
$user_org->save(); $user_org->save();
return 1; return 1;
} }
/** /**
* user create organisation * user create organisation.
*
* @return type value * @return type value
*/ */
public function User_Create_Org($id) { public function User_Create_Org($id)
{
if (Input::get('website') != null) { if (Input::get('website') != null) {
// checking website // checking website
$check = Organization::where('website', '=', Input::get('website'))->first(); $check = Organization::where('website', '=', Input::get('website'))->first();
@@ -366,13 +411,13 @@ class UserController extends Controller {
$check2 = Organization::where('name', '=', Input::get('name'))->first(); $check2 = Organization::where('name', '=', Input::get('name'))->first();
if (\Input::get('name') == null) { if (\Input::get('name') == null) {
return "Name is required"; return 'Name is required';
} elseif ($check2 != null) { } elseif ($check2 != null) {
return "Name should be Unique"; return 'Name should be Unique';
} elseif ($check != null) { } elseif ($check != null) {
return "Website should be Unique"; return 'Website should be Unique';
} else { } else {
$org = new Organization; $org = new Organization();
$org->name = Input::get('name'); $org->name = Input::get('name');
$org->phone = Input::get('phone'); $org->phone = Input::get('phone');
$org->website = Input::get('website'); $org->website = Input::get('website');
@@ -380,7 +425,7 @@ class UserController extends Controller {
$org->internal_notes = Input::get('internal'); $org->internal_notes = Input::get('internal');
$org->save(); $org->save();
$user_org = new User_org; $user_org = new User_org();
$user_org->org_id = $org->id; $user_org->org_id = $org->id;
$user_org->user_id = $id; $user_org->user_id = $id;
$user_org->save(); $user_org->save();
@@ -388,5 +433,4 @@ class UserController extends Controller {
return 0; return 0;
} }
} }
} }

View File

@@ -3,70 +3,60 @@
namespace App\Http\Controllers\Client\helpdesk; namespace App\Http\Controllers\Client\helpdesk;
// controllers // controllers
use App\Http\Controllers\Controller;
use App\Http\Controllers\Agent\helpdesk\TicketController;
use App\Http\Controllers\Common\SettingsController; use App\Http\Controllers\Common\SettingsController;
use App\Http\Controllers\Controller;
// requests // requests
use Illuminate\Http\Request;
use App\Http\Requests\helpdesk\CreateTicketRequest;
use App\Http\Requests\helpdesk\TicketRequest;
use App\Http\Requests\helpdesk\TicketEditRequest;
// models
use App\Model\helpdesk\Email\Banlist;
use App\Model\helpdesk\Ticket\Tickets;
use App\Model\helpdesk\Ticket\Ticket_attachments;
use App\Model\helpdesk\Ticket\Ticket_Collaborator;
use App\Model\helpdesk\Ticket\Ticket_Thread; use App\Model\helpdesk\Ticket\Ticket_Thread;
use App\Model\helpdesk\Settings\Company; // models
use App\Model\helpdesk\Settings\System; use App\Model\helpdesk\Ticket\Tickets;
use App\Model\helpdesk\Settings\Alert;
use App\Model\helpdesk\Ticket\Ticket_Status;
use App\Model\helpdesk\Email\Emails;
use App\Model\helpdesk\Agent\Department;
use App\User; use App\User;
// classes
use Auth; use Auth;
use Hash; // classes
use Input;
use Mail;
use PDF;
use Exception; use Exception;
use Illuminate\Http\Request;
use Input;
/** /**
* TicketController2 * TicketController2.
* *
* @package Controllers
* @subpackage Controller
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class ClientTicketController extends Controller { class ClientTicketController extends Controller
{
/** /**
* Create a new controller instance. * Create a new controller instance.
*
* @return type response * @return type response
*/ */
public function __construct() { public function __construct()
{
SettingsController::smtp(); SettingsController::smtp();
// $this->middleware('auth'); // $this->middleware('auth');
// $this->middleware('role.user'); // $this->middleware('role.user');
} }
/** /**
* Get Checked ticket * Get Checked ticket.
*
* @param type Tickets $ticket * @param type Tickets $ticket
* @param type User $user * @param type User $user
*
* @return type response * @return type response
*/ */
public function getCheckTicket(Tickets $ticket, User $user) { public function getCheckTicket(Tickets $ticket, User $user)
{
return view('themes.default1.client.helpdesk.guest-user.newticket', compact('ticket')); return view('themes.default1.client.helpdesk.guest-user.newticket', compact('ticket'));
} }
/** /**
* reply * reply.
* @param type $value *
* @param type $value
*
* @return type view * @return type view
*/ */
public function reply($id, Request $request) { public function reply($id, Request $request)
{
$comment = $request->input('comment'); $comment = $request->input('comment');
if ($comment != null) { if ($comment != null) {
$tickets = Tickets::where('id', '=', $id)->first(); $tickets = Tickets::where('id', '=', $id)->first();
@@ -74,14 +64,15 @@ class ClientTicketController extends Controller {
$tickets->closed = 0; $tickets->closed = 0;
$tickets->reopened_at = date('Y-m-d H:i:s'); $tickets->reopened_at = date('Y-m-d H:i:s');
$tickets->reopened = 1; $tickets->reopened = 1;
$threads = new Ticket_Thread; $threads = new Ticket_Thread();
$threads->user_id = Auth::user()->id; $threads->user_id = Auth::user()->id;
$threads->ticket_id = $tickets->id; $threads->ticket_id = $tickets->id;
$threads->poster = "client"; $threads->poster = 'client';
$threads->body = $comment; $threads->body = $comment;
try { try {
$threads->save(); $threads->save();
$tickets->save(); $tickets->save();
return \Redirect::back()->with('success1', 'Successfully replied'); return \Redirect::back()->with('success1', 'Successfully replied');
} catch (Exception $e) { } catch (Exception $e) {
return \Redirect::back()->with('fails1', $e->errorInfo[2]); return \Redirect::back()->with('fails1', $e->errorInfo[2]);
@@ -90,5 +81,4 @@ class ClientTicketController extends Controller {
return \Redirect::back()->with('fails1', 'Please fill some data!'); return \Redirect::back()->with('fails1', 'Please fill some data!');
} }
} }
} }

View File

@@ -7,45 +7,47 @@ use App\Http\Controllers\Controller;
// models // models
use App\Model\helpdesk\Email\Emails; use App\Model\helpdesk\Email\Emails;
// classes // classes
use Exception;
/** /**
* EmailController * EmailController.
* *
* @package Controllers
* @subpackage Controller
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class OuthouseController extends Controller { class EmailController extends Controller
{
/** /**
* post port * post port.
* *
* @return string * @return string
*/ */
public static function port() { public static function port()
{
$port = Emails::where('id', '=', '1')->first(); $port = Emails::where('id', '=', '1')->first();
$portvalue = $port->option_value; $portvalue = $port->option_value;
return $portvalue; return $portvalue;
} }
/** /**
* post host * post host.
* *
* @return string * @return string
*/ */
public static function host() { public static function host()
{
$host = Option::where('option_name', '=', 'host')->first(); $host = Option::where('option_name', '=', 'host')->first();
$hostvalue = $host->option_value; $hostvalue = $host->option_value;
return $hostvalue; return $hostvalue;
} }
/** /**
* post username * post username.
* *
* @return string * @return string
*/ */
public static function username() { public static function username()
{
$username = Option::where('option_name', '=', 'username')->first(); $username = Option::where('option_name', '=', 'username')->first();
$uservalue = $username->option_value; $uservalue = $username->option_value;
@@ -53,11 +55,12 @@ class OuthouseController extends Controller {
} }
/** /**
* post passowrd * post passowrd.
* *
* @return string * @return string
*/ */
public static function password() { public static function password()
{
$password = Option::where('option_name', '=', 'password')->first(); $password = Option::where('option_name', '=', 'password')->first();
$passvalue = $password->option_value; $passvalue = $password->option_value;
@@ -65,15 +68,15 @@ class OuthouseController extends Controller {
} }
/** /**
* post encryption * post encryption.
* *
* @return string * @return string
*/ */
public static function encryption() { public static function encryption()
{
$encryption = Option::where('option_name', '=', 'encryption')->first(); $encryption = Option::where('option_name', '=', 'encryption')->first();
$encryptvalue = $encryption->option_value; $encryptvalue = $encryption->option_value;
return $encryptvalue; return $encryptvalue;
} }
} }

View File

@@ -3,51 +3,44 @@
namespace App\Http\Controllers\Client\helpdesk; namespace App\Http\Controllers\Client\helpdesk;
// controllers // controllers
use App\Http\Controllers\Controller;
use App\Http\Controllers\Agent\helpdesk\TicketController; use App\Http\Controllers\Agent\helpdesk\TicketController;
use App\Http\Controllers\Common\SettingsController; use App\Http\Controllers\Common\SettingsController;
use App\Http\Controllers\Controller;
// requests // requests
use Illuminate\Http\Request;
use App\Http\Requests\helpdesk\ClientRequest; use App\Http\Requests\helpdesk\ClientRequest;
use App\Model\helpdesk\Agent\Department;
// models // models
use App\Model\helpdesk\Form\Forms; use App\Model\helpdesk\Form\Fields;
use App\Model\helpdesk\Manage\Help_topic; use App\Model\helpdesk\Manage\Help_topic;
use App\Model\helpdesk\Settings\Company;
use App\Model\helpdesk\Ticket\Tickets;
use App\Model\helpdesk\Ticket\Ticket_Thread;
use App\Model\helpdesk\Settings\System; use App\Model\helpdesk\Settings\System;
use App\Model\helpdesk\Settings\Ticket; use App\Model\helpdesk\Settings\Ticket;
use App\Model\helpdesk\Agent\Department;
use App\Model\helpdesk\Ticket\Ticket_source; use App\Model\helpdesk\Ticket\Ticket_source;
use App\Model\helpdesk\Ticket\Ticket_Thread;
use App\Model\helpdesk\Ticket\Tickets;
use App\User; use App\User;
use App\Model\helpdesk\Form\Fields; use Exception;
use App\Model\helpdesk\Form\Form_value;
// classes // classes
use Form; use Form;
use Illuminate\Http\Request;
use Input; use Input;
use Mail; use Mail;
use Hash;
use Redirect; use Redirect;
use Config;
use DateTime;
use DateTimeZone;
use Exception;
/** /**
* FormController * FormController.
* *
* @package Controllers
* @subpackage Controller
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class FormController extends Controller { class FormController extends Controller
{
/** /**
* Create a new controller instance. * Create a new controller instance.
* Constructor to check * Constructor to check.
*
* @return void * @return void
*/ */
public function __construct(TicketController $TicketController) { public function __construct(TicketController $TicketController)
{
// mail smtp settings // mail smtp settings
SettingsController::smtp(); SettingsController::smtp();
// creating a TicketController instance // creating a TicketController instance
@@ -55,16 +48,20 @@ class FormController extends Controller {
} }
/** /**
* getform * getform.
* @param type Help_topic $topic *
* @param type Help_topic $topic
*
* @return type * @return type
*/ */
public function getForm(Help_topic $topic) { public function getForm(Help_topic $topic)
{
if (\Config::get('database.install') == '%0%') { if (\Config::get('database.install') == '%0%') {
return \Redirect::route('license'); return \Redirect::route('license');
} }
if (System::first()->status == 1) { if (System::first()->status == 1) {
$topics = $topic->get(); $topics = $topic->get();
return view('themes.default1.client.helpdesk.form', compact('topics')); return view('themes.default1.client.helpdesk.form', compact('topics'));
} else { } else {
return \Redirect::route('home'); return \Redirect::route('home');
@@ -72,64 +69,68 @@ class FormController extends Controller {
} }
/** /**
* This Function to post the form for the ticket * This Function to post the form for the ticket.
* @param type Form_name $name *
* @param type Form_name $name
* @param type Form_details $details * @param type Form_details $details
*
* @return type string * @return type string
*/ */
public function postForm($id, Help_topic $topic) { public function postForm($id, Help_topic $topic)
{
// dd($id); // dd($id);
if ($id != 0) { if ($id != 0) {
$helptopic = $topic->where('id', '=', $id)->first(); $helptopic = $topic->where('id', '=', $id)->first();
$custom_form = $helptopic->custom_form; $custom_form = $helptopic->custom_form;
$values = Fields::where('forms_id', '=', $custom_form)->get(); $values = Fields::where('forms_id', '=', $custom_form)->get();
if (!$values) { if (!$values) {
}
} if ($values) { if ($values) {
foreach ($values as $value) { foreach ($values as $value) {
if ($value->type == "select") { if ($value->type == 'select') {
$data = $value->value; $data = $value->value;
$value = explode(',', $data); $value = explode(',', $data);
echo '<select class="form-control">'; echo '<select class="form-control">';
foreach ($value as $option) { foreach ($value as $option) {
echo '<option>' . $option . '</option>'; echo '<option>'.$option.'</option>';
} }
echo '</select></br>'; echo '</select></br>';
} elseif ($value->type == "radio") { } elseif ($value->type == 'radio') {
$type2 = $value->value; $type2 = $value->value;
$val = explode(',', $type2); $val = explode(',', $type2);
echo '<label class="radio-inline">' . $value->label . '</label>&nbsp&nbsp&nbsp<input type="' . $value->type . '" name="' . $value->name . '">&nbsp;&nbsp;' . $val[0] . ' echo '<label class="radio-inline">'.$value->label.'</label>&nbsp&nbsp&nbsp<input type="'.$value->type.'" name="'.$value->name.'">&nbsp;&nbsp;'.$val[0].'
&nbsp&nbsp&nbsp<input type="' . $value->type . '" name="' . $value->name . '">&nbsp;&nbsp;' . $val[1] . '</br>'; &nbsp&nbsp&nbsp<input type="'.$value->type.'" name="'.$value->name.'">&nbsp;&nbsp;'.$val[1].'</br>';
} elseif ($value->type == "textarea") { } elseif ($value->type == 'textarea') {
$type3 = $value->value; $type3 = $value->value;
$v = explode(',', $type3); $v = explode(',', $type3);
//dd($v); //dd($v);
if (array_key_exists(1, $v)) { if (array_key_exists(1, $v)) {
echo '<label>' . $value->label . '</label></br><textarea class=form-control rows="' . $v[0] . '" cols="' . $v[1] . '"></textarea></br>'; echo '<label>'.$value->label.'</label></br><textarea class=form-control rows="'.$v[0].'" cols="'.$v[1].'"></textarea></br>';
} else { } else {
echo '<label>' . $value->label . '</label></br><textarea class=form-control rows="10" cols="60"></textarea></br>'; echo '<label>'.$value->label.'</label></br><textarea class=form-control rows="10" cols="60"></textarea></br>';
} }
} elseif ($value->type == "checkbox") { } elseif ($value->type == 'checkbox') {
$type4 = $value->value; $type4 = $value->value;
$check = explode(',', $type4); $check = explode(',', $type4);
echo '<label class="radio-inline">' . $value->label . '&nbsp&nbsp&nbsp<input type="' . $value->type . '" name="' . $value->name . '">&nbsp&nbsp' . $check[0] . '</label><label class="radio-inline"><input type="' . $value->type . '" name="' . $value->name . '">&nbsp&nbsp' . $check[1] . '</label></br>'; echo '<label class="radio-inline">'.$value->label.'&nbsp&nbsp&nbsp<input type="'.$value->type.'" name="'.$value->name.'">&nbsp&nbsp'.$check[0].'</label><label class="radio-inline"><input type="'.$value->type.'" name="'.$value->name.'">&nbsp&nbsp'.$check[1].'</label></br>';
} else { } else {
echo '<label>' . $value->label . '</label><input type="' . $value->type . '" class="form-control" name="' . $value->name . '" /></br>'; echo '<label>'.$value->label.'</label><input type="'.$value->type.'" class="form-control" name="'.$value->name.'" /></br>';
} }
} }
} }
} else { } else {
return null; return;
} }
} }
/** /**
* Posted form * Posted form.
*
* @param type Request $request * @param type Request $request
* @param type User $user * @param type User $user
*/ */
public function postedForm(User $user, ClientRequest $request, Ticket $ticket_settings, Ticket_source $ticket_source) { public function postedForm(User $user, ClientRequest $request, Ticket $ticket_settings, Ticket_source $ticket_source)
{
$form_extras = $request->except('Name', 'Phone', 'Email', 'Subject', 'Details', 'helptopic', '_wysihtml5_mode', '_token'); $form_extras = $request->except('Name', 'Phone', 'Email', 'Subject', 'Details', 'helptopic', '_wysihtml5_mode', '_token');
$name = $request->input('Name'); $name = $request->input('Name');
@@ -157,26 +158,30 @@ class FormController extends Controller {
} }
/** /**
* reply * reply.
* @param type $value *
* @param type $value
*
* @return type view * @return type view
*/ */
public function post_ticket_reply($id, Request $request) { public function post_ticket_reply($id, Request $request)
{
$comment = $request->input('comment'); $comment = $request->input('comment');
if ($comment != null) { if ($comment != null) {
$tickets = Tickets::where('id', '=', $id)->first(); $tickets = Tickets::where('id', '=', $id)->first();
$threads = new Ticket_Thread; $threads = new Ticket_Thread();
$tickets->closed_at = null; $tickets->closed_at = null;
$tickets->closed = 0; $tickets->closed = 0;
$tickets->reopened_at = date('Y-m-d H:i:s'); $tickets->reopened_at = date('Y-m-d H:i:s');
$tickets->reopened = 1; $tickets->reopened = 1;
$threads->user_id = $tickets->user_id; $threads->user_id = $tickets->user_id;
$threads->ticket_id = $tickets->id; $threads->ticket_id = $tickets->id;
$threads->poster = "client"; $threads->poster = 'client';
$threads->body = $comment; $threads->body = $comment;
try { try {
$threads->save(); $threads->save();
$tickets->save(); $tickets->save();
return \Redirect::back()->with('success1', 'Successfully replied'); return \Redirect::back()->with('success1', 'Successfully replied');
} catch (Exception $e) { } catch (Exception $e) {
return \Redirect::back()->with('fails1', $e->errorInfo[2]); return \Redirect::back()->with('fails1', $e->errorInfo[2]);
@@ -185,5 +190,4 @@ class FormController extends Controller {
return \Redirect::back()->with('fails1', 'Please fill some data!'); return \Redirect::back()->with('fails1', 'Please fill some data!');
} }
} }
} }

View File

@@ -3,9 +3,9 @@
namespace App\Http\Controllers\Client\helpdesk; namespace App\Http\Controllers\Client\helpdesk;
// controllers // controllers
use App\Http\Controllers\Controller;
use App\Http\Controllers\Common\SettingsController;
use App\Http\Controllers\Common\PhpMailController; use App\Http\Controllers\Common\PhpMailController;
use App\Http\Controllers\Common\SettingsController;
use App\Http\Controllers\Controller;
// requests // requests
use App\Http\Requests\helpdesk\CheckTicket; use App\Http\Requests\helpdesk\CheckTicket;
use App\Http\Requests\helpdesk\ProfilePassword; use App\Http\Requests\helpdesk\ProfilePassword;
@@ -13,31 +13,31 @@ use App\Http\Requests\helpdesk\ProfileRequest;
use App\Http\Requests\helpdesk\TicketRequest; use App\Http\Requests\helpdesk\TicketRequest;
// models // models
use App\Model\helpdesk\Manage\Help_topic; use App\Model\helpdesk\Manage\Help_topic;
use App\Model\helpdesk\Ticket\Tickets;
use App\Model\helpdesk\Ticket\Ticket_Thread;
use App\Model\helpdesk\Settings\Company; use App\Model\helpdesk\Settings\Company;
use App\Model\helpdesk\Settings\System; use App\Model\helpdesk\Settings\System;
use App\Model\helpdesk\Ticket\Ticket_Thread;
use App\Model\helpdesk\Ticket\Tickets;
use App\User; use App\User;
// classes // classes
use Auth; use Auth;
use Exception;
use Hash; use Hash;
use Input; use Input;
use Exception;
/** /**
* GuestController * GuestController.
* *
* @package Controllers
* @subpackage Controller
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class GuestController extends Controller { class GuestController extends Controller
{
/** /**
* Create a new controller instance. * Create a new controller instance.
*
* @return type void * @return type void
*/ */
public function __construct(PhpMailController $PhpMailController) { public function __construct(PhpMailController $PhpMailController)
{
$this->PhpMailController = $PhpMailController; $this->PhpMailController = $PhpMailController;
SettingsController::smtp(); SettingsController::smtp();
// checking authentication // checking authentication
@@ -45,21 +45,27 @@ class GuestController extends Controller {
} }
/** /**
* Get profile * Get profile.
*
* @return type Response * @return type Response
*/ */
public function getProfile() { public function getProfile()
{
$user = Auth::user(); $user = Auth::user();
return view('themes.default1.client.helpdesk.profile', compact('user')); return view('themes.default1.client.helpdesk.profile', compact('user'));
} }
/** /**
* Save profile data * Save profile data.
* @param type $id *
* @param type $id
* @param type ProfileRequest $request * @param type ProfileRequest $request
*
* @return type Response * @return type Response
*/ */
public function postProfile(ProfileRequest $request) { public function postProfile(ProfileRequest $request)
{
$user = User::where('id', '=', Auth::user()->id)->first(); $user = User::where('id', '=', Auth::user()->id)->first();
$user->gender = $request->get('gender'); $user->gender = $request->get('gender');
$user->save(); $user->save();
@@ -78,12 +84,13 @@ class GuestController extends Controller {
//$extension = Input::file('profile_pic')->getClientOriginalExtension(); //$extension = Input::file('profile_pic')->getClientOriginalExtension();
$name = Input::file('profile_pic')->getClientOriginalName(); $name = Input::file('profile_pic')->getClientOriginalName();
$destinationPath = 'lb-faveo/media/profilepic'; $destinationPath = 'lb-faveo/media/profilepic';
$fileName = rand(0000, 9999) . '.' . $name; $fileName = rand(0000, 9999).'.'.$name;
//echo $fileName; //echo $fileName;
Input::file('profile_pic')->move($destinationPath, $fileName); Input::file('profile_pic')->move($destinationPath, $fileName);
$user->profile_pic = $fileName; $user->profile_pic = $fileName;
} else { } else {
$user->fill($request->except('profile_pic', 'gender'))->save(); $user->fill($request->except('profile_pic', 'gender'))->save();
return redirect()->back()->with('success1', 'Profile Updated sucessfully'); return redirect()->back()->with('success1', 'Profile Updated sucessfully');
} }
if ($user->fill($request->except('profile_pic'))->save()) { if ($user->fill($request->except('profile_pic'))->save()) {
@@ -92,26 +99,34 @@ class GuestController extends Controller {
} }
/** /**
* Get Ticket page * Get Ticket page.
*
* @param type Help_topic $topic * @param type Help_topic $topic
*
* @return type Response * @return type Response
*/ */
public function getTicket(Help_topic $topic) { public function getTicket(Help_topic $topic)
{
$topics = $topic->get(); $topics = $topic->get();
return view('themes.default1.client.helpdesk.tickets.form', compact('topics')); return view('themes.default1.client.helpdesk.tickets.form', compact('topics'));
} }
/** /**
* getform * getform.
* @param type Help_topic $topic *
* @param type Help_topic $topic
*
* @return type * @return type
*/ */
public function getForm(Help_topic $topic) { public function getForm(Help_topic $topic)
{
if (\Config::get('database.install') == '%0%') { if (\Config::get('database.install') == '%0%') {
return \Redirect::route('license'); return \Redirect::route('license');
} }
if (System::first()->status == 1) { if (System::first()->status == 1) {
$topics = $topic->get(); $topics = $topic->get();
return view('themes.default1.client.helpdesk.form', compact('topics')); return view('themes.default1.client.helpdesk.form', compact('topics'));
} else { } else {
return \Redirect::route('home'); return \Redirect::route('home');
@@ -119,24 +134,30 @@ class GuestController extends Controller {
} }
/** /**
* Get my ticket * Get my ticket.
* @param type Tickets $tickets *
* @param type Tickets $tickets
* @param type Ticket_Thread $thread * @param type Ticket_Thread $thread
* @param type User $user * @param type User $user
*
* @return type Response * @return type Response
*/ */
public function getMyticket() { public function getMyticket()
{
return view('themes.default1.client.helpdesk.mytickets'); return view('themes.default1.client.helpdesk.mytickets');
} }
/** /**
* Get ticket-thread * Get ticket-thread.
*
* @param type Ticket_Thread $thread * @param type Ticket_Thread $thread
* @param type Tickets $tickets * @param type Tickets $tickets
* @param type User $user * @param type User $user
*
* @return type Response * @return type Response
*/ */
public function thread(Ticket_Thread $thread, Tickets $tickets, User $user) { public function thread(Ticket_Thread $thread, Tickets $tickets, User $user)
{
$user_id = Auth::user()->id; $user_id = Auth::user()->id;
//dd($user_id); //dd($user_id);
/* get the ticket's id == ticket_id of thread */ /* get the ticket's id == ticket_id of thread */
@@ -149,26 +170,31 @@ class GuestController extends Controller {
} }
/** /**
* ticket Edit * ticket Edit.
*
* @return * @return
*/ */
public function ticketEdit() { public function ticketEdit()
{
} }
/** /**
* Post porfile password * Post porfile password.
* @param type $id *
* @param type $id
* @param type ProfilePassword $request * @param type ProfilePassword $request
*
* @return type Response * @return type Response
*/ */
public function postProfilePassword(ProfilePassword $request) { public function postProfilePassword(ProfilePassword $request)
{
$user = Auth::user(); $user = Auth::user();
//echo $user->password; //echo $user->password;
if (Hash::check($request->input('old_password'), $user->getAuthPassword())) { if (Hash::check($request->input('old_password'), $user->getAuthPassword())) {
$user->password = Hash::make($request->input('new_password')); $user->password = Hash::make($request->input('new_password'));
try { try {
$user->save(); $user->save();
return redirect()->back()->with('success2', 'Password Updated sucessfully'); return redirect()->back()->with('success2', 'Password Updated sucessfully');
} catch (Exception $e) { } catch (Exception $e) {
return redirect()->back()->with('fails2', $e->errorInfo[2]); return redirect()->back()->with('fails2', $e->errorInfo[2]);
@@ -179,12 +205,15 @@ class GuestController extends Controller {
} }
/** /**
* Ticekt reply * Ticekt reply.
*
* @param type Ticket_Thread $thread * @param type Ticket_Thread $thread
* @param type TicketRequest $request * @param type TicketRequest $request
*
* @return type Response * @return type Response
*/ */
public function reply(Ticket_Thread $thread, TicketRequest $request) { public function reply(Ticket_Thread $thread, TicketRequest $request)
{
$thread->ticket_id = $request->input('ticket_ID'); $thread->ticket_id = $request->input('ticket_ID');
$thread->title = $request->input('To'); $thread->title = $request->input('To');
$thread->user_id = Auth::user()->id; $thread->user_id = Auth::user()->id;
@@ -194,29 +223,35 @@ class GuestController extends Controller {
$ticket_id = $request->input('ticket_ID'); $ticket_id = $request->input('ticket_ID');
$tickets = Tickets::where('id', '=', $ticket_id)->first(); $tickets = Tickets::where('id', '=', $ticket_id)->first();
$thread = Ticket_Thread::where('ticket_id', '=', $ticket_id)->first(); $thread = Ticket_Thread::where('ticket_id', '=', $ticket_id)->first();
return Redirect("thread/" . $ticket_id);
return Redirect('thread/'.$ticket_id);
} }
/** /**
* Get Checked ticket * Get Checked ticket.
*
* @param type Tickets $ticket * @param type Tickets $ticket
* @param type User $user * @param type User $user
*
* @return type response * @return type response
*/ */
public function getCheckTicket(Tickets $ticket, User $user) { public function getCheckTicket(Tickets $ticket, User $user)
{
return view('themes.default1.client.helpdesk.guest-user.newticket', compact('ticket')); return view('themes.default1.client.helpdesk.guest-user.newticket', compact('ticket'));
} }
/** /**
* Post Check ticket * Post Check ticket.
* @param type CheckTicket $request *
* @param type User $user * @param type CheckTicket $request
* @param type Tickets $ticket * @param type User $user
* @param type Tickets $ticket
* @param type Ticket_Thread $thread * @param type Ticket_Thread $thread
*
* @return type Response * @return type Response
*/ */
public function PostCheckTicket() { public function PostCheckTicket()
{
$Email = \Input::get('email'); $Email = \Input::get('email');
$Ticket_number = \Input::get('ticket_number'); $Ticket_number = \Input::get('ticket_number');
@@ -230,7 +265,7 @@ class GuestController extends Controller {
if ($user->role == 'user') { if ($user->role == 'user') {
$username = $user->user_name; $username = $user->user_name;
} else { } else {
$username = $user->first_name . " " . $user->last_name; $username = $user->first_name.' '.$user->last_name;
} }
if ($user->email != $Email) { if ($user->email != $Email) {
@@ -242,7 +277,7 @@ class GuestController extends Controller {
$company = $this->company(); $company = $this->company();
$this->PhpMailController->sendmail( $this->PhpMailController->sendmail(
$from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $username, 'email' => $user->email], $message = ['subject' => 'Ticket link Request [' . $Ticket_number . ']', 'scenario' => 'check-ticket'], $template_variables = ['user' => $username, 'ticket_link_with_number' => \URL::route('check_ticket', $code)] $from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $username, 'email' => $user->email], $message = ['subject' => 'Ticket link Request ['.$Ticket_number.']', 'scenario' => 'check-ticket'], $template_variables = ['user' => $username, 'ticket_link_with_number' => \URL::route('check_ticket', $code)]
); );
return \Redirect::back() return \Redirect::back()
@@ -252,36 +287,45 @@ class GuestController extends Controller {
} }
/** /**
* get ticket email * get ticket email.
* @param type $id *
* @param type $id
*
* @return type * @return type
*/ */
public function get_ticket_email($id) { public function get_ticket_email($id)
{
$id1 = \Crypt::decrypt($id); $id1 = \Crypt::decrypt($id);
return view('themes.default1.client.helpdesk.ckeckticket', compact('id')); return view('themes.default1.client.helpdesk.ckeckticket', compact('id'));
} }
/** /**
* get ticket status * get ticket status.
* @param type Tickets $ticket *
* @param type Tickets $ticket
*
* @return type * @return type
*/ */
public function getTicketStat(Tickets $ticket) { public function getTicketStat(Tickets $ticket)
{
return view('themes.default1.client.helpdesk.ckeckticket', compact('ticket')); return view('themes.default1.client.helpdesk.ckeckticket', compact('ticket'));
} }
/** /**
* get company * get company.
*
* @return type * @return type
*/ */
public function company() { public function company()
{
$company = Company::Where('id', '=', '1')->first(); $company = Company::Where('id', '=', '1')->first();
if ($company->company_name == null) { if ($company->company_name == null) {
$company = "Support Center"; $company = 'Support Center';
} else { } else {
$company = $company->company_name; $company = $company->company_name;
} }
return $company; return $company;
} }
} }

View File

@@ -9,23 +9,21 @@ use App\Model\helpdesk\Settings\System;
// classes // classes
use Config; use Config;
use Redirect; use Redirect;
use Exception;
/** /**
* OuthouseController * OuthouseController.
* *
* @package Controllers
* @subpackage Controller
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class WelcomepageController extends Controller { class WelcomepageController extends Controller
{
/** /**
* Display a listing of the resource. * Display a listing of the resource.
* *
* @return Response * @return Response
*/ */
public function get(System $note) { public function get(System $note)
{
if (Config::get('database.install') == '%0%') { if (Config::get('database.install') == '%0%') {
return Redirect::route('licence'); return Redirect::route('licence');
} }
@@ -33,14 +31,16 @@ class WelcomepageController extends Controller {
foreach ($notes as $note) { foreach ($notes as $note) {
$content = $note->content; $content = $note->content;
} }
return view('themes.default1.client.guest-user.guest', compact('heading', 'content')); return view('themes.default1.client.guest-user.guest', compact('heading', 'content'));
} }
public function index() { public function index()
{
if (Config::get('database.install') == '%0%') { if (Config::get('database.install') == '%0%') {
return Redirect::route('licence'); return Redirect::route('licence');
} }
return view('themes.default1.client.helpdesk.guest-user.index'); return view('themes.default1.client.helpdesk.guest-user.index');
} }
} }

View File

@@ -5,8 +5,8 @@ namespace App\Http\Controllers\Client\kb;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Http\Requests\kb\CommentRequest; use App\Http\Requests\kb\CommentRequest;
use App\Http\Requests\kb\ContactRequest; use App\Http\Requests\kb\ContactRequest;
use App\Http\Requests\kb\SearchRequest;
use App\Http\Requests\kb\ProfilePassword; use App\Http\Requests\kb\ProfilePassword;
use App\Http\Requests\kb\SearchRequest;
use App\Model\kb\Article; use App\Model\kb\Article;
use App\Model\kb\Category; use App\Model\kb\Category;
use App\Model\kb\Comment; use App\Model\kb\Comment;
@@ -15,18 +15,18 @@ use App\Model\kb\Faq;
use App\Model\kb\Page; use App\Model\kb\Page;
use App\Model\kb\Relationship; use App\Model\kb\Relationship;
use App\Model\kb\Settings; use App\Model\kb\Settings;
use Config; use Auth;
// use Creativeorange\Gravatar\Gravatar; // use Creativeorange\Gravatar\Gravatar;
use Config;
use Hash;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Mail; use Mail;
use Auth;
use Redirect; use Redirect;
use Hash;
use Exception;
class UserController extends Controller { class UserController extends Controller
{
public function __construct() { public function __construct()
{
//$this->middleware('auth'); //$this->middleware('auth');
//SettingsController::language(); //SettingsController::language();
// $this->port(); // $this->port();
@@ -38,11 +38,11 @@ class UserController extends Controller {
/** /**
* @param * @param
*
* @return response * @return response
* @package default
*/ */
public function getArticle(Article $article, Category $category, Settings $settings) { public function getArticle(Article $article, Category $category, Settings $settings)
{
$settings = $settings->first(); $settings = $settings->first();
$pagination = $settings->pagination; $pagination = $settings->pagination;
// $article = $article->where('status', '1'); // $article = $article->where('status', '1');
@@ -56,14 +56,16 @@ class UserController extends Controller {
} }
/** /**
* Get excerpt from string * Get excerpt from string.
* *
* @param String $str String to get an excerpt from * @param string $str String to get an excerpt from
* @param Integer $startPos Position int string to start excerpt from * @param int $startPos Position int string to start excerpt from
* @param Integer $maxLength Maximum length the excerpt may be * @param int $maxLength Maximum length the excerpt may be
* @return String excerpt *
* @return string excerpt
*/ */
static function getExcerpt($str, $startPos = 0, $maxLength = 50) { public static function getExcerpt($str, $startPos = 0, $maxLength = 50)
{
if (strlen($str) > $maxLength) { if (strlen($str) > $maxLength) {
$excerpt = substr($str, $startPos, $maxLength - 3); $excerpt = substr($str, $startPos, $maxLength - 3);
$lastSpace = strrpos($excerpt, ' '); $lastSpace = strrpos($excerpt, ' ');
@@ -76,7 +78,8 @@ class UserController extends Controller {
return $excerpt; return $excerpt;
} }
public function search(SearchRequest $request, Category $category, Article $article, Settings $settings) { public function search(SearchRequest $request, Category $category, Article $article, Settings $settings)
{
$settings = $settings->first(); $settings = $settings->first();
$pagination = $settings->pagination; $pagination = $settings->pagination;
$search = $request->input('s'); $search = $request->input('s');
@@ -84,14 +87,17 @@ class UserController extends Controller {
$result->setPath('search'); $result->setPath('search');
//dd($result); //dd($result);
$categorys = $category->get(); $categorys = $category->get();
return view('themes.default1.client.kb.article-list.search', compact('categorys', 'result')); return view('themes.default1.client.kb.article-list.search', compact('categorys', 'result'));
} }
/** /**
* to show the seleted article * to show the seleted article.
*
* @return response * @return response
*/ */
public function show($slug, Article $article, Category $category) { public function show($slug, Article $article, Category $category)
{
//ArticleController::timezone(); //ArticleController::timezone();
$tz = \App\Model\helpdesk\Settings\System::where('id', '1')->first()->time_zone; $tz = \App\Model\helpdesk\Settings\System::where('id', '1')->first()->time_zone;
$tz = \App\Model\helpdesk\Utility\Timezones::where('id', $tz)->first()->name; $tz = \App\Model\helpdesk\Utility\Timezones::where('id', $tz)->first()->name;
@@ -105,7 +111,8 @@ class UserController extends Controller {
} }
} }
public function getCategory($slug, Article $article, Category $category, Relationship $relation) { public function getCategory($slug, Article $article, Category $category, Relationship $relation)
{
/* get the article_id where category_id == current category */ /* get the article_id where category_id == current category */
$catid = $category->where('slug', $slug)->first(); $catid = $category->where('slug', $slug)->first();
$id = $catid->id; $id = $catid->id;
@@ -118,7 +125,8 @@ class UserController extends Controller {
return view('themes.default1.client.kb.article-list.category', compact('all', 'id', 'categorys', 'article_id')); return view('themes.default1.client.kb.article-list.category', compact('all', 'id', 'categorys', 'article_id'));
} }
public function home(Article $article, Category $category, Relationship $relation) { public function home(Article $article, Category $category, Relationship $relation)
{
if (Config::get('database.install') == '%0%') { if (Config::get('database.install') == '%0%') {
return redirect('step1'); return redirect('step1');
} else { } else {
@@ -130,27 +138,34 @@ class UserController extends Controller {
} }
} }
public function Faq(Faq $faq, Category $category) { public function Faq(Faq $faq, Category $category)
{
$faq = $faq->where('id', '1')->first(); $faq = $faq->where('id', '1')->first();
$categorys = $category->get(); $categorys = $category->get();
return view('themes.default1.client.kb.article-list.faq', compact('categorys', 'faq')); return view('themes.default1.client.kb.article-list.faq', compact('categorys', 'faq'));
} }
/** /**
* get the contact page for user * get the contact page for user.
*
* @return response * @return response
*/ */
public function contact(Category $category, Settings $settings) { public function contact(Category $category, Settings $settings)
{
$settings = $settings->whereId('1')->first(); $settings = $settings->whereId('1')->first();
$categorys = $category->get(); $categorys = $category->get();
return view('themes.default1.client.kb.article-list.contact', compact('settings', 'categorys')); return view('themes.default1.client.kb.article-list.contact', compact('settings', 'categorys'));
} }
/** /**
* send message to the mail adderess that define in the system * send message to the mail adderess that define in the system.
*
* @return response * @return response
*/ */
public function postContact(ContactRequest $request, Contact $contact) { public function postContact(ContactRequest $request, Contact $contact)
{
$this->port(); $this->port();
$this->host(); $this->host();
$this->encryption(); $this->encryption();
@@ -167,7 +182,7 @@ class UserController extends Controller {
$details = $request->input('message'); $details = $request->input('message');
//echo $message; //echo $message;
//echo $contact->email; //echo $contact->email;
$mail = Mail::send('themes.default1.client.kb.article-list.contact-details', array('name' => $name, 'email' => $email, 'subject' => $subject, 'details' => $details), function ($message) use ($contact) { $mail = Mail::send('themes.default1.client.kb.article-list.contact-details', ['name' => $name, 'email' => $email, 'subject' => $subject, 'details' => $details], function ($message) use ($contact) {
$message->to($contact->email, $contact->name)->subject('Contact'); $message->to($contact->email, $contact->name)->subject('Contact');
}); });
if ($mail) { if ($mail) {
@@ -177,19 +192,23 @@ class UserController extends Controller {
} }
} }
public function contactDetails() { public function contactDetails()
{
return view('themes.default1.client.kb.article-list.contact-details'); return view('themes.default1.client.kb.article-list.contact-details');
} }
/** /**
* To insert the values to the comment table * To insert the values to the comment table.
*
* @param type Article $article * @param type Article $article
* @param type Request $request * @param type Request $request
* @param type Comment $comment * @param type Comment $comment
* @param type Id $id * @param type Id $id
*
* @return type response * @return type response
*/ */
public function postComment($slug, Article $article, CommentRequest $request, Comment $comment) { public function postComment($slug, Article $article, CommentRequest $request, Comment $comment)
{
$article = $article->where('slug', $slug)->first(); $article = $article->where('slug', $slug)->first();
$id = $article->id; $id = $article->id;
$comment->article_id = $id; $comment->article_id = $id;
@@ -200,39 +219,46 @@ class UserController extends Controller {
} }
} }
public function getPage($name, Page $page) { public function getPage($name, Page $page)
{
$page = $page->where('slug', $name)->first(); $page = $page->where('slug', $name)->first();
//$this->timezone($page->created_at); //$this->timezone($page->created_at);
return view('themes.default1.client.kb.article-list.pages', compact('page')); return view('themes.default1.client.kb.article-list.pages', compact('page'));
} }
static function port() { public static function port()
{
$setting = Settings::whereId('1')->first(); $setting = Settings::whereId('1')->first();
Config::set('mail.port', $setting->port); Config::set('mail.port', $setting->port);
} }
static function host() { public static function host()
{
$setting = Settings::whereId('1')->first(); $setting = Settings::whereId('1')->first();
Config::set('mail.host', $setting->host); Config::set('mail.host', $setting->host);
} }
static function encryption() { public static function encryption()
{
$setting = Settings::whereId('1')->first(); $setting = Settings::whereId('1')->first();
Config::set(['mail.encryption' => $setting->encryption, 'mail.username' => $setting->email]); Config::set(['mail.encryption' => $setting->encryption, 'mail.username' => $setting->email]);
} }
static function email() { public static function email()
{
$setting = Settings::whereId('1')->first(); $setting = Settings::whereId('1')->first();
Config::set(['mail.from' => ['address' => $setting->email, 'name' => 'asd']]); Config::set(['mail.from' => ['address' => $setting->email, 'name' => 'asd']]);
//dd(Config::get('mail')); //dd(Config::get('mail'));
} }
static function password() { public static function password()
{
$setting = Settings::whereId('1')->first(); $setting = Settings::whereId('1')->first();
Config::set(['mail.password' => $setting->password, 'mail.sendmail' => $setting->email]); Config::set(['mail.password' => $setting->password, 'mail.sendmail' => $setting->email]);
} }
public function getCategoryList(Article $article, Category $category, Relationship $relation) { public function getCategoryList(Article $article, Category $category, Relationship $relation)
{
//$categorys = $category->get(); //$categorys = $category->get();
$categorys = $category->get(); $categorys = $category->get();
// $categorys->setPath('home'); // $categorys->setPath('home');
@@ -254,12 +280,15 @@ class UserController extends Controller {
// //return substr($date, 0, -6); // //return substr($date, 0, -6);
// } // }
public function clientProfile() { public function clientProfile()
{
$user = Auth::user(); $user = Auth::user();
return view('themes.default1.client.kb.article-list.profile', compact('user')); return view('themes.default1.client.kb.article-list.profile', compact('user'));
} }
public function postClientProfile($id, ProfileRequest $request) { public function postClientProfile($id, ProfileRequest $request)
{
$user = Auth::user(); $user = Auth::user();
$user->gender = $request->input('gender'); $user->gender = $request->input('gender');
$user->save(); $user->save();
@@ -278,12 +307,13 @@ class UserController extends Controller {
//$extension = Input::file('profile_pic')->getClientOriginalExtension(); //$extension = Input::file('profile_pic')->getClientOriginalExtension();
$name = Input::file('profile_pic')->getClientOriginalName(); $name = Input::file('profile_pic')->getClientOriginalName();
$destinationPath = 'lb-faveo/dist/img'; $destinationPath = 'lb-faveo/dist/img';
$fileName = rand(0000, 9999) . '.' . $name; $fileName = rand(0000, 9999).'.'.$name;
//echo $fileName; //echo $fileName;
Input::file('profile_pic')->move($destinationPath, $fileName); Input::file('profile_pic')->move($destinationPath, $fileName);
$user->profile_pic = $fileName; $user->profile_pic = $fileName;
} else { } else {
$user->fill($request->except('profile_pic', 'gender'))->save(); $user->fill($request->except('profile_pic', 'gender'))->save();
return redirect('guest')->with('success', 'Profile Updated sucessfully'); return redirect('guest')->with('success', 'Profile Updated sucessfully');
} }
if ($user->fill($request->except('profile_pic'))->save()) { if ($user->fill($request->except('profile_pic'))->save()) {
@@ -291,16 +321,17 @@ class UserController extends Controller {
} }
} }
public function postClientProfilePassword($id, ProfilePassword $request) { public function postClientProfilePassword($id, ProfilePassword $request)
{
$user = Auth::user(); $user = Auth::user();
//echo $user->password; //echo $user->password;
if (Hash::check($request->input('old_password'), $user->getAuthPassword())) { if (Hash::check($request->input('old_password'), $user->getAuthPassword())) {
$user->password = Hash::make($request->input('new_password')); $user->password = Hash::make($request->input('new_password'));
$user->save(); $user->save();
return redirect()->back()->with('success', 'Password Updated sucessfully'); return redirect()->back()->with('success', 'Password Updated sucessfully');
} else { } else {
return redirect()->back()->with('fails', 'Password was not Updated'); return redirect()->back()->with('fails', 'Password was not Updated');
} }
} }
} }

View File

@@ -2,21 +2,20 @@
namespace App\Http\Controllers\Common; namespace App\Http\Controllers\Common;
use App\Http\Requests;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use Phpmailer\PHPMailerautoload; use App\Model\helpdesk\Agent\Department;
use Illuminate\Http\Request;
use Auth;
use App\Model\helpdesk\Email\Emails; use App\Model\helpdesk\Email\Emails;
use App\Model\helpdesk\Settings\Company;
use App\Model\helpdesk\Settings\Email; use App\Model\helpdesk\Settings\Email;
use App\User; use App\User;
use App\Model\helpdesk\Settings\Company; use Auth;
use App\Model\helpdesk\Agent\Department;
class PhpMailController extends Controller { class PhpMailController extends Controller
{
public function fetch_smtp_details($id) { public function fetch_smtp_details($id)
{
$emails = Emails::where('id', '=', $id)->first(); $emails = Emails::where('id', '=', $id)->first();
return $emails; return $emails;
} }
@@ -25,7 +24,8 @@ class PhpMailController extends Controller {
* *
* @return Mail * @return Mail
*/ */
public function sendmail($from, $to, $message, $template_variables) { public function sendmail($from, $to, $message, $template_variables)
{
// dd($from); // dd($from);
$from_address = $this->fetch_smtp_details($from); $from_address = $this->fetch_smtp_details($from);
@@ -169,21 +169,21 @@ class PhpMailController extends Controller {
$system_from = $this->company(); $system_from = $this->company();
$mail = new \PHPMailer; $mail = new \PHPMailer();
$status = \DB::table('settings_email')->first(); $status = \DB::table('settings_email')->first();
$path2 = \Config::get('view.paths'); $path2 = \Config::get('view.paths');
$directory = $path2[0] . '\emails' . DIRECTORY_SEPARATOR . $status->template . DIRECTORY_SEPARATOR; $directory = $path2[0].'\emails'.DIRECTORY_SEPARATOR.$status->template.DIRECTORY_SEPARATOR;
$handle = fopen($directory . $template . '.blade.php', "r"); $handle = fopen($directory.$template.'.blade.php', 'r');
$contents = fread($handle, filesize($directory . $template . '.blade.php')); $contents = fread($handle, filesize($directory.$template.'.blade.php'));
fclose($handle); fclose($handle);
$variables = array('{!!$user!!}', '{!!$agent!!}', '{!!$ticket_number!!}', '{!!$content!!}', '{!!$from!!}', '{!!$ticket_agent_name!!}', '{!!$ticket_client_name!!}', '{!!$ticket_client_email!!}', '{!!$ticket_body!!}', '{!!$ticket_assigner!!}', '{!!$ticket_link_with_number!!}', '{!!$system_error!!}', '{!!$agent_sign!!}', '{!!$department_sign!!}', '{!!$password_reset_link!!}', '{!!$email_address!!}', '{!!$user_password!!}', '{!!$system_from!!}', '{!!$system_link!!}'); $variables = ['{!!$user!!}', '{!!$agent!!}', '{!!$ticket_number!!}', '{!!$content!!}', '{!!$from!!}', '{!!$ticket_agent_name!!}', '{!!$ticket_client_name!!}', '{!!$ticket_client_email!!}', '{!!$ticket_body!!}', '{!!$ticket_assigner!!}', '{!!$ticket_link_with_number!!}', '{!!$system_error!!}', '{!!$agent_sign!!}', '{!!$department_sign!!}', '{!!$password_reset_link!!}', '{!!$email_address!!}', '{!!$user_password!!}', '{!!$system_from!!}', '{!!$system_link!!}'];
$data = array($user, $agent, $ticket_number, $content, $from, $ticket_agent_name, $ticket_client_name, $ticket_client_email, $ticket_body, $ticket_assigner, $ticket_link_with_number, $system_error, $agent_sign, $department_sign, $password_reset_link, $email_address, $user_password, $system_from, $system_link); $data = [$user, $agent, $ticket_number, $content, $from, $ticket_agent_name, $ticket_client_name, $ticket_client_email, $ticket_body, $ticket_assigner, $ticket_link_with_number, $system_error, $agent_sign, $department_sign, $password_reset_link, $email_address, $user_password, $system_from, $system_link];
// dd($variables,$data,$contents); // dd($variables,$data,$contents);
// $messagebody = str_replace($variables, $data, $contents); // $messagebody = str_replace($variables, $data, $contents);
@@ -195,7 +195,6 @@ class PhpMailController extends Controller {
$contents = $messagebody; $contents = $messagebody;
} }
// dd($messagebody); // dd($messagebody);
//$mail->SMTPDebug = 3; // Enable verbose debug output //$mail->SMTPDebug = 3; // Enable verbose debug output
@@ -226,7 +225,7 @@ class PhpMailController extends Controller {
$mail->addBCC($bc); $mail->addBCC($bc);
if ($attachment != null) { if ($attachment != null) {
$size = sizeOf($message['attachments']); $size = count($message['attachments']);
$attach = $message['attachments']; $attach = $message['attachments'];
for ($i = 0; $i < $size; $i++) { for ($i = 0; $i < $size; $i++) {
$file_path = $attach[$i]->getRealPath(); $file_path = $attach[$i]->getRealPath();
@@ -237,8 +236,8 @@ class PhpMailController extends Controller {
$mail->Subject = $subject; $mail->Subject = $subject;
if ($template == 'ticket-reply-agent') { if ($template == 'ticket-reply-agent') {
$line = "---Reply above this line--- <br/><br/>"; $line = '---Reply above this line--- <br/><br/>';
$mail->Body = $line . $messagebody; $mail->Body = $line.$messagebody;
} else { } else {
$mail->Body = $messagebody; $mail->Body = $messagebody;
} }
@@ -247,23 +246,26 @@ class PhpMailController extends Controller {
if (!$mail->send()) { if (!$mail->send()) {
echo 'Message could not be sent.'; echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo; echo 'Mailer Error: '.$mail->ErrorInfo;
} else { } else {
echo 'Message has been sent'; echo 'Message has been sent';
} }
} }
/** /**
* Fetching comapny name to send mail * Fetching comapny name to send mail.
*
* @return type * @return type
*/ */
public function company() { public function company()
{
$company = Company::Where('id', '=', '1')->first(); $company = Company::Where('id', '=', '1')->first();
if ($company->company_name == null) { if ($company->company_name == null) {
$company = "Support Center"; $company = 'Support Center';
} else { } else {
$company = $company->company_name; $company = $company->company_name;
} }
return $company; return $company;
} }
@@ -311,12 +313,15 @@ class PhpMailController extends Controller {
// } // }
/** /**
* Function to choose from address * Function to choose from address.
* @param type Reg $reg *
* @param type Reg $reg
* @param type Department $dept_id * @param type Department $dept_id
*
* @return type integer * @return type integer
*/ */
public function mailfrom($reg, $dept_id) { public function mailfrom($reg, $dept_id)
{
$email = Email::where('id', '=', '1')->first(); $email = Email::where('id', '=', '1')->first();
if ($reg == 1) { if ($reg == 1) {
return $email->sys_email; return $email->sys_email;
@@ -329,5 +334,4 @@ class PhpMailController extends Controller {
} }
} }
} }
} }

View File

@@ -5,60 +5,65 @@ namespace App\Http\Controllers\Common;
// controllers // controllers
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
// requests // requests
use Illuminate\Http\Request;
use App\Http\Requests\helpdesk\SmtpRequest;
use App\Http\Requests; use App\Http\Requests;
// models use App\Http\Requests\helpdesk\SmtpRequest;
use App\Model\helpdesk\Theme\Widgets;
use App\Model\helpdesk\Email\Smtp; use App\Model\helpdesk\Email\Smtp;
use App\Model\helpdesk\Utility\Version_Check; // models
use App\Model\helpdesk\Settings\Plugin; use App\Model\helpdesk\Settings\Plugin;
// classes use App\Model\helpdesk\Theme\Widgets;
use App\Model\helpdesk\Utility\Version_Check;
use Config; use Config;
use Input; // classes
use Crypt; use Crypt;
use Illuminate\Support\Collection;
use Exception; use Exception;
use Illuminate\Http\Request;
use Illuminate\Support\Collection;
use Input;
/** /**
* *************************** * ***************************
* Settings Controllers * Settings Controllers
* *************************** * ***************************
* Controller to keep smtp details and fetch where ever needed * Controller to keep smtp details and fetch where ever needed.
* @package default
*/ */
class SettingsController extends Controller { class SettingsController extends Controller
{
/** /**
* Create a new controller instance. * Create a new controller instance.
*
* @return type void * @return type void
*/ */
public function __construct() { public function __construct()
// $this->smtp(); {
// $this->smtp();
$this->middleware('auth'); $this->middleware('auth');
$this->middleware('roles'); $this->middleware('roles');
SettingsController::driver(); self::driver();
SettingsController::host(); self::host();
SettingsController::port(); self::port();
SettingsController::from(); self::from();
SettingsController::encryption(); self::encryption();
SettingsController::username(); self::username();
SettingsController::password(); self::password();
} }
/** /**
* get the page to create the footer * get the page to create the footer.
*
* @return response * @return response
*/ */
public function widgets() { public function widgets()
{
return view('themes.default1.admin.helpdesk.theme.widgets'); return view('themes.default1.admin.helpdesk.theme.widgets');
} }
/** /**
* get the page to create the footer * get the page to create the footer.
*
* @return response * @return response
*/ */
public function list_widget() { public function list_widget()
{
return \Datatable::collection(Widgets::where('id', '<', '7')->get()) return \Datatable::collection(Widgets::where('id', '<', '7')->get())
->searchColumns('name') ->searchColumns('name')
->orderColumns('name', 'title', 'value') ->orderColumns('name', 'title', 'value')
@@ -72,33 +77,33 @@ class SettingsController extends Controller {
return $model->value; return $model->value;
}) })
->addColumn('Actions', function ($model) { ->addColumn('Actions', function ($model) {
return '<span data-toggle="modal" data-target="#edit_widget' . $model->id . '"><a class="btn btn-warning btn-xs">' . \Lang::get('lang.edit') . '</a></span> return '<span data-toggle="modal" data-target="#edit_widget'.$model->id.'"><a class="btn btn-warning btn-xs">'.\Lang::get('lang.edit').'</a></span>
<div class="modal fade" id="edit_widget' . $model->id . '"> <div class="modal fade" id="edit_widget'.$model->id.'">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<form action="' . url('edit-widget/' . $model->id) . '" method="POST"> <form action="'.url('edit-widget/'.$model->id).'" method="POST">
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">' . strtoupper($model->name) . ' </h4> <h4 class="modal-title">'.strtoupper($model->name).' </h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<div class="form-group" style="width:100%"> <div class="form-group" style="width:100%">
<label>' . \Lang::get("lang.title") . '</label><br/> <label>'.\Lang::get('lang.title').'</label><br/>
<input type="text" name="title" value="' . $model->title . '" class="form-control" style="width:100%"> <input type="text" name="title" value="'.$model->title.'" class="form-control" style="width:100%">
</div> </div>
<br/> <br/>
<div class="form-group" style="width:100%"> <div class="form-group" style="width:100%">
<label>' . \Lang::get("lang.content") . '</label><br/> <label>'.\Lang::get('lang.content').'</label><br/>
<textarea name="content" class="form-control" style="width:100%" id="Content' . $model->id . '">' . $model->value . '</textarea> <textarea name="content" class="form-control" style="width:100%" id="Content'.$model->id.'">'.$model->value.'</textarea>
</div> </div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">' . \Lang::get('lang.close') . '</button> <button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">'.\Lang::get('lang.close').'</button>
<input type="submit" class="btn btn-primary" value="' . \Lang::get('lang.update') . '"> <input type="submit" class="btn btn-primary" value="'.\Lang::get('lang.update').'">
</div> </div>
<script> <script>
$(function () { $(function () {
$("#Content' . $model->id . '").wysihtml5(); $("#Content'.$model->id.'").wysihtml5();
}); });
</script> </script>
</form> </form>
@@ -110,36 +115,44 @@ class SettingsController extends Controller {
} }
/** /**
* Post footer * Post footer.
* @param type Footer $footer *
* @param type Footer $footer
* @param type Request $request * @param type Request $request
*
* @return type response * @return type response
*/ */
public function edit_widget($id, Widgets $widgets, Request $request) { public function edit_widget($id, Widgets $widgets, Request $request)
{
$widget = $widgets->where('id', '=', $id)->first(); $widget = $widgets->where('id', '=', $id)->first();
$widget->title = $request->title; $widget->title = $request->title;
$widget->value = $request->content; $widget->value = $request->content;
try { try {
$widget->save(); $widget->save();
return redirect()->back()->with('success', $widget->name . ' Saved Successfully');
return redirect()->back()->with('success', $widget->name.' Saved Successfully');
} catch (Exception $e) { } catch (Exception $e) {
return redirect()->back()->with('fails', $e->errorInfo[2]); return redirect()->back()->with('fails', $e->errorInfo[2]);
} }
} }
/** /**
* get the page to create the footer * get the page to create the footer.
*
* @return response * @return response
*/ */
public function social_buttons() { public function social_buttons()
{
return view('themes.default1.admin.helpdesk.theme.social'); return view('themes.default1.admin.helpdesk.theme.social');
} }
/** /**
* get the page to create the footer * get the page to create the footer.
*
* @return response * @return response
*/ */
public function list_social_buttons() { public function list_social_buttons()
{
return \Datatable::collection(Widgets::where('id', '>', '6')->get()) return \Datatable::collection(Widgets::where('id', '>', '6')->get())
->searchColumns('name') ->searchColumns('name')
->orderColumns('name', 'value') ->orderColumns('name', 'value')
@@ -150,25 +163,25 @@ class SettingsController extends Controller {
return $model->value; return $model->value;
}) })
->addColumn('Actions', function ($model) { ->addColumn('Actions', function ($model) {
return '<span data-toggle="modal" data-target="#edit_widget' . $model->id . '"><a class="btn btn-warning btn-xs">' . \Lang::get('lang.edit') . '</a></span> return '<span data-toggle="modal" data-target="#edit_widget'.$model->id.'"><a class="btn btn-warning btn-xs">'.\Lang::get('lang.edit').'</a></span>
<div class="modal fade" id="edit_widget' . $model->id . '"> <div class="modal fade" id="edit_widget'.$model->id.'">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<form action="' . url('edit-widget/' . $model->id) . '" method="POST"> <form action="'.url('edit-widget/'.$model->id).'" method="POST">
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">' . strtoupper($model->name) . ' </h4> <h4 class="modal-title">'.strtoupper($model->name).' </h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<br/> <br/>
<div class="form-group" style="width:100%"> <div class="form-group" style="width:100%">
<label>' . \Lang::get("lang.link") . '</label><br/> <label>'.\Lang::get('lang.link').'</label><br/>
<input type="url" name="content" class="form-control" style="width:100%" value="' . $model->value . '"> <input type="url" name="content" class="form-control" style="width:100%" value="'.$model->value.'">
</div> </div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">' . \Lang::get('lang.close') . '</button> <button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">'.\Lang::get('lang.close').'</button>
<input type="submit" class="btn btn-primary" value="' . \Lang::get('lang.update') . '"> <input type="submit" class="btn btn-primary" value="'.\Lang::get('lang.update').'">
</div> </div>
</form> </form>
</div> </div>
@@ -179,88 +192,106 @@ class SettingsController extends Controller {
} }
/** /**
* Post footer * Post footer.
* @param type Footer $footer *
* @param type Footer $footer
* @param type Request $request * @param type Request $request
*
* @return type response * @return type response
*/ */
public function edit_social_buttons($id, Widgets $widgets, Request $request) { public function edit_social_buttons($id, Widgets $widgets, Request $request)
{
$widget = $widgets->where('id', '=', $id)->first(); $widget = $widgets->where('id', '=', $id)->first();
$widget->title = $request->title; $widget->title = $request->title;
$widget->value = $request->content; $widget->value = $request->content;
try { try {
$widget->save(); $widget->save();
return redirect()->back()->with('success', $widget->name . ' Saved Successfully');
return redirect()->back()->with('success', $widget->name.' Saved Successfully');
} catch (Exception $e) { } catch (Exception $e) {
return redirect()->back()->with('fails', $e->errorInfo[2]); return redirect()->back()->with('fails', $e->errorInfo[2]);
} }
} }
/** /**
* Driver * Driver.
*
* @return type void * @return type void
*/ */
static function driver() { public static function driver()
$set = new Smtp; {
$set = new Smtp();
$settings = Smtp::where('id', '=', '1')->first(); $settings = Smtp::where('id', '=', '1')->first();
Config::set('mail.host', $settings->driver); Config::set('mail.host', $settings->driver);
} }
/** /**
* SMTP host * SMTP host.
*
* @return type void * @return type void
*/ */
static function host() { public static function host()
$set = new Smtp; {
$set = new Smtp();
$settings = Smtp::where('id', '=', '1')->first(); $settings = Smtp::where('id', '=', '1')->first();
Config::set('mail.host', $settings->host); Config::set('mail.host', $settings->host);
} }
/** /**
* SMTP port * SMTP port.
*
* @return type void * @return type void
*/ */
static function port() { public static function port()
$set = new Smtp; {
$set = new Smtp();
$settings = Smtp::where('id', '=', '1')->first(); $settings = Smtp::where('id', '=', '1')->first();
Config::set('mail.port', intval($settings->port)); Config::set('mail.port', intval($settings->port));
} }
/** /**
* SMTP from * SMTP from.
*
* @return type void * @return type void
*/ */
static function from() { public static function from()
$set = new Smtp; {
$set = new Smtp();
$settings = Smtp::where('id', '=', '1')->first(); $settings = Smtp::where('id', '=', '1')->first();
Config::set('mail.from', ['address' => $settings->email, 'name' => $settings->company_name]); Config::set('mail.from', ['address' => $settings->email, 'name' => $settings->company_name]);
} }
/** /**
* SMTP encryption * SMTP encryption.
*
* @return type void * @return type void
*/ */
static function encryption() { public static function encryption()
$set = new Smtp; {
$set = new Smtp();
$settings = Smtp::where('id', '=', '1')->first(); $settings = Smtp::where('id', '=', '1')->first();
Config::set('mail.encryption', $settings->encryption); Config::set('mail.encryption', $settings->encryption);
} }
/** /**
* SMTP username * SMTP username.
*
* @return type void * @return type void
*/ */
static function username() { public static function username()
$set = new Smtp; {
$set = new Smtp();
$settings = Smtp::where('id', '=', '1')->first(); $settings = Smtp::where('id', '=', '1')->first();
Config::set('mail.username', $settings->email); Config::set('mail.username', $settings->email);
} }
/** /**
* SMTP password * SMTP password.
*
* @return type void * @return type void
*/ */
static function password() { public static function password()
{
$settings = Smtp::first(); $settings = Smtp::first();
if ($settings->password) { if ($settings->password) {
$pass = $settings->password; $pass = $settings->password;
@@ -270,19 +301,24 @@ class SettingsController extends Controller {
} }
/** /**
* get SMTP * get SMTP.
*
* @return type view * @return type view
*/ */
public function getsmtp() { public function getsmtp()
{
$settings = Smtp::where('id', '=', '1')->first(); $settings = Smtp::where('id', '=', '1')->first();
return view('themes.default1.admin.helpdesk.emails.smtp', compact('settings')); return view('themes.default1.admin.helpdesk.emails.smtp', compact('settings'));
} }
/** /**
* POST SMTP * POST SMTP.
*
* @return type view * @return type view
*/ */
public function postsmtp(SmtpRequest $request) { public function postsmtp(SmtpRequest $request)
{
$data = Smtp::where('id', '=', 1)->first(); $data = Smtp::where('id', '=', 1)->first();
$data->driver = $request->input('driver'); $data->driver = $request->input('driver');
$data->host = $request->input('host'); $data->host = $request->input('host');
@@ -293,6 +329,7 @@ class SettingsController extends Controller {
$data->password = Crypt::encrypt($request->input('password')); $data->password = Crypt::encrypt($request->input('password'));
try { try {
$data->save(); $data->save();
return \Redirect::route('getsmtp')->with('success', 'success'); return \Redirect::route('getsmtp')->with('success', 'success');
} catch (Exception $e) { } catch (Exception $e) {
return \Redirect::route('getsmtp')->with('fails', $e->errorInfo[2]); return \Redirect::route('getsmtp')->with('fails', $e->errorInfo[2]);
@@ -300,10 +337,12 @@ class SettingsController extends Controller {
} }
/** /**
* SMTP * SMTP.
*
* @return type void * @return type void
*/ */
static function smtp() { public static function smtp()
{
$settings = Smtp::where('id', '=', '1')->first(); $settings = Smtp::where('id', '=', '1')->first();
if ($settings->password) { if ($settings->password) {
$password = Crypt::decrypt($settings->password); $password = Crypt::decrypt($settings->password);
@@ -318,22 +357,29 @@ class SettingsController extends Controller {
} }
/** /**
* Settings * Settings.
* @param type Smtp $set *
* @param type Smtp $set
*
* @return type view\ * @return type view\
*/ */
public function settings(Smtp $set) { public function settings(Smtp $set)
{
$settings = $set->where('id', '1')->first(); $settings = $set->where('id', '1')->first();
return view('themes.default1.admin.settings', compact('settings')); return view('themes.default1.admin.settings', compact('settings'));
} }
/** /**
* Post settings * Post settings.
* @param type Settings $set *
* @param type Request $request * @param type Settings $set
* @param type Request $request
*
* @return type view * @return type view
*/ */
public function PostSettings(Settings $set, Request $request) { public function PostSettings(Settings $set, Request $request)
{
$settings = $set->where('id', '1')->first(); $settings = $set->where('id', '1')->first();
$pass = $request->input('password'); $pass = $request->input('password');
$password = Crypt::encrypt($pass); $password = Crypt::encrypt($pass);
@@ -346,13 +392,14 @@ class SettingsController extends Controller {
if (Input::file('logo')) { if (Input::file('logo')) {
$name = Input::file('logo')->getClientOriginalName(); $name = Input::file('logo')->getClientOriginalName();
$destinationPath = 'dist/logo'; $destinationPath = 'dist/logo';
$fileName = rand(0000, 9999) . '.' . $name; $fileName = rand(0000, 9999).'.'.$name;
Input::file('logo')->move($destinationPath, $fileName); Input::file('logo')->move($destinationPath, $fileName);
$settings->logo = $fileName; $settings->logo = $fileName;
$settings->save(); $settings->save();
} }
try { try {
$settings->fill($request->except('logo', 'password'))->save(); $settings->fill($request->except('logo', 'password'))->save();
return redirect()->back()->with('success', 'Settings updated Successfully'); return redirect()->back()->with('success', 'Settings updated Successfully');
} catch (Exception $e) { } catch (Exception $e) {
return redirect()->back()->with('fails', $e->errorInfo[2]); return redirect()->back()->with('fails', $e->errorInfo[2]);
@@ -360,25 +407,29 @@ class SettingsController extends Controller {
} }
/** /**
* version_check * version_check.
*
* @return type * @return type
*/ */
public function version_check() { public function version_check()
{
$response_url = \URL::route('post-version-check'); $response_url = \URL::route('post-version-check');
echo "<form action='http://www.faveohelpdesk.com/bill/version' method='post' name='redirect'>"; echo "<form action='http://www.faveohelpdesk.com/bill/version' method='post' name='redirect'>";
echo "<input type='hidden' name='_token' value='csrf_token()'/>"; echo "<input type='hidden' name='_token' value='csrf_token()'/>";
echo "<input type='hidden' name='title' value='helpdeskcommunityedition'/>"; echo "<input type='hidden' name='title' value='helpdeskcommunityedition'/>";
echo "<input type='hidden' name='id' value='19'/>"; echo "<input type='hidden' name='id' value='19'/>";
echo "<input type='hidden' name='response_url' value='" . $response_url . "' />"; echo "<input type='hidden' name='response_url' value='".$response_url."' />";
echo "</form>"; echo '</form>';
echo "<script language='javascript'>document.redirect.submit();</script>"; echo "<script language='javascript'>document.redirect.submit();</script>";
} }
/** /**
* post_version_check * post_version_check.
*
* @return type * @return type
*/ */
public function post_version_check(Request $request) { public function post_version_check(Request $request)
{
$current_version = \Config::get('app.version'); $current_version = \Config::get('app.version');
$new_version = $request->value; $new_version = $request->value;
if ($current_version == $new_version) { if ($current_version == $new_version) {
@@ -390,38 +441,41 @@ class SettingsController extends Controller {
$version->new_version = $new_version; $version->new_version = $new_version;
$version->save(); $version->save();
// echo "Version " . $new_version . " is Available"; // echo "Version " . $new_version . " is Available";
return redirect()->route('checkupdate')->with('info', ' Version ' . $new_version . ' is Available'); return redirect()->route('checkupdate')->with('info', ' Version '.$new_version.' is Available');
} else { } else {
// echo "Error Checking Version"; // echo "Error Checking Version";
return redirect()->route('checkupdate')->with('info', ' Error Checking Version'); return redirect()->route('checkupdate')->with('info', ' Error Checking Version');
} }
} }
public function getupdate() { public function getupdate()
{
return \View::make('themes.default1.admin.helpdesk.settings.checkupdate'); return \View::make('themes.default1.admin.helpdesk.settings.checkupdate');
} }
public function Plugins() { public function Plugins()
{
return view('themes.default1.admin.helpdesk.settings.plugins'); return view('themes.default1.admin.helpdesk.settings.plugins');
} }
public function GetPlugin() { public function GetPlugin()
{
$plugins = $this->fetchConfig(); $plugins = $this->fetchConfig();
return \Datatable::collection(new Collection($plugins)) return \Datatable::collection(new Collection($plugins))
->searchColumns('name') ->searchColumns('name')
->addColumn('name', function($model) { ->addColumn('name', function ($model) {
if (array_has($model, 'path')) { if (array_has($model, 'path')) {
if ($model['status'] == 0) { if ($model['status'] == 0) {
$activate = "<a href=" . url('plugin/status/' . $model['path']) . ">Activate</a>"; $activate = '<a href='.url('plugin/status/'.$model['path']).'>Activate</a>';
$settings = " "; $settings = ' ';
} else { } else {
$settings = "<a href=" . url($model['settings']) . ">Settings</a> | "; $settings = '<a href='.url($model['settings']).'>Settings</a> | ';
$activate = "<a href=" . url('plugin/status/' . $model['path']) . ">Deactivate</a>"; $activate = '<a href='.url('plugin/status/'.$model['path']).'>Deactivate</a>';
} }
$delete = "<a href= id=delete" . $model['path'] . " data-toggle=modal data-target=#del" . $model['path'] . "><span style='color:red'>Delete</span></a>" $delete = '<a href= id=delete'.$model['path'].' data-toggle=modal data-target=#del'.$model['path']."><span style='color:red'>Delete</span></a>"
. "<div class='modal fade' id=del" . $model['path'] . "> ."<div class='modal fade' id=del".$model['path'].">
<div class='modal-dialog'> <div class='modal-dialog'>
<div class=modal-content> <div class=modal-content>
<div class=modal-header> <div class=modal-header>
@@ -430,8 +484,8 @@ class SettingsController extends Controller {
<div class=modal-body> <div class=modal-body>
<p>Are you Sure ?</p> <p>Are you Sure ?</p>
<div class=modal-footer> <div class=modal-footer>
<button type=button class='btn btn-default pull-left' data-dismiss=modal id=dismis>" . \Lang::get('lang.close') . "</button> <button type=button class='btn btn-default pull-left' data-dismiss=modal id=dismis>".\Lang::get('lang.close').'</button>
<a href=" . url('plugin/delete/' . $model['path']) . "><button class='btn btn-danger'>Delete</button></a> <a href='.url('plugin/delete/'.$model['path'])."><button class='btn btn-danger'>Delete</button></a>
</div> </div>
@@ -439,116 +493,129 @@ class SettingsController extends Controller {
</div> </div>
</div> </div>
</div>"; </div>";
$action = "<br><br>" . $delete . " | " . $settings . $activate; $action = '<br><br>'.$delete.' | '.$settings.$activate;
} else { } else {
$action = ''; $action = '';
} }
return ucfirst($model['name']) . $action;
return ucfirst($model['name']).$action;
}) })
->addColumn('description', function($model) { ->addColumn('description', function ($model) {
return ucfirst($model['description']); return ucfirst($model['description']);
}) })
->addColumn('author', function($model) { ->addColumn('author', function ($model) {
return ucfirst($model['author']); return ucfirst($model['author']);
}) })
->addColumn('website', function($model) { ->addColumn('website', function ($model) {
return "<a href=" . $model['website'] . " target=_blank>" . $model['website'] . "</a>"; return '<a href='.$model['website'].' target=_blank>'.$model['website'].'</a>';
}) })
->addColumn('version', function($model) { ->addColumn('version', function ($model) {
return $model['version']; return $model['version'];
}) })
->make(); ->make();
} }
/** /**
* Reading the Filedirectory * Reading the Filedirectory.
*
* @return type * @return type
*/ */
public function ReadPlugins() { public function ReadPlugins()
$dir = app_path() . '/Plugins'; {
$plugins = array_diff(scandir($dir), array('.', '..')); $dir = app_path().'/Plugins';
$plugins = array_diff(scandir($dir), ['.', '..']);
return $plugins; return $plugins;
} }
/** /**
* After plugin post * After plugin post.
*
* @param Request $request * @param Request $request
*
* @return type * @return type
*/ */
public function PostPlugins(Request $request) { public function PostPlugins(Request $request)
{
$v = $this->validate($request, ['plugin' => 'required|mimes:application/zip,zip,Zip']); $v = $this->validate($request, ['plugin' => 'required|mimes:application/zip,zip,Zip']);
$plug = new Plugin(); $plug = new Plugin();
$file = $request->file('plugin'); $file = $request->file('plugin');
//dd($file); //dd($file);
$destination = app_path() . '/Plugins'; $destination = app_path().'/Plugins';
$zipfile = $file->getRealPath(); $zipfile = $file->getRealPath();
/** /*
* get the file name and remove .zip * get the file name and remove .zip
*/ */
$filename2 = $file->getClientOriginalName(); $filename2 = $file->getClientOriginalName();
$filename2 = str_replace('.zip', '', $filename2); $filename2 = str_replace('.zip', '', $filename2);
$filename1 = ucfirst($file->getClientOriginalName()); $filename1 = ucfirst($file->getClientOriginalName());
$filename = str_replace('.zip', '', $filename1); $filename = str_replace('.zip', '', $filename1);
mkdir($destination . '/' . $filename); mkdir($destination.'/'.$filename);
/** /*
* extract the zip file using zipper * extract the zip file using zipper
*/ */
\Zipper::make($zipfile)->folder($filename2)->extractTo($destination . '/' . $filename); \Zipper::make($zipfile)->folder($filename2)->extractTo($destination.'/'.$filename);
$file = app_path() . '/Plugins/' . $filename; // Plugin file path $file = app_path().'/Plugins/'.$filename; // Plugin file path
if (file_exists($file)) { if (file_exists($file)) {
$seviceporvider = $file.'/ServiceProvider.php';
$seviceporvider = $file . '/ServiceProvider.php'; $config = $file.'/config.php';
$config = $file . '/config.php';
if (file_exists($seviceporvider) && file_exists($config)) { if (file_exists($seviceporvider) && file_exists($config)) {
/** /*
* move to faveo config * move to faveo config
*/ */
$faveoconfig = config_path() . '/plugins/' . $filename . '.php'; $faveoconfig = config_path().'/plugins/'.$filename.'.php';
if ($faveoconfig) { if ($faveoconfig) {
//copy($config, $faveoconfig); //copy($config, $faveoconfig);
/** /*
* write provider list in app.php line 128 * write provider list in app.php line 128
*/ */
$app = base_path() . '/config/app.php'; $app = base_path().'/config/app.php';
$str = "\n\n\t\t\t'App\\Plugins\\$filename" . "\\ServiceProvider',"; $str = "\n\n\t\t\t'App\\Plugins\\$filename"."\\ServiceProvider',";
$line_i_am_looking_for = 144; $line_i_am_looking_for = 144;
$lines = file($app, FILE_IGNORE_NEW_LINES); $lines = file($app, FILE_IGNORE_NEW_LINES);
$lines[$line_i_am_looking_for] = $str; $lines[$line_i_am_looking_for] = $str;
file_put_contents($app, implode("\n", $lines)); file_put_contents($app, implode("\n", $lines));
$plug->create(['name' => $filename, 'path' => $filename, 'status' => 1]); $plug->create(['name' => $filename, 'path' => $filename, 'status' => 1]);
return redirect()->back()->with('success', 'Installed SuccessFully'); return redirect()->back()->with('success', 'Installed SuccessFully');
} else { } else {
/** /*
* delete if the plugin hasn't config.php and ServiceProvider.php * delete if the plugin hasn't config.php and ServiceProvider.php
*/ */
$this->deleteDirectory($file); $this->deleteDirectory($file);
return redirect()->back()->with('fails', 'Their is no ' . $file);
return redirect()->back()->with('fails', 'Their is no '.$file);
} }
} else { } else {
/** /*
* delete if the plugin hasn't config.php and ServiceProvider.php * delete if the plugin hasn't config.php and ServiceProvider.php
*/ */
$this->deleteDirectory($file); $this->deleteDirectory($file);
return redirect()->back()->with('fails', 'Their is no <b>config.php or ServiceProvider.php</b> ' . $file);
return redirect()->back()->with('fails', 'Their is no <b>config.php or ServiceProvider.php</b> '.$file);
} }
} else { } else {
/** /*
* delete if the plugin Name is not equal to the folder name * delete if the plugin Name is not equal to the folder name
*/ */
$this->deleteDirectory($file); $this->deleteDirectory($file);
return redirect()->back()->with('fails', '<b>Plugin File Path is not exist</b> ' . $file);
return redirect()->back()->with('fails', '<b>Plugin File Path is not exist</b> '.$file);
} }
} }
/** /**
* Delete the directory * Delete the directory.
*
* @param type $dir * @param type $dir
* @return boolean *
* @return bool
*/ */
public function deleteDirectory($dir) { public function deleteDirectory($dir)
{
if (!file_exists($dir)) { if (!file_exists($dir)) {
return true; return true;
} }
@@ -559,21 +626,23 @@ class SettingsController extends Controller {
if ($item == '.' || $item == '..') { if ($item == '.' || $item == '..') {
continue; continue;
} }
if (!$this->deleteDirectory($dir . DIRECTORY_SEPARATOR . $item)) { if (!$this->deleteDirectory($dir.DIRECTORY_SEPARATOR.$item)) {
return false; return false;
} }
} }
return rmdir($dir); return rmdir($dir);
} }
public function ReadConfigs() { public function ReadConfigs()
$dir = app_path() . '/Plugins/'; {
$files = array_diff(scandir($dir), array('.', '..', 'ServiceProvider.php')); $dir = app_path().'/Plugins/';
$plugins = array(); $files = array_diff(scandir($dir), ['.', '..', 'ServiceProvider.php']);
$plugins = [];
if ($files) { if ($files) {
foreach ($files as $key => $file) { foreach ($files as $key => $file) {
$plugin = $dir . $file; $plugin = $dir.$file;
$plugins[$key] = array_diff(scandir($plugin), array('.', '..', 'ServiceProvider.php')); $plugins[$key] = array_diff(scandir($plugin), ['.', '..', 'ServiceProvider.php']);
$plugins[$key]['file'] = $plugin; $plugins[$key]['file'] = $plugin;
} }
foreach ($plugins as $plugin) { foreach ($plugins as $plugin) {
@@ -582,22 +651,24 @@ class SettingsController extends Controller {
if ($dh = opendir($dir)) { if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) { while (($file = readdir($dh)) !== false) {
if ($file == 'config.php') { if ($file == 'config.php') {
$config[] = $dir . '/' . $file; $config[] = $dir.'/'.$file;
} }
} }
closedir($dh); closedir($dh);
} }
} }
return $config; return $config;
} else { } else {
return 'null'; return 'null';
} }
} }
public function fetchConfig() { public function fetchConfig()
{
$configs = $this->ReadConfigs(); $configs = $this->ReadConfigs();
//dd($configs); //dd($configs);
$plug = new Plugin; $plug = new Plugin();
$plug = $plug->select('path', 'status')->orderBy('name')->get()->toArray(); $plug = $plug->select('path', 'status')->orderBy('name')->get()->toArray();
//dd($plug[0]['path']); //dd($plug[0]['path']);
if ($configs !== 'null') { if ($configs !== 'null') {
@@ -608,38 +679,42 @@ class SettingsController extends Controller {
$fields[$key]['status'] = $plug[$key]['status']; $fields[$key]['status'] = $plug[$key]['status'];
} }
} }
return $fields; return $fields;
} else { } else {
return array(); return [];
} }
} }
public function DeletePlugin($slug) { public function DeletePlugin($slug)
$dir = app_path() . '/Plugins/' . $slug; {
$dir = app_path().'/Plugins/'.$slug;
$this->deleteDirectory($dir); $this->deleteDirectory($dir);
/** /*
* remove service provider from app.php * remove service provider from app.php
*/ */
$str = "'App\\Plugins\\$slug" . "\\ServiceProvider',"; $str = "'App\\Plugins\\$slug"."\\ServiceProvider',";
$path_to_file = base_path() . '/config/app.php'; $path_to_file = base_path().'/config/app.php';
$file_contents = file_get_contents($path_to_file); $file_contents = file_get_contents($path_to_file);
$file_contents = str_replace($str, "//", $file_contents); $file_contents = str_replace($str, '//', $file_contents);
file_put_contents($path_to_file, $file_contents); file_put_contents($path_to_file, $file_contents);
$plugin = new Plugin(); $plugin = new Plugin();
$plugin = $plugin->where('path', $slug)->first(); $plugin = $plugin->where('path', $slug)->first();
$plugin->delete(); $plugin->delete();
return redirect()->back()->with('success', 'Deleted Successfully'); return redirect()->back()->with('success', 'Deleted Successfully');
} }
public function StatusPlugin($slug) { public function StatusPlugin($slug)
$plug = new Plugin; {
$plug = new Plugin();
$plug = $plug->where('name', $slug)->first(); $plug = $plug->where('name', $slug)->first();
$status = $plug->status; $status = $plug->status;
if ($status == 0) { if ($status == 0) {
$plug->status = 1; $plug->status = 1;
$app = base_path() . '/config/app.php'; $app = base_path().'/config/app.php';
$str = "'App\\Plugins\\$slug" . "\\ServiceProvider',"; $str = "'App\\Plugins\\$slug"."\\ServiceProvider',";
$line_i_am_looking_for = 144; $line_i_am_looking_for = 144;
$lines = file($app, FILE_IGNORE_NEW_LINES); $lines = file($app, FILE_IGNORE_NEW_LINES);
$lines[$line_i_am_looking_for] = $str; $lines[$line_i_am_looking_for] = $str;
@@ -647,18 +722,18 @@ class SettingsController extends Controller {
} }
if ($status == 1) { if ($status == 1) {
$plug->status = 0; $plug->status = 0;
/** /*
* remove service provider from app.php * remove service provider from app.php
*/ */
$str = "'App\\Plugins\\$slug" . "\\ServiceProvider',"; $str = "'App\\Plugins\\$slug"."\\ServiceProvider',";
$path_to_file = base_path() . '/config/app.php'; $path_to_file = base_path().'/config/app.php';
$file_contents = file_get_contents($path_to_file); $file_contents = file_get_contents($path_to_file);
$file_contents = str_replace($str, "//", $file_contents); $file_contents = str_replace($str, '//', $file_contents);
file_put_contents($path_to_file, $file_contents); file_put_contents($path_to_file, $file_contents);
} }
$plug->save(); $plug->save();
return redirect()->back()->with('success', 'Status has changed'); return redirect()->back()->with('success', 'Status has changed');
} }
} }

View File

@@ -4,11 +4,11 @@ namespace App\Http\Controllers;
// classes // classes
use Illuminate\Foundation\Bus\DispatchesCommands; use Illuminate\Foundation\Bus\DispatchesCommands;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests; use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
abstract class Controller extends BaseController { abstract class Controller extends BaseController
{
use DispatchesCommands, use DispatchesCommands,
ValidatesRequests; ValidatesRequests;
} }

View File

@@ -6,20 +6,19 @@ namespace App\Http\Controllers\Error;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
/** /**
* ErrorController * ErrorController.
* *
* @package Controllers
* @subpackage Controller
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class ErrorController extends Controller { class ErrorController extends Controller
{
/** /**
* Display a Error Page of 404. * Display a Error Page of 404.
*
* @return Response * @return Response
*/ */
public function error404() { public function error404()
{
return view('404'); return view('404');
} }
} }

View File

@@ -2,10 +2,10 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Model\helpdesk\Manage\Sla_plan;
use App\Model\helpdesk\Ticket\Tickets; use App\Model\helpdesk\Ticket\Tickets;
class HomeController extends Controller { class HomeController extends Controller
{
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Home Controller | Home Controller
@@ -22,7 +22,8 @@ class HomeController extends Controller {
* *
* @return void * @return void
*/ */
public function __construct() { public function __construct()
{
// $this->middleware('auth'); // $this->middleware('auth');
} }
@@ -31,48 +32,52 @@ class HomeController extends Controller {
* *
* @return Response * @return Response
*/ */
public function index() { public function index()
{
// ksjdckjdsnc // ksjdckjdsnc
return view('themes/default1/admin/dashboard'); return view('themes/default1/admin/dashboard');
} }
public function getsmtp() { public function getsmtp()
{
$smtp = \App\Model\helpdesk\Email\Smtp::where('id', '=', '1')->first(); $smtp = \App\Model\helpdesk\Email\Smtp::where('id', '=', '1')->first();
return $smtp->host; return $smtp->host;
} }
Public function getdata() { public function getdata()
{
return \View::make('emails/notifications/agent'); return \View::make('emails/notifications/agent');
} }
public function getreport() { public function getreport()
{
return \View::make('test'); return \View::make('test');
} }
public function pushdata() { public function pushdata()
{
$date2 = strtotime(Date('Y-m-d')); $date2 = strtotime(date('Y-m-d'));
$date3 = Date('Y-m-d'); $date3 = date('Y-m-d');
$format = 'Y-m-d'; $format = 'Y-m-d';
$date1 = strtotime(Date($format, strtotime('-1 month' . $date3))); $date1 = strtotime(date($format, strtotime('-1 month'.$date3)));
$return = ""; $return = '';
$last = ""; $last = '';
for ($i = $date1; $i <= $date2; $i = $i + 86400) { for ($i = $date1; $i <= $date2; $i = $i + 86400) {
$thisDate = date('Y-m-d', $i); $thisDate = date('Y-m-d', $i);
$created = \DB::table('tickets')->select('created_at')->where('created_at', 'LIKE', '%' . $thisDate . '%')->count(); $created = \DB::table('tickets')->select('created_at')->where('created_at', 'LIKE', '%'.$thisDate.'%')->count();
$closed = \DB::table('tickets')->select('closed_at')->where('closed_at', 'LIKE', '%' . $thisDate . '%')->count(); $closed = \DB::table('tickets')->select('closed_at')->where('closed_at', 'LIKE', '%'.$thisDate.'%')->count();
$reopened = \DB::table('tickets')->select('reopened_at')->where('reopened_at', 'LIKE', '%' . $thisDate . '%')->count(); $reopened = \DB::table('tickets')->select('reopened_at')->where('reopened_at', 'LIKE', '%'.$thisDate.'%')->count();
$value = ['date' => $thisDate, 'open' => $created, 'closed' => $closed, 'reopened' => $reopened]; $value = ['date' => $thisDate, 'open' => $created, 'closed' => $closed, 'reopened' => $reopened];
$array = array_map('htmlentities', $value); $array = array_map('htmlentities', $value);
$json = html_entity_decode(json_encode($array)); $json = html_entity_decode(json_encode($array));
$return .= $json . ','; $return .= $json.',';
} }
$last = rtrim($return, ','); $last = rtrim($return, ',');
return '[' . $last . ']'; return '['.$last.']';
} }
} }

View File

@@ -7,43 +7,40 @@ use App\Http\Controllers\Controller;
// requests // requests
use App\Http\Requests\helpdesk\InstallerRequest; use App\Http\Requests\helpdesk\InstallerRequest;
// models // models
use App\User;
use App\Model\helpdesk\Settings\System; use App\Model\helpdesk\Settings\System;
use App\Model\helpdesk\Form\Form_details;
use App\Model\helpdesk\Utility\Date_time_format; use App\Model\helpdesk\Utility\Date_time_format;
use App\Model\helpdesk\Utility\Timezones; use App\Model\helpdesk\Utility\Timezones;
use App\User;
// classes // classes
use App;
use Artisan; use Artisan;
use Config; use Config;
use Exception;
use File; use File;
use Hash; use Hash;
use Input; use Input;
use Redirect; use Redirect;
use Session; use Session;
use View; use View;
use Exception;
/** /**
* |======================================================================= * |=======================================================================
* |Class: InstallController * |Class: InstallController
* |======================================================================= * |=======================================================================.
* *
* Class to perform the first install operation without this the database * Class to perform the first install operation without this the database
* settings could not be started * settings could not be started
* *
* @package Faveo HELPDESK
* @subpackage Controller
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*
*/ */
class InstallController extends Controller { class InstallController extends Controller
{
/** /**
* Get Licence (step 1) * Get Licence (step 1).
*
* @return type view * @return type view
*/ */
public function licence() { public function licence()
{
// checking if the installation is running for the first time or not // checking if the installation is running for the first time or not
if (Config::get('database.install') == '%0%') { if (Config::get('database.install') == '%0%') {
return view('themes/default1/installer/helpdesk/view1'); return view('themes/default1/installer/helpdesk/view1');
@@ -54,14 +51,17 @@ class InstallController extends Controller {
} }
/** /**
* Post Licencecheck * Post Licencecheck.
*
* @return type view * @return type view
*/ */
public function licencecheck() { public function licencecheck()
{
// checking if the user have accepted the licence agreement // checking if the user have accepted the licence agreement
$accept = (Input::has('accept1')) ? true : false; $accept = (Input::has('accept1')) ? true : false;
if ($accept == 'accept') { if ($accept == 'accept') {
Session::put('step1', 'step1'); Session::put('step1', 'step1');
return Redirect::route('prerequisites'); return Redirect::route('prerequisites');
} else { } else {
return Redirect::route('licence')->with('fails', 'Failed! first accept the licence agreeement'); return Redirect::route('licence')->with('fails', 'Failed! first accept the licence agreeement');
@@ -70,13 +70,15 @@ class InstallController extends Controller {
} }
/** /**
* Get prerequisites (step 2) * Get prerequisites (step 2).
* *
* Checking the extensions enabled required for installing the faveo * Checking the extensions enabled required for installing the faveo
* without which the project cannot be executed properly * without which the project cannot be executed properly
*
* @return type view * @return type view
*/ */
public function prerequisites() { public function prerequisites()
{
// checking if the installation is running for the first time or not // checking if the installation is running for the first time or not
if (Config::get('database.install') == '%0%') { if (Config::get('database.install') == '%0%') {
if (Session::get('step1') == 'step1') { if (Session::get('step1') == 'step1') {
@@ -91,20 +93,25 @@ class InstallController extends Controller {
/** /**
* Post Prerequisitescheck * Post Prerequisitescheck
* checking prerequisites * checking prerequisites.
*
* @return type view * @return type view
*/ */
public function prerequisitescheck() { public function prerequisitescheck()
{
Session::put('step2', 'step2'); Session::put('step2', 'step2');
return Redirect::route('configuration'); return Redirect::route('configuration');
} }
/** /**
* Get Localization (step 3) * Get Localization (step 3)
* Requesting user recomended settings for installation * Requesting user recomended settings for installation.
*
* @return type view * @return type view
*/ */
public function localization() { public function localization()
{
// checking if the installation is running for the first time or not // checking if the installation is running for the first time or not
if (Config::get('database.install') == '%0%') { if (Config::get('database.install') == '%0%') {
if (Session::get('step2') == 'step2') { if (Session::get('step2') == 'step2') {
@@ -119,11 +126,12 @@ class InstallController extends Controller {
/** /**
* Post localizationcheck * Post localizationcheck
* checking prerequisites * checking prerequisites.
*
* @return type view * @return type view
*/ */
public function localizationcheck() { public function localizationcheck()
{
Session::put('step3', 'step3'); Session::put('step3', 'step3');
Session::put('language', Input::get('language')); Session::put('language', Input::get('language'));
@@ -136,10 +144,12 @@ class InstallController extends Controller {
/** /**
* Get Configuration (step 4) * Get Configuration (step 4)
* checking prerequisites * checking prerequisites.
*
* @return type view * @return type view
*/ */
public function configuration() { public function configuration()
{
// checking if the installation is running for the first time or not // checking if the installation is running for the first time or not
if (Config::get('database.install') == '%0%') { if (Config::get('database.install') == '%0%') {
if (Session::get('step2') == 'step2') { if (Session::get('step2') == 'step2') {
@@ -154,11 +164,12 @@ class InstallController extends Controller {
/** /**
* Post configurationcheck * Post configurationcheck
* checking prerequisites * checking prerequisites.
*
* @return type view * @return type view
*/ */
public function configurationcheck() { public function configurationcheck()
{
Session::put('step4', 'step4'); Session::put('step4', 'step4');
// dd(Input::get('default')); // dd(Input::get('default'));
// dd(Input::get('host')); // dd(Input::get('host'));
@@ -166,7 +177,7 @@ class InstallController extends Controller {
// dd(Input::get('username')); // dd(Input::get('username'));
// dd(Input::get('password')); // dd(Input::get('password'));
// dd(Input::get('port')); // dd(Input::get('port'));
Session::put('default', Input::get('default')); Session::put('default', Input::get('default'));
Session::put('host', Input::get('host')); Session::put('host', Input::get('host'));
Session::put('databasename', Input::get('databasename')); Session::put('databasename', Input::get('databasename'));
@@ -178,10 +189,12 @@ class InstallController extends Controller {
} }
/** /**
* postconnection * postconnection.
*
* @return type view * @return type view
*/ */
public function postconnection() { public function postconnection()
{
error_reporting(E_ALL & ~E_NOTICE); error_reporting(E_ALL & ~E_NOTICE);
$default = Input::get('default'); $default = Input::get('default');
$host = Input::get('host'); $host = Input::get('host');
@@ -203,7 +216,7 @@ class InstallController extends Controller {
$config .= "{$key}={$val}\n"; $config .= "{$key}={$val}\n";
} }
// Write environment file // Write environment file
$fp = fopen(base_path() . "/.env", 'w'); $fp = fopen(base_path().'/.env', 'w');
fwrite($fp, $config); fwrite($fp, $config);
fclose($fp); fclose($fp);
@@ -212,10 +225,12 @@ class InstallController extends Controller {
/** /**
* Get database * Get database
* checking prerequisites * checking prerequisites.
*
* @return type view * @return type view
*/ */
public function database() { public function database()
{
// checking if the installation is running for the first time or not // checking if the installation is running for the first time or not
if (Config::get('database.install') == '%0%') { if (Config::get('database.install') == '%0%') {
if (Session::get('step4') == 'step4') { if (Session::get('step4') == 'step4') {
@@ -230,10 +245,12 @@ class InstallController extends Controller {
/** /**
* Get account * Get account
* checking prerequisites * checking prerequisites.
*
* @return type view * @return type view
*/ */
public function account() { public function account()
{
// checking if the installation is running for the first time or not // checking if the installation is running for the first time or not
if (Config::get('database.install') == '%0%') { if (Config::get('database.install') == '%0%') {
if (Session::get('step4') == 'step4') { if (Session::get('step4') == 'step4') {
@@ -241,6 +258,7 @@ class InstallController extends Controller {
Session::forget('step1'); Session::forget('step1');
Session::forget('step2'); Session::forget('step2');
Session::forget('step3'); Session::forget('step3');
return View::make('themes/default1/installer/helpdesk/view5'); return View::make('themes/default1/installer/helpdesk/view5');
} else { } else {
return Redirect::route('configuration'); return Redirect::route('configuration');
@@ -252,15 +270,18 @@ class InstallController extends Controller {
/** /**
* Post accountcheck * Post accountcheck
* checking prerequisites * checking prerequisites.
* @param type InstallerRequest $request *
* @param type InstallerRequest $request
*
* @return type view * @return type view
*/ */
public function accountcheck(InstallerRequest $request) { public function accountcheck(InstallerRequest $request)
{
// migrate database // migrate database
Artisan::call('migrate', array('--force' => true)); Artisan::call('migrate', ['--force' => true]);
Artisan::call('db:seed', array('--force' => true)); Artisan::call('db:seed', ['--force' => true]);
// create user // create user
$firstname = $request->input('firstname'); $firstname = $request->input('firstname');
@@ -274,9 +295,8 @@ class InstallController extends Controller {
$date = $request->input('date'); $date = $request->input('date');
$datetime = $request->input('datetime'); $datetime = $request->input('datetime');
//\Cache::forever('language', $language); //\Cache::forever('language', $language);
//\App::setLocale($language); //\App::setLocale($language);
// $system = System::where('id','=','1')->first(); // $system = System::where('id','=','1')->first();
// $system->time_zone = $timezone; // $system->time_zone = $timezone;
@@ -296,39 +316,41 @@ class InstallController extends Controller {
} }
// Creating minum settings for system // Creating minum settings for system
$system = new System; $system = new System();
$system->status = 1; $system->status = 1;
$system->department = 1; $system->department = 1;
$system->date_time_format = $date_time_format->id; $system->date_time_format = $date_time_format->id;
$system->time_zone = $timezones->id; $system->time_zone = $timezones->id;
$system->save(); $system->save();
// creating an user // creating an user
$user = User::create(array( $user = User::create([
'first_name' => $firstname, 'first_name' => $firstname,
'last_name' => $lastname, 'last_name' => $lastname,
'email' => $email, 'email' => $email,
'user_name' => $username, 'user_name' => $username,
'password' => Hash::make($password), 'password' => Hash::make($password),
'assign_group' => 1, 'assign_group' => 1,
'primary_dpt' => 1, 'primary_dpt' => 1,
'active' => 1, 'active' => 1,
'role' => 'admin', 'role' => 'admin',
)); ]);
// checking if the user have been created // checking if the user have been created
if ($user) { if ($user) {
Session::put('step6', 'step6'); Session::put('step6', 'step6');
return Redirect::route('final'); return Redirect::route('final');
} }
} }
/** /**
* Get finalize * Get finalize
* checking prerequisites * checking prerequisites.
*
* @return type view * @return type view
*/ */
public function finalize() { public function finalize()
{
// checking if the installation have been completed or not // checking if the installation have been completed or not
if (Session::get('step6') == 'step6') { if (Session::get('step6') == 'step6') {
$value = '1'; $value = '1';
@@ -354,6 +376,7 @@ class InstallController extends Controller {
Session::forget('step4'); Session::forget('step4');
Session::forget('step5'); Session::forget('step5');
Session::forget('step6'); Session::forget('step6');
return View::make('themes/default1/installer/helpdesk/view6'); return View::make('themes/default1/installer/helpdesk/view6');
} catch (Exception $e) { } catch (Exception $e) {
return Redirect::route('npl'); return Redirect::route('npl');
@@ -365,15 +388,16 @@ class InstallController extends Controller {
/** /**
* Post finalcheck * Post finalcheck
* checking prerequisites * checking prerequisites.
*
* @return type view * @return type view
*/ */
public function finalcheck() { public function finalcheck()
{
try { try {
return redirect('/auth/login'); return redirect('/auth/login');
} catch (Exception $e) { } catch (Exception $e) {
return redirect('/auth/login'); return redirect('/auth/login');
} }
} }
} }

View File

@@ -5,12 +5,10 @@ namespace App\Http;
use Illuminate\Foundation\Http\Kernel as HttpKernel; use Illuminate\Foundation\Http\Kernel as HttpKernel;
/** /**
* Kernel * Kernel.
*
* @package HttpKernel
*/ */
class Kernel extends HttpKernel { class Kernel extends HttpKernel
{
/** /**
* The application's global HTTP middleware stack. * The application's global HTTP middleware stack.
* *
@@ -32,15 +30,14 @@ class Kernel extends HttpKernel {
* @var array * @var array
*/ */
protected $routeMiddleware = [ protected $routeMiddleware = [
'auth' => 'App\Http\Middleware\Authenticate', 'auth' => 'App\Http\Middleware\Authenticate',
'auth.basic' => 'Illuminate\Auth\Middleware\AuthenticateWithBasicAuth', 'auth.basic' => 'Illuminate\Auth\Middleware\AuthenticateWithBasicAuth',
'guest' => 'App\Http\Middleware\RedirectIfAuthenticated', 'guest' => 'App\Http\Middleware\RedirectIfAuthenticated',
'roles' => 'App\Http\Middleware\CheckRole', 'roles' => 'App\Http\Middleware\CheckRole',
'role.agent' => 'App\Http\Middleware\CheckRoleAgent', 'role.agent' => 'App\Http\Middleware\CheckRoleAgent',
'role.user' => 'App\Http\Middleware\CheckRoleUser', 'role.user' => 'App\Http\Middleware\CheckRoleUser',
'api' => 'App\Http\Middleware\ApiKey', 'api' => 'App\Http\Middleware\ApiKey',
'jwt.auth' => \Tymon\JWTAuth\Middleware\GetUserFromToken::class, 'jwt.auth' => \Tymon\JWTAuth\Middleware\GetUserFromToken::class,
'jwt.refresh' => \Tymon\JWTAuth\Middleware\RefreshToken::class 'jwt.refresh' => \Tymon\JWTAuth\Middleware\RefreshToken::class,
]; ];
} }

View File

@@ -2,14 +2,15 @@
namespace App\Http\Middleware; namespace App\Http\Middleware;
use Closure;
use App\Model\helpdesk\Settings\System; use App\Model\helpdesk\Settings\System;
use Closure;
class ApiKey { class ApiKey
{
public $setting; public $setting;
public function __construct() { public function __construct()
{
$setting = new System(); $setting = new System();
$this->setting = $setting; $this->setting = $setting;
} }
@@ -17,11 +18,13 @@ class ApiKey {
/** /**
* Handle an incoming request. * Handle an incoming request.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @param \Closure $next * @param \Closure $next
*
* @return mixed * @return mixed
*/ */
public function handle($request, Closure $next) { public function handle($request, Closure $next)
{
$set = $this->setting->where('id', '1')->first(); $set = $this->setting->where('id', '1')->first();
if ($set->api_enable == 1) { if ($set->api_enable == 1) {
$key = $set->api_key; $key = $set->api_key;
@@ -29,12 +32,13 @@ class ApiKey {
return $next($request); return $next($request);
} else { } else {
$result = 'wrong api key'; $result = 'wrong api key';
return response()->json(compact('result')); return response()->json(compact('result'));
} }
} else { } else {
$result = 'please enable api'; $result = 'please enable api';
return response()->json(compact('result')); return response()->json(compact('result'));
} }
} }
} }

View File

@@ -6,13 +6,12 @@ use Closure;
use Illuminate\Contracts\Auth\Guard; use Illuminate\Contracts\Auth\Guard;
/** /**
* Authenticate * Authenticate.
* *
* @package Middleware
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class Authenticate { class Authenticate
{
/** /**
* The Guard implementation. * The Guard implementation.
* *
@@ -23,21 +22,25 @@ class Authenticate {
/** /**
* Create a new filter instance. * Create a new filter instance.
* *
* @param Guard $auth * @param Guard $auth
*
* @return void * @return void
*/ */
public function __construct(Guard $auth) { public function __construct(Guard $auth)
{
$this->auth = $auth; $this->auth = $auth;
} }
/** /**
* Handle an incoming request. * Handle an incoming request.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @param \Closure $next * @param \Closure $next
*
* @return mixed * @return mixed
*/ */
public function handle($request, Closure $next) { public function handle($request, Closure $next)
{
if ($this->auth->guest()) { if ($this->auth->guest()) {
if ($request->ajax()) { if ($request->ajax()) {
return response('Unauthorized.', 401); return response('Unauthorized.', 401);
@@ -48,5 +51,4 @@ class Authenticate {
return $next($request); return $next($request);
} }
} }

View File

@@ -5,26 +5,26 @@ namespace App\Http\Middleware;
use Closure; use Closure;
/** /**
* CheckRole * CheckRole.
* *
* @package Middleware
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class CheckRole { class CheckRole
{
/** /**
* Handle an incoming request. * Handle an incoming request.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @param \Closure $next * @param \Closure $next
*
* @return mixed * @return mixed
*/ */
public function handle($request, Closure $next) { public function handle($request, Closure $next)
{
if ($request->user()->role == 'admin') { if ($request->user()->role == 'admin') {
return $next($request); return $next($request);
} }
return redirect('guest')->with('fails', 'You are not Autherised'); return redirect('guest')->with('fails', 'You are not Autherised');
} }
} }

View File

@@ -5,25 +5,26 @@ namespace App\Http\Middleware;
use Closure; use Closure;
/** /**
* CheckRoleAgent * CheckRoleAgent.
* *
* @package default
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class CheckRoleAgent { class CheckRoleAgent
{
/** /**
* Handle an incoming request. * Handle an incoming request.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @param \Closure $next * @param \Closure $next
*
* @return mixed * @return mixed
*/ */
public function handle($request, Closure $next) { public function handle($request, Closure $next)
{
if ($request->user()->role == 'agent' || $request->user()->role == 'admin') { if ($request->user()->role == 'agent' || $request->user()->role == 'admin') {
return $next($request); return $next($request);
} }
return redirect('dashboard')->with('fails', 'You are not Autherised'); return redirect('dashboard')->with('fails', 'You are not Autherised');
} }
} }

View File

@@ -5,25 +5,26 @@ namespace App\Http\Middleware;
use Closure; use Closure;
/** /**
* CheckRoleUser * CheckRoleUser.
* *
* @package Middleware
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class CheckRoleUser { class CheckRoleUser
{
/** /**
* Handle an incoming request. * Handle an incoming request.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @param \Closure $next * @param \Closure $next
*
* @return mixed * @return mixed
*/ */
public function handle($request, Closure $next) { public function handle($request, Closure $next)
{
if ($request->user()->role == 'user') { if ($request->user()->role == 'user') {
return $next($request); return $next($request);
} }
return redirect('guest')->with('fails', 'You are not Autherised'); return redirect('guest')->with('fails', 'You are not Autherised');
} }
} }

View File

@@ -5,22 +5,19 @@ namespace App\Http\Middleware;
use Cache; use Cache;
use Closure; use Closure;
use Illuminate\Contracts\Routing\Middleware; use Illuminate\Contracts\Routing\Middleware;
use Illuminate\Foundation\Application;
use Illuminate\Http\Request;
use Illuminate\Routing\Redirector;
use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Config; use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Session;
class LanguageMiddleware implements Middleware { class LanguageMiddleware implements Middleware
{
public function handle($request, Closure $next) { public function handle($request, Closure $next)
if (Cache::has('language') AND array_key_exists(Cache::get('language'), Config::get('languages'))) { {
if (Cache::has('language') and array_key_exists(Cache::get('language'), Config::get('languages'))) {
App::setLocale(Cache::get('language')); App::setLocale(Cache::get('language'));
} else { // This is optional as Laravel will automatically set the fallback language if there is none specified } else { // This is optional as Laravel will automatically set the fallback language if there is none specified
App::setLocale(Config::get('app.fallback_locale')); App::setLocale(Config::get('app.fallback_locale'));
} }
return $next($request); return $next($request);
} }
} }

View File

@@ -6,8 +6,8 @@ use Closure;
use Illuminate\Contracts\Auth\Guard; use Illuminate\Contracts\Auth\Guard;
use Illuminate\Http\RedirectResponse; use Illuminate\Http\RedirectResponse;
class RedirectIfAuthenticated { class RedirectIfAuthenticated
{
/** /**
* The Guard implementation. * The Guard implementation.
* *
@@ -18,26 +18,29 @@ class RedirectIfAuthenticated {
/** /**
* Create a new filter instance. * Create a new filter instance.
* *
* @param Guard $auth * @param Guard $auth
*
* @return void * @return void
*/ */
public function __construct(Guard $auth) { public function __construct(Guard $auth)
{
$this->auth = $auth; $this->auth = $auth;
} }
/** /**
* Handle an incoming request. * Handle an incoming request.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @param \Closure $next * @param \Closure $next
*
* @return mixed * @return mixed
*/ */
public function handle($request, Closure $next) { public function handle($request, Closure $next)
{
if ($this->auth->check()) { if ($this->auth->check()) {
return new RedirectResponse(url('dashboard')); return new RedirectResponse(url('dashboard'));
} }
return $next($request); return $next($request);
} }
} }

View File

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

View File

@@ -4,6 +4,7 @@ namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest; use Illuminate\Foundation\Http\FormRequest;
abstract class Request extends FormRequest { abstract class Request extends FormRequest
{
// //
} }

View File

@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
use App\Http\Requests\Request; use App\Http\Requests\Request;
/** /**
* AgentRequest * AgentRequest.
* *
* @package Request
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class AgentRequest extends Request { class AgentRequest extends Request
{
/** /**
* Determine if the user is authorized to make this request. * Determine if the user is authorized to make this request.
* *
* @return bool * @return bool
*/ */
public function authorize() { public function authorize()
{
return true; return true;
} }
@@ -26,21 +26,21 @@ class AgentRequest extends Request {
* *
* @return array * @return array
*/ */
public function rules() { public function rules()
{
return [ return [
'user_name' => 'required|unique:users', 'user_name' => 'required|unique:users',
'first_name' => 'required', 'first_name' => 'required',
'last_name' => 'required', 'last_name' => 'required',
'email' => 'required', 'email' => 'required',
'active' => 'required', 'active' => 'required',
// 'account_status' => 'required', // 'account_status' => 'required',
'assign_group' => 'required', 'assign_group' => 'required',
'primary_dpt' => 'required', 'primary_dpt' => 'required',
'agent_tzone' => 'required', 'agent_tzone' => 'required',
// 'phone_number' => 'phone:IN', // 'phone_number' => 'phone:IN',
// 'mobile' => 'phone:IN', // 'mobile' => 'phone:IN',
'team_id' => 'required', 'team_id' => 'required',
]; ];
} }
} }

View File

@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
use App\Http\Requests\Request; use App\Http\Requests\Request;
/** /**
* AgentUpdate * AgentUpdate.
* *
* @package Request
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class AgentUpdate extends Request { class AgentUpdate extends Request
{
/** /**
* Determine if the user is authorized to make this request. * Determine if the user is authorized to make this request.
* *
* @return bool * @return bool
*/ */
public function authorize() { public function authorize()
{
return true; return true;
} }
@@ -26,20 +26,20 @@ class AgentUpdate extends Request {
* *
* @return array * @return array
*/ */
public function rules() { public function rules()
{
return [ return [
'first_name' => 'required', 'first_name' => 'required',
'last_name' => 'required', 'last_name' => 'required',
'email' => 'required|email', 'email' => 'required|email',
'active' => 'required', 'active' => 'required',
'role' => 'required', 'role' => 'required',
'assign_group' => 'required', 'assign_group' => 'required',
'primary_dpt' => 'required', 'primary_dpt' => 'required',
'agent_tzone' => 'required', 'agent_tzone' => 'required',
// 'phone_number' => 'phone:IN', // 'phone_number' => 'phone:IN',
// 'mobile' => 'phone:IN', // 'mobile' => 'phone:IN',
'team_id' => 'required', 'team_id' => 'required',
]; ];
} }
} }

View File

@@ -4,14 +4,15 @@ namespace App\Http\Requests\helpdesk;
use App\Http\Requests\Request; use App\Http\Requests\Request;
class ArticleRequest extends Request { class ArticleRequest extends Request
{
/** /**
* Determine if the user is authorized to make this request. * Determine if the user is authorized to make this request.
* *
* @return bool * @return bool
*/ */
public function authorize() { public function authorize()
{
return true; return true;
} }
@@ -20,11 +21,11 @@ class ArticleRequest extends Request {
* *
* @return array * @return array
*/ */
public function rules() { public function rules()
{
return [ return [
'name' => 'required', 'name' => 'required',
'description' => 'required', 'description' => 'required',
]; ];
} }
} }

View File

@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
use App\Http\Requests\Request; use App\Http\Requests\Request;
/** /**
* BanRequest * BanRequest.
* *
* @package Request
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class BanRequest extends Request { class BanRequest extends Request
{
/** /**
* Determine if the user is authorized to make this request. * Determine if the user is authorized to make this request.
* *
* @return bool * @return bool
*/ */
public function authorize() { public function authorize()
{
return true; return true;
} }
@@ -26,11 +26,11 @@ class BanRequest extends Request {
* *
* @return array * @return array
*/ */
public function rules() { public function rules()
{
return [ return [
'email' => 'required|email', 'email' => 'required|email',
'ban' => 'required', 'ban' => 'required',
]; ];
} }
} }

View File

@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
use App\Http\Requests\Request; use App\Http\Requests\Request;
/** /**
* BanlistRequest * BanlistRequest.
* *
* @package Request
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class BanlistRequest extends Request { class BanlistRequest extends Request
{
/** /**
* Determine if the user is authorized to make this request. * Determine if the user is authorized to make this request.
* *
* @return bool * @return bool
*/ */
public function authorize() { public function authorize()
{
return true; return true;
} }
@@ -26,11 +26,11 @@ class BanlistRequest extends Request {
* *
* @return array * @return array
*/ */
public function rules() { public function rules()
{
return [ return [
'email' => 'email', 'email' => 'email',
'ban' => 'required', 'ban' => 'required',
]; ];
} }
} }

View File

@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
use App\Http\Requests\Request; use App\Http\Requests\Request;
/** /**
* AgentRequest * AgentRequest.
* *
* @package Request
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class CannedRequest extends Request { class CannedRequest extends Request
{
/** /**
* Determine if the user is authorized to make this request. * Determine if the user is authorized to make this request.
* *
* @return bool * @return bool
*/ */
public function authorize() { public function authorize()
{
return true; return true;
} }
@@ -26,11 +26,11 @@ class CannedRequest extends Request {
* *
* @return array * @return array
*/ */
public function rules() { public function rules()
{
return [ return [
'title' => 'required', 'title' => 'required',
'message' => 'required', 'message' => 'required',
]; ];
} }
} }

View File

@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
use App\Http\Requests\Request; use App\Http\Requests\Request;
/** /**
* AgentRequest * AgentRequest.
* *
* @package Request
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class CannedUpdateRequest extends Request { class CannedUpdateRequest extends Request
{
/** /**
* Determine if the user is authorized to make this request. * Determine if the user is authorized to make this request.
* *
* @return bool * @return bool
*/ */
public function authorize() { public function authorize()
{
return true; return true;
} }
@@ -26,11 +26,11 @@ class CannedUpdateRequest extends Request {
* *
* @return array * @return array
*/ */
public function rules() { public function rules()
{
return [ return [
'title' => 'required', 'title' => 'required',
'message' => 'required', 'message' => 'required',
]; ];
} }
} }

View File

@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
use App\Http\Requests\Request; use App\Http\Requests\Request;
/** /**
* CheckTicket * CheckTicket.
* *
* @package Request
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class CheckTicket extends Request { class CheckTicket extends Request
{
/** /**
* Determine if the user is authorized to make this request. * Determine if the user is authorized to make this request.
* *
* @return bool * @return bool
*/ */
public function authorize() { public function authorize()
{
return true; return true;
} }
@@ -26,11 +26,11 @@ class CheckTicket extends Request {
* *
* @return array * @return array
*/ */
public function rules() { public function rules()
{
return [ return [
'email' => 'required|email', 'email' => 'required|email',
'ticket_number' => 'required', 'ticket_number' => 'required',
]; ];
} }
} }

View File

@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
use App\Http\Requests\Request; use App\Http\Requests\Request;
/** /**
* CompanyRequest * CompanyRequest.
* *
* @package Request
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class ClientRequest extends Request { class ClientRequest extends Request
{
/** /**
* Determine if the user is authorized to make this request. * Determine if the user is authorized to make this request.
* *
* @return bool * @return bool
*/ */
public function authorize() { public function authorize()
{
return true; return true;
} }
@@ -26,13 +26,13 @@ class ClientRequest extends Request {
* *
* @return array * @return array
*/ */
public function rules() { public function rules()
{
return [ return [
'Name' => 'required', 'Name' => 'required',
'Email' => 'required', 'Email' => 'required',
'Subject' => 'required', 'Subject' => 'required',
'Details' => 'required', 'Details' => 'required',
]; ];
} }
} }

View File

@@ -4,14 +4,15 @@ namespace App\Http\Requests\helpdesk;
use App\Http\Requests\Request; use App\Http\Requests\Request;
class CommentRequest extends Request { class CommentRequest extends Request
{
/** /**
* Determine if the user is authorized to make this request. * Determine if the user is authorized to make this request.
* *
* @return bool * @return bool
*/ */
public function authorize() { public function authorize()
{
return true; return true;
} }
@@ -20,13 +21,13 @@ class CommentRequest extends Request {
* *
* @return array * @return array
*/ */
public function rules() { public function rules()
{
return [ return [
'name' => 'required|max:10', 'name' => 'required|max:10',
'email' => 'required|email', 'email' => 'required|email',
'website' => 'url', 'website' => 'url',
'comment' => 'required|max:60', 'comment' => 'required|max:60',
]; ];
} }
} }

View File

@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
use App\Http\Requests\Request; use App\Http\Requests\Request;
/** /**
* CompanyRequest * CompanyRequest.
* *
* @package Request
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class CompanyRequest extends Request { class CompanyRequest extends Request
{
/** /**
* Determine if the user is authorized to make this request. * Determine if the user is authorized to make this request.
* *
* @return bool * @return bool
*/ */
public function authorize() { public function authorize()
{
return true; return true;
} }
@@ -26,13 +26,13 @@ class CompanyRequest extends Request {
* *
* @return array * @return array
*/ */
public function rules() { public function rules()
{
return [ return [
'company_name' => 'required', 'company_name' => 'required',
'website' => 'url', 'website' => 'url',
'phone' => 'numeric', 'phone' => 'numeric',
'logo' => 'image', 'logo' => 'image',
]; ];
} }
} }

View File

@@ -4,14 +4,15 @@ namespace App\Http\Requests\helpdesk;
use App\Http\Requests\Request; use App\Http\Requests\Request;
class ContactRequest extends Request { class ContactRequest extends Request
{
/** /**
* Determine if the user is authorized to make this request. * Determine if the user is authorized to make this request.
* *
* @return bool * @return bool
*/ */
public function authorize() { public function authorize()
{
return true; return true;
} }
@@ -20,13 +21,13 @@ class ContactRequest extends Request {
* *
* @return array * @return array
*/ */
public function rules() { public function rules()
{
return [ return [
'name' => 'required', 'name' => 'required',
'email' => 'required|email', 'email' => 'required|email',
'subject' => 'required', 'subject' => 'required',
'message' => 'required|max:50', 'message' => 'required|max:50',
]; ];
} }
} }

View File

@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
use App\Http\Requests\Request; use App\Http\Requests\Request;
/** /**
* CreateTicketRequest * CreateTicketRequest.
* *
* @package Request
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class CreateTicketRequest extends Request { class CreateTicketRequest extends Request
{
/** /**
* Determine if the user is authorized to make this request. * Determine if the user is authorized to make this request.
* *
* @return bool * @return bool
*/ */
public function authorize() { public function authorize()
{
return true; return true;
} }
@@ -26,18 +26,18 @@ class CreateTicketRequest extends Request {
* *
* @return array * @return array
*/ */
public function rules() { public function rules()
{
return [ return [
'email' => 'required|email', 'email' => 'required|email',
'fullname' => 'required|min:3', 'fullname' => 'required|min:3',
'helptopic' => 'required', 'helptopic' => 'required',
// 'dept' => 'required', // 'dept' => 'required',
'sla' => 'required', 'sla' => 'required',
'subject' => 'required|min:5', 'subject' => 'required|min:5',
'body' => 'required|min:20', 'body' => 'required|min:20',
'priority' => 'required', 'priority' => 'required',
]; ];
} }
} }

View File

@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
use App\Http\Requests\Request; use App\Http\Requests\Request;
/** /**
* DepartmentRequest * DepartmentRequest.
* *
* @package Request
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class DepartmentRequest extends Request { class DepartmentRequest extends Request
{
/** /**
* Determine if the user is authorized to make this request. * Determine if the user is authorized to make this request.
* *
* @return bool * @return bool
*/ */
public function authorize() { public function authorize()
{
return true; return true;
} }
@@ -26,7 +26,8 @@ class DepartmentRequest extends Request {
* *
* @return array * @return array
*/ */
public function rules() { public function rules()
{
return [ return [
'name' => 'required|unique:department', 'name' => 'required|unique:department',
// 'outgoing_email' => 'required', // 'outgoing_email' => 'required',
@@ -34,5 +35,4 @@ class DepartmentRequest extends Request {
// 'group_id' => 'required', // 'group_id' => 'required',
]; ];
} }
} }

View File

@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
use App\Http\Requests\Request; use App\Http\Requests\Request;
/** /**
* DepartmentUpdate * DepartmentUpdate.
* *
* @package Request
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class DepartmentUpdate extends Request { class DepartmentUpdate extends Request
{
/** /**
* Determine if the user is authorized to make this request. * Determine if the user is authorized to make this request.
* *
* @return bool * @return bool
*/ */
public function authorize() { public function authorize()
{
return true; return true;
} }
@@ -26,7 +26,8 @@ class DepartmentUpdate extends Request {
* *
* @return array * @return array
*/ */
public function rules() { public function rules()
{
return [ return [
// 'outgoing_email' => 'required', // 'outgoing_email' => 'required',
@@ -34,5 +35,4 @@ class DepartmentUpdate extends Request {
// 'group_id' => 'required', // 'group_id' => 'required',
]; ];
} }
} }

View File

@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
use App\Http\Requests\Request; use App\Http\Requests\Request;
/** /**
* DiagnoRequest * DiagnoRequest.
* *
* @package Request
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class DiagnoRequest extends Request { class DiagnoRequest extends Request
{
/** /**
* Determine if the user is authorized to make this request. * Determine if the user is authorized to make this request.
* *
* @return bool * @return bool
*/ */
public function authorize() { public function authorize()
{
return true; return true;
} }
@@ -26,13 +26,13 @@ class DiagnoRequest extends Request {
* *
* @return array * @return array
*/ */
public function rules() { public function rules()
{
return [ return [
'from' => 'required|email', 'from' => 'required|email',
'to' => 'required|email', 'to' => 'required|email',
'subject' => 'required', 'subject' => 'required',
'message' => 'required', 'message' => 'required',
]; ];
} }
} }

View File

@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
use App\Http\Requests\Request; use App\Http\Requests\Request;
/** /**
* EmailRequest * EmailRequest.
* *
* @package Request
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class EmailRequest extends Request { class EmailRequest extends Request
{
/** /**
* Determine if the user is authorized to make this request. * Determine if the user is authorized to make this request.
* *
* @return bool * @return bool
*/ */
public function authorize() { public function authorize()
{
return true; return true;
} }
@@ -26,9 +26,9 @@ class EmailRequest extends Request {
* *
* @return array * @return array
*/ */
public function rules() { public function rules()
{
return [ return [
]; ];
} }
} }

View File

@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
use App\Http\Requests\Request; use App\Http\Requests\Request;
/** /**
* EmailsEditRequest * EmailsEditRequest.
* *
* @package Request
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class EmailsEditRequest extends Request { class EmailsEditRequest extends Request
{
/** /**
* Determine if the user is authorized to make this request. * Determine if the user is authorized to make this request.
* *
* @return bool * @return bool
*/ */
public function authorize() { public function authorize()
{
return true; return true;
} }
@@ -26,10 +26,11 @@ class EmailsEditRequest extends Request {
* *
* @return array * @return array
*/ */
public function rules() { public function rules()
{
return [ return [
'email_address' => 'email', 'email_address' => 'email',
'email_name' => 'required', 'email_name' => 'required',
// 'department' => 'required', // 'department' => 'required',
// 'priority' => 'required', // 'priority' => 'required',
// 'help_topic' => 'required', // 'help_topic' => 'required',
@@ -39,10 +40,9 @@ class EmailsEditRequest extends Request {
// 'sending_host' => 'required', // 'sending_host' => 'required',
// 'sending_port' => 'required', // 'sending_port' => 'required',
//'mailbox_protocol' => 'required' //'mailbox_protocol' => 'required'
'fetching_host' => 'required', 'fetching_host' => 'required',
'fetching_port' => 'required', 'fetching_port' => 'required',
'mailbox_protocol' => 'required', 'mailbox_protocol' => 'required',
]; ];
} }
} }

View File

@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
use App\Http\Requests\Request; use App\Http\Requests\Request;
/** /**
* EmailsRequest * EmailsRequest.
* *
* @package Request
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class EmailsRequest extends Request { class EmailsRequest extends Request
{
/** /**
* Determine if the user is authorized to make this request. * Determine if the user is authorized to make this request.
* *
* @return bool * @return bool
*/ */
public function authorize() { public function authorize()
{
return true; return true;
} }
@@ -26,10 +26,11 @@ class EmailsRequest extends Request {
* *
* @return array * @return array
*/ */
public function rules() { public function rules()
{
return [ return [
'email_address' => 'required|email|unique:emails', 'email_address' => 'required|email|unique:emails',
'email_name' => 'required', 'email_name' => 'required',
// 'department' => 'required', // 'department' => 'required',
// 'priority' => 'required', // 'priority' => 'required',
// 'help_topic' => 'required', // 'help_topic' => 'required',
@@ -38,10 +39,9 @@ class EmailsRequest extends Request {
// 'user_name' => 'required', // 'user_name' => 'required',
// 'sending_host' => 'required', // 'sending_host' => 'required',
// 'sending_port' => 'required', // 'sending_port' => 'required',
'fetching_host' => 'required', 'fetching_host' => 'required',
'fetching_port' => 'required', 'fetching_port' => 'required',
'mailbox_protocol' => 'required', 'mailbox_protocol' => 'required',
]; ];
} }
} }

View File

@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
use App\Http\Requests\Request; use App\Http\Requests\Request;
/** /**
* FormRequest * FormRequest.
* *
* @package Request
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class FormRequest extends Request { class FormRequest extends Request
{
/** /**
* Determine if the user is authorized to make this request. * Determine if the user is authorized to make this request.
* *
* @return bool * @return bool
*/ */
public function authorize() { public function authorize()
{
return true; return true;
} }
@@ -26,14 +26,14 @@ class FormRequest extends Request {
* *
* @return array * @return array
*/ */
public function rules() { public function rules()
{
return [ return [
'title' => 'required', 'title' => 'required',
'label' => 'required', 'label' => 'required',
'type' => 'required', 'type' => 'required',
'visibility' => 'required', 'visibility' => 'required',
]; ];
} }
} }

View File

@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
use App\Http\Requests\Request; use App\Http\Requests\Request;
/** /**
* GroupRequest * GroupRequest.
* *
* @package Request
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class GroupRequest extends Request { class GroupRequest extends Request
{
/** /**
* Determine if the user is authorized to make this request. * Determine if the user is authorized to make this request.
* *
* @return bool * @return bool
*/ */
public function authorize() { public function authorize()
{
return true; return true;
} }
@@ -26,10 +26,10 @@ class GroupRequest extends Request {
* *
* @return array * @return array
*/ */
public function rules() { public function rules()
{
return [ return [
'name' => 'required|unique:groups', 'name' => 'required|unique:groups',
]; ];
} }
} }

View File

@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
use App\Http\Requests\Request; use App\Http\Requests\Request;
/** /**
* HelptopicRequest * HelptopicRequest.
* *
* @package Request
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class HelptopicRequest extends Request { class HelptopicRequest extends Request
{
/** /**
* Determine if the user is authorized to make this request. * Determine if the user is authorized to make this request.
* *
* @return bool * @return bool
*/ */
public function authorize() { public function authorize()
{
return true; return true;
} }
@@ -26,16 +26,16 @@ class HelptopicRequest extends Request {
* *
* @return array * @return array
*/ */
public function rules() { public function rules()
{
return [ return [
'topic' => 'required|unique:help_topic', 'topic' => 'required|unique:help_topic',
// 'parent_topic' => 'required', // 'parent_topic' => 'required',
// 'custom_form' => 'required', // 'custom_form' => 'required',
'department' => 'required', 'department' => 'required',
'priority' => 'required', 'priority' => 'required',
'sla_plan' => 'required', 'sla_plan' => 'required',
// 'auto_assign' => 'required', // 'auto_assign' => 'required',
]; ];
} }
} }

View File

@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
use App\Http\Requests\Request; use App\Http\Requests\Request;
/** /**
* HelptopicUpdate * HelptopicUpdate.
* *
* @package Request
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class HelptopicUpdate extends Request { class HelptopicUpdate extends Request
{
/** /**
* Determine if the user is authorized to make this request. * Determine if the user is authorized to make this request.
* *
* @return bool * @return bool
*/ */
public function authorize() { public function authorize()
{
return true; return true;
} }
@@ -26,15 +26,15 @@ class HelptopicUpdate extends Request {
* *
* @return array * @return array
*/ */
public function rules() { public function rules()
{
return [ return [
// 'parent_topic' => 'required', // 'parent_topic' => 'required',
// 'custom_form' => 'required', // 'custom_form' => 'required',
'department' => 'required', 'department' => 'required',
'priority' => 'required', 'priority' => 'required',
'sla_plan' => 'required', 'sla_plan' => 'required',
// 'auto_assign' => 'required', // 'auto_assign' => 'required',
]; ];
} }
} }

View File

@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
use App\Http\Requests\Request; use App\Http\Requests\Request;
/** /**
* InstallerRequest * InstallerRequest.
* *
* @package Request
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class InstallerRequest extends Request { class InstallerRequest extends Request
{
/** /**
* Determine if the user is authorized to make this request. * Determine if the user is authorized to make this request.
* *
* @return bool * @return bool
*/ */
public function authorize() { public function authorize()
{
return true; return true;
} }
@@ -26,15 +26,15 @@ class InstallerRequest extends Request {
* *
* @return array * @return array
*/ */
public function rules() { public function rules()
{
return [ return [
'firstname' => 'required|max:20', 'firstname' => 'required|max:20',
'Lastname' => 'required|max:20', 'Lastname' => 'required|max:20',
'email' => 'required|max:50|email', 'email' => 'required|max:50|email',
'username' => 'required|max:50|min:3', 'username' => 'required|max:50|min:3',
'password' => 'required|min:6', 'password' => 'required|min:6',
'confirmpassword' => 'required|same:password', 'confirmpassword' => 'required|same:password',
]; ];
} }
} }

View File

@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
use App\Http\Requests\Request; use App\Http\Requests\Request;
/** /**
* LoginRequest * LoginRequest.
* *
* @package Request
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class LoginRequest extends Request { class LoginRequest extends Request
{
/** /**
* Determine if the user is authorized to make this request. * Determine if the user is authorized to make this request.
* *
* @return bool * @return bool
*/ */
public function authorize() { public function authorize()
{
return true; return true;
} }
@@ -26,11 +26,11 @@ class LoginRequest extends Request {
* *
* @return array * @return array
*/ */
public function rules() { public function rules()
{
return [ return [
'email' => 'required', 'email' => 'required',
'password' => 'required|min:6', 'password' => 'required|min:6',
]; ];
} }
} }

View File

@@ -4,14 +4,15 @@ namespace App\Http\Requests\helpdesk;
use App\Http\Requests\Request; use App\Http\Requests\Request;
class MessageRequest extends Request { class MessageRequest extends Request
{
/** /**
* Determine if the user is authorized to make this request. * Determine if the user is authorized to make this request.
* *
* @return bool * @return bool
*/ */
public function authorize() { public function authorize()
{
return true; return true;
} }
@@ -20,13 +21,12 @@ class MessageRequest extends Request {
* *
* @return array * @return array
*/ */
public function rules() { public function rules()
{
return [ return [
'message_title' => 'required', 'message_title' => 'required',
'message' => 'required' 'message' => 'required',
]; ];
} }
} }

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