Applied fixes from StyleCI
This commit is contained in:

committed by
StyleCI Bot

parent
be5df5334f
commit
d637c2b23f
@@ -1,7 +1,8 @@
|
||||
<?php namespace App\Commands;
|
||||
<?php
|
||||
|
||||
abstract class Command {
|
||||
namespace App\Commands;
|
||||
|
||||
abstract class Command
|
||||
{
|
||||
//
|
||||
|
||||
}
|
||||
|
@@ -1,10 +1,12 @@
|
||||
<?php namespace App\Console\Commands;
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Foundation\Inspiring;
|
||||
|
||||
class Inspire extends Command {
|
||||
|
||||
class Inspire extends Command
|
||||
{
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
@@ -28,5 +30,4 @@ class Inspire extends Command {
|
||||
{
|
||||
$this->comment(PHP_EOL.Inspiring::quote().PHP_EOL);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,10 +1,12 @@
|
||||
<?php namespace App\Console;
|
||||
<?php
|
||||
|
||||
namespace App\Console;
|
||||
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||
|
||||
class Kernel extends ConsoleKernel {
|
||||
|
||||
class Kernel extends ConsoleKernel
|
||||
{
|
||||
/**
|
||||
* The Artisan commands provided by your application.
|
||||
*
|
||||
@@ -18,6 +20,7 @@ class Kernel extends ConsoleKernel {
|
||||
* Define the application's command schedule.
|
||||
*
|
||||
* @param \Illuminate\Console\Scheduling\Schedule $schedule
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function schedule(Schedule $schedule)
|
||||
@@ -27,11 +30,9 @@ class Kernel extends ConsoleKernel {
|
||||
|
||||
$schedule->call(function () {
|
||||
|
||||
$user = new User;
|
||||
$user = new User();
|
||||
$user->save();
|
||||
|
||||
})->everyFiveMinutes();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,11 +1,11 @@
|
||||
<?php namespace App\Events;
|
||||
<?php
|
||||
|
||||
use App\Events\Event;
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class ClientTicketForm extends Event {
|
||||
|
||||
class ClientTicketForm extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
public $para1;
|
||||
@@ -21,7 +21,5 @@ class ClientTicketForm extends Event {
|
||||
$this->para3 = $para3;
|
||||
$this->para4 = $para4;
|
||||
$this->para5 = $para5;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,11 +1,11 @@
|
||||
<?php namespace App\Events;
|
||||
<?php
|
||||
|
||||
use App\Events\Event;
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class ClientTicketFormPost extends Event {
|
||||
|
||||
class ClientTicketFormPost extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
public $para1;
|
||||
@@ -21,8 +21,5 @@ class ClientTicketFormPost extends Event {
|
||||
$this->para3 = $para3;
|
||||
$this->para4 = $para4;
|
||||
$this->para5 = $para5;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -1,7 +1,8 @@
|
||||
<?php namespace App\Events;
|
||||
<?php
|
||||
|
||||
abstract class Event {
|
||||
namespace App\Events;
|
||||
|
||||
abstract class Event
|
||||
{
|
||||
//
|
||||
|
||||
}
|
||||
|
@@ -1,11 +1,11 @@
|
||||
<?php namespace App\Events;
|
||||
<?php
|
||||
|
||||
use App\Events\Event;
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class FaveoAfterReply extends Event {
|
||||
|
||||
class FaveoAfterReply extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
public $para1;
|
||||
public $para2;
|
||||
@@ -26,6 +26,4 @@ class FaveoAfterReply extends Event {
|
||||
$this->para4 = $para4;
|
||||
$this->para5 = $para5;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -1,11 +1,11 @@
|
||||
<?php namespace App\Events;
|
||||
<?php
|
||||
|
||||
use App\Events\Event;
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class FormRegisterEvent extends Event {
|
||||
|
||||
class FormRegisterEvent extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
public $para1;
|
||||
@@ -27,5 +27,4 @@ class FormRegisterEvent extends Event {
|
||||
$this->para4 = $para4;
|
||||
$this->para5 = $para5;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,11 +1,11 @@
|
||||
<?php namespace App\Events;
|
||||
<?php
|
||||
|
||||
use App\Events\Event;
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class LoginEvent extends Event {
|
||||
|
||||
class LoginEvent extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
public $para1;
|
||||
public $para2;
|
||||
@@ -26,6 +26,4 @@ class LoginEvent extends Event {
|
||||
$this->para4 = $para4;
|
||||
$this->para5 = $para5;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -1,11 +1,11 @@
|
||||
<?php namespace App\Events;
|
||||
<?php
|
||||
|
||||
use App\Events\Event;
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class PostRegisterEvent extends Event {
|
||||
|
||||
class PostRegisterEvent extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
public $para1;
|
||||
public $para2;
|
||||
@@ -26,5 +26,4 @@ class PostRegisterEvent extends Event {
|
||||
$this->para4 = $para4;
|
||||
$this->para5 = $para5;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,11 +1,11 @@
|
||||
<?php namespace App\Events;
|
||||
<?php
|
||||
|
||||
use App\Events\Event;
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class ReadMailEvent extends Event {
|
||||
|
||||
class ReadMailEvent extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
public $para1;
|
||||
public $para2;
|
||||
@@ -26,6 +26,4 @@ class ReadMailEvent extends Event {
|
||||
$this->para4 = $para4;
|
||||
$this->para5 = $para5;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -1,11 +1,11 @@
|
||||
<?php namespace App\Events;
|
||||
<?php
|
||||
|
||||
use App\Events\Event;
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class TicketBoxHeader extends Event {
|
||||
|
||||
class TicketBoxHeader extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
public $para1;
|
||||
public $para2;
|
||||
@@ -26,5 +26,4 @@ class TicketBoxHeader extends Event {
|
||||
$this->para4 = $para4;
|
||||
$this->para5 = $para5;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,11 +1,11 @@
|
||||
<?php namespace App\Events;
|
||||
<?php
|
||||
|
||||
use App\Events\Event;
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class TicketDetailTable extends Event {
|
||||
|
||||
class TicketDetailTable extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
public $para1;
|
||||
public $para2;
|
||||
@@ -26,5 +26,4 @@ class TicketDetailTable extends Event {
|
||||
$this->para4 = $para4;
|
||||
$this->para5 = $para5;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,11 +1,11 @@
|
||||
<?php namespace App\Events;
|
||||
<?php
|
||||
|
||||
use App\Events\Event;
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class TimeLineFormEvent extends Event {
|
||||
|
||||
class TimeLineFormEvent extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
public $para1;
|
||||
public $para2;
|
||||
@@ -26,5 +26,4 @@ class TimeLineFormEvent extends Event {
|
||||
$this->para4 = $para4;
|
||||
$this->para5 = $para5;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,11 +1,11 @@
|
||||
<?php namespace App\Events;
|
||||
<?php
|
||||
|
||||
use App\Events\Event;
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class Timeline extends Event {
|
||||
|
||||
class Timeline extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
public $para1;
|
||||
@@ -27,5 +27,4 @@ class Timeline extends Event {
|
||||
$this->para4 = $para4;
|
||||
$this->para5 = $para5;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,11 +1,11 @@
|
||||
<?php namespace App\Events;
|
||||
<?php
|
||||
|
||||
use App\Events\Event;
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class TopNavEvent extends Event {
|
||||
|
||||
class TopNavEvent extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
@@ -17,5 +17,4 @@ class TopNavEvent extends Event {
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -8,19 +8,20 @@ use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||
// use App\Http\Controllers\Common\SettingsController;
|
||||
//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.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $dontReport = [
|
||||
'Symfony\Component\HttpKernel\Exception\HttpException'
|
||||
'Symfony\Component\HttpKernel\Exception\HttpException',
|
||||
];
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return type response
|
||||
*/
|
||||
// public function __construct() {
|
||||
@@ -33,9 +34,11 @@ class Handler extends ExceptionHandler {
|
||||
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
|
||||
*
|
||||
* @param \Exception $e
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function report(Exception $e) {
|
||||
public function report(Exception $e)
|
||||
{
|
||||
return parent::report($e);
|
||||
}
|
||||
|
||||
@@ -44,10 +47,11 @@ class Handler extends ExceptionHandler {
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Exception $e
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function render($request, Exception $e) {
|
||||
|
||||
public function render($request, Exception $e)
|
||||
{
|
||||
if ($e instanceof \Tymon\JWTAuth\Exceptions\TokenExpiredException) {
|
||||
return response()->json(['message' => $e->getMessage(), 'code' => $e->getStatusCode()]);
|
||||
//dd($e);
|
||||
@@ -81,13 +85,13 @@ class Handler extends ExceptionHandler {
|
||||
return parent::render($request, $e);
|
||||
}
|
||||
|
||||
protected function renderExceptionWithWhoops(Exception $e) {
|
||||
$whoops = new \Whoops\Run;
|
||||
protected function renderExceptionWithWhoops(Exception $e)
|
||||
{
|
||||
$whoops = new \Whoops\Run();
|
||||
$whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler());
|
||||
|
||||
return new \Illuminate\Http\Response(
|
||||
$whoops->handleException($e), $e->getStatusCode(), $e->getHeaders()
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -3,47 +3,47 @@
|
||||
namespace App\Http\Controllers\Admin\helpdesk;
|
||||
|
||||
// controller
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Controllers\Common\SettingsController;
|
||||
use App\Http\Controllers\Common\PhpMailController;
|
||||
use App\Http\Controllers\Common\SettingsController;
|
||||
use App\Http\Controllers\Controller;
|
||||
// request
|
||||
use App\Http\Requests\helpdesk\AgentRequest;
|
||||
use App\Http\Requests\helpdesk\AgentUpdate;
|
||||
// model
|
||||
use App\User;
|
||||
use App\Model\helpdesk\Agent\Assign_team_agent;
|
||||
use App\Model\helpdesk\Agent\Department;
|
||||
use App\Model\helpdesk\Agent\Groups;
|
||||
use App\Model\helpdesk\Agent\Teams;
|
||||
use App\Model\helpdesk\Utility\Timezones;
|
||||
use App\Model\helpdesk\Email\Emails;
|
||||
use App\Model\helpdesk\Settings\Company;
|
||||
use App\Model\helpdesk\Settings\Email;
|
||||
use App\Model\helpdesk\Email\Emails;
|
||||
use App\Model\helpdesk\Utility\Timezones;
|
||||
use App\User;
|
||||
// classes
|
||||
use DB;
|
||||
use Mail;
|
||||
use Hash;
|
||||
use Exception;
|
||||
use Hash;
|
||||
use Mail;
|
||||
|
||||
/**
|
||||
* AgentController
|
||||
* This controller is used to CRUD category
|
||||
* This controller is used to CRUD category.
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class AgentController extends Controller {
|
||||
|
||||
class AgentController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* constructor to check
|
||||
* 1. authentication
|
||||
* 2. user roles
|
||||
* 3. roles must be agent
|
||||
* 3. roles must be agent.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(PhpMailController $PhpMailController) {
|
||||
public function __construct(PhpMailController $PhpMailController)
|
||||
{
|
||||
$this->PhpMailController = $PhpMailController;
|
||||
SettingsController::smtp();
|
||||
// checking authentication
|
||||
@@ -53,11 +53,14 @@ class AgentController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all agent list page
|
||||
* Get all agent list page.
|
||||
*
|
||||
* @param type User $user
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function index() {
|
||||
public function index()
|
||||
{
|
||||
try {
|
||||
return view('themes.default1.admin.helpdesk.agent.agents.index');
|
||||
} 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 Timezones $timezone
|
||||
* @param type Groups $group
|
||||
* @param type Department $department
|
||||
* @param type Teams $team
|
||||
*
|
||||
* @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 {
|
||||
$team = $team->get();
|
||||
$timezones = $timezone->get();
|
||||
$groups = $group->get();
|
||||
$departments = $department->get();
|
||||
$teams = $team->lists('id', 'name');
|
||||
|
||||
return view('themes.default1.admin.helpdesk.agent.agents.create', compact('assign', 'teams', 'agents', 'timezones', 'groups', 'departments', 'team'));
|
||||
} catch (Exception $e) {
|
||||
return 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 Assign_team_agent $team_assign_agent
|
||||
*
|
||||
* @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());
|
||||
|
||||
@@ -120,6 +130,7 @@ class AgentController extends Controller {
|
||||
} 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('success', 'Agent Created sucessfully');
|
||||
} else {
|
||||
return redirect('agents')->with('fails', 'Agent can not Create');
|
||||
@@ -127,7 +138,8 @@ class AgentController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Editing a selected agent
|
||||
* Editing a selected agent.
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type User $user
|
||||
* @param type Assign_team_agent $team_assign_agent
|
||||
@@ -135,9 +147,11 @@ class AgentController extends Controller {
|
||||
* @param type Groups $group
|
||||
* @param type Department $department
|
||||
* @param type Teams $team
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function edit($id, User $user, Assign_team_agent $team_assign_agent, Timezones $timezone, Groups $group, Department $department, Teams $team) {
|
||||
public function edit($id, User $user, Assign_team_agent $team_assign_agent, Timezones $timezone, Groups $group, Department $department, Teams $team)
|
||||
{
|
||||
try {
|
||||
$user = $user->whereId($id)->first();
|
||||
$team = $team->get();
|
||||
@@ -148,6 +162,7 @@ class AgentController extends Controller {
|
||||
$table = $team_assign_agent->where('agent_id', $id)->first();
|
||||
$teams = $team->lists('id', 'name');
|
||||
$assign = $team_assign_agent->where('agent_id', $id)->lists('team_id');
|
||||
|
||||
return view('themes.default1.admin.helpdesk.agent.agents.edit', compact('teams', 'assign', 'table', 'teams1', 'selectedTeams', 'user', 'timezones', 'groups', 'departments', 'team', 'exp', 'counted'));
|
||||
} catch (Exception $e) {
|
||||
return redirect('agents')->with('fail', 'No such file');
|
||||
@@ -156,13 +171,16 @@ class AgentController extends Controller {
|
||||
|
||||
/**
|
||||
* Update the specified agent in storage.
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type User $user
|
||||
* @param type AgentUpdate $request
|
||||
* @param type Assign_team_agent $team_assign_agent
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function update($id, User $user, AgentUpdate $request, Assign_team_agent $team_assign_agent) {
|
||||
public function update($id, User $user, AgentUpdate $request, Assign_team_agent $team_assign_agent)
|
||||
{
|
||||
|
||||
// storing all the details
|
||||
$user = $user->whereId($id)->first();
|
||||
@@ -181,6 +199,7 @@ class AgentController extends Controller {
|
||||
//Todo For success and failure conditions
|
||||
try {
|
||||
$user->fill($request->except('daylight_save', 'limit_access', 'directory_listing', 'vocation_mode', 'assign_team'))->save();
|
||||
|
||||
return redirect('agents')->with('success', 'Agent Updated sucessfully');
|
||||
} catch (Exception $e) {
|
||||
return redirect('agents')->with('fails', 'Agent did not update'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
@@ -189,12 +208,15 @@ class AgentController extends Controller {
|
||||
|
||||
/**
|
||||
* Remove the specified agent from storage.
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type User $user
|
||||
* @param type Assign_team_agent $team_assign_agent
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function destroy($id, User $user, Assign_team_agent $team_assign_agent) {
|
||||
public function destroy($id, User $user, Assign_team_agent $team_assign_agent)
|
||||
{
|
||||
/* Becouse of foreign key we delete team_assign_agent first */
|
||||
error_reporting(E_ALL & ~E_NOTICE);
|
||||
$team_assign_agent = $team_assign_agent->where('agent_id', $id);
|
||||
@@ -205,43 +227,52 @@ class AgentController extends Controller {
|
||||
$user->id;
|
||||
$user->delete();
|
||||
throw new \Exception($error);
|
||||
|
||||
return redirect('agents')->with('success', 'Agent Deleted sucessfully');
|
||||
} catch (\Exception $e) {
|
||||
dd($e->errorInfo);
|
||||
|
||||
return redirect('agents')->with('fails', $error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a random string for password
|
||||
* Generate a random string for password.
|
||||
*
|
||||
* @param type $length
|
||||
*
|
||||
* @return type string
|
||||
*/
|
||||
public function generateRandomString($length = 10) {
|
||||
public function generateRandomString($length = 10)
|
||||
{
|
||||
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
$charactersLength = strlen($characters);
|
||||
$randomString = '';
|
||||
for ($i = 0; $i < $length; $i++) {
|
||||
$randomString .= $characters[rand(0, $charactersLength - 1)];
|
||||
}
|
||||
|
||||
return $randomString;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetching comapny name to send mail
|
||||
* Fetching comapny name to send mail.
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function company() {
|
||||
public function company()
|
||||
{
|
||||
$company = Company::Where('id', '=', '1')->first();
|
||||
if ($company->company_name == null) {
|
||||
$company = "Support Center";
|
||||
$company = 'Support Center';
|
||||
} else {
|
||||
$company = $company->company_name;
|
||||
}
|
||||
|
||||
return $company;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* System default email
|
||||
*/
|
||||
// public function system_mail() {
|
||||
|
@@ -8,29 +8,30 @@ use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\helpdesk\BanlistRequest;
|
||||
use App\Http\Requests\helpdesk\BanRequest;
|
||||
// model
|
||||
use App\User;
|
||||
use App\Model\helpdesk\Email\Banlist;
|
||||
use App\User;
|
||||
//classes
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* BanlistController
|
||||
* In this controller in the CRUD function for all the banned emails
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* In this controller in the CRUD function for all the banned emails.
|
||||
*
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class BanlistController extends Controller {
|
||||
|
||||
class BanlistController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* constructor to check
|
||||
* 1. authentication
|
||||
* 2. user roles
|
||||
* 3. roles must be agent
|
||||
* 3. roles must be agent.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
// checking authentication
|
||||
$this->middleware('auth');
|
||||
// checking admin roles
|
||||
@@ -39,12 +40,16 @@ class BanlistController extends Controller {
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @param type Banlist $ban
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function index() {
|
||||
public function index()
|
||||
{
|
||||
try {
|
||||
$bans = User::where('ban', '=', 1)->get();
|
||||
|
||||
return view('themes.default1.admin.helpdesk.emails.banlist.index', compact('bans'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
@@ -53,9 +58,11 @@ class BanlistController extends Controller {
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function create() {
|
||||
public function create()
|
||||
{
|
||||
try {
|
||||
return view('themes.default1.admin.helpdesk.emails.banlist.create');
|
||||
} catch (Exception $e) {
|
||||
@@ -65,12 +72,15 @@ class BanlistController extends Controller {
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param type banlist $ban
|
||||
* @param type BanRequest $request
|
||||
* @param type User $user
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function store(BanRequest $request, User $user) {
|
||||
public function store(BanRequest $request, User $user)
|
||||
{
|
||||
// dd($request);
|
||||
try {
|
||||
//adding field to user whether it is banned or not
|
||||
@@ -83,11 +93,12 @@ class BanlistController extends Controller {
|
||||
// $user->create($request->input())->save();
|
||||
return redirect('banlist')->with('success', 'Email Banned sucessfully');
|
||||
} else {
|
||||
$user = new User;
|
||||
$user = new User();
|
||||
$user->email = $adban;
|
||||
$user->ban = $request->input('ban');
|
||||
$user->internal_note = $request->input('internal_note');
|
||||
$user->save();
|
||||
|
||||
return redirect('banlist')->with('success', 'Email Banned sucessfully');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
@@ -99,21 +110,27 @@ class BanlistController extends Controller {
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function show($id) {
|
||||
public function show($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type Banlist $ban
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function edit($id, User $ban) {
|
||||
public function edit($id, User $ban)
|
||||
{
|
||||
try {
|
||||
$bans = $ban->whereId($id)->first();
|
||||
|
||||
return view('themes.default1.admin.helpdesk.emails.banlist.edit', compact('bans'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
@@ -122,12 +139,15 @@ class BanlistController extends Controller {
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type Banlist $ban
|
||||
* @param type BanlistRequest $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function update($id, User $ban, BanlistRequest $request) {
|
||||
public function update($id, User $ban, BanlistRequest $request)
|
||||
{
|
||||
try {
|
||||
$bans = $ban->whereId($id)->first();
|
||||
$bans->internal_note = $request->input('internal_note');
|
||||
@@ -143,7 +163,7 @@ class BanlistController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Remove the specified resource from storage.
|
||||
* @param type int $id
|
||||
* @param type Banlist $ban
|
||||
|
@@ -9,46 +9,50 @@ use App\Http\Requests\helpdesk\DepartmentRequest;
|
||||
use App\Http\Requests\helpdesk\DepartmentUpdate;
|
||||
// model
|
||||
use App\Model\helpdesk\Agent\Department;
|
||||
use App\Model\helpdesk\Agent\Groups;
|
||||
use App\Model\helpdesk\Agent\Group_assign_department;
|
||||
use App\Model\helpdesk\Agent\Groups;
|
||||
use App\Model\helpdesk\Agent\Teams;
|
||||
use App\Model\helpdesk\Email\Emails;
|
||||
use App\Model\helpdesk\Email\Template;
|
||||
use App\Model\helpdesk\Manage\Help_topic;
|
||||
use App\Model\helpdesk\Manage\Sla_plan;
|
||||
use App\Model\helpdesk\Settings\System;
|
||||
use App\Model\helpdesk\Ticket\Tickets;
|
||||
use App\Model\helpdesk\Manage\Help_topic;
|
||||
use App\User;
|
||||
// classes
|
||||
use DB;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* DepartmentController
|
||||
* DepartmentController.
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class DepartmentController extends Controller {
|
||||
|
||||
class DepartmentController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
$this->middleware('roles');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get index page
|
||||
* Get index page.
|
||||
*
|
||||
* @param type Department $department
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function index(Department $department) {
|
||||
public function index(Department $department)
|
||||
{
|
||||
try {
|
||||
$departments = $department->get();
|
||||
|
||||
return view('themes.default1.admin.helpdesk.agent.departments.index', compact('departments'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
@@ -57,6 +61,7 @@ class DepartmentController extends Controller {
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @param type User $user
|
||||
* @param type Group_assign_department $group_assign_department
|
||||
* @param type Department $department
|
||||
@@ -64,9 +69,11 @@ class DepartmentController extends Controller {
|
||||
* @param type Template $template
|
||||
* @param type Emails $email
|
||||
* @param type Groups $group
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function create(User $user, Group_assign_department $group_assign_department, Department $department, Sla_plan $sla, Template $template, Emails $email, Groups $group) {
|
||||
public function create(User $user, Group_assign_department $group_assign_department, Department $department, Sla_plan $sla, Template $template, Emails $email, Groups $group)
|
||||
{
|
||||
try {
|
||||
$slas = $sla->get();
|
||||
$user = $user->where('role', 'agent')->get();
|
||||
@@ -74,6 +81,7 @@ class DepartmentController extends Controller {
|
||||
$templates = $template->get();
|
||||
$department = $department->get();
|
||||
$groups = $group->lists('id', 'name');
|
||||
|
||||
return view('themes.default1.admin.helpdesk.agent.departments.create', compact('department', 'templates', 'slas', 'user', 'emails', 'groups'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
@@ -82,11 +90,14 @@ class DepartmentController extends Controller {
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param type Department $department
|
||||
* @param type DepartmentRequest $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function store(Department $department, DepartmentRequest $request) {
|
||||
public function store(Department $department, DepartmentRequest $request)
|
||||
{
|
||||
try {
|
||||
$department->fill($request->except('group_id', 'manager'))->save();
|
||||
$requests = $request->input('group_id');
|
||||
@@ -113,6 +124,7 @@ class DepartmentController extends Controller {
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type User $user
|
||||
* @param type Group_assign_department $group_assign_department
|
||||
@@ -122,9 +134,11 @@ class DepartmentController extends Controller {
|
||||
* @param type Sla_plan $sla
|
||||
* @param type Emails $email
|
||||
* @param type Groups $group
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function edit($id, User $user, Group_assign_department $group_assign_department, Template $template, Teams $team, Department $department, Sla_plan $sla, Emails $email, Groups $group) {
|
||||
public function edit($id, User $user, Group_assign_department $group_assign_department, Template $template, Teams $team, Department $department, Sla_plan $sla, Emails $email, Groups $group)
|
||||
{
|
||||
try {
|
||||
$slas = $sla->get();
|
||||
$user = $user->where('role', 'agent')->get();
|
||||
@@ -133,6 +147,7 @@ class DepartmentController extends Controller {
|
||||
$departments = $department->whereId($id)->first();
|
||||
$groups = $group->lists('id', 'name');
|
||||
$assign = $group_assign_department->where('department_id', $id)->lists('group_id');
|
||||
|
||||
return view('themes.default1.admin.helpdesk.agent.departments.edit', compact('assign', 'team', 'templates', 'departments', 'slas', 'user', 'emails', 'groups'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
@@ -141,13 +156,16 @@ class DepartmentController extends Controller {
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type Group_assign_department $group_assign_department
|
||||
* @param type Department $department
|
||||
* @param type DepartmentUpdate $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function update($id, Group_assign_department $group_assign_department, Department $department, DepartmentUpdate $request) {
|
||||
public function update($id, Group_assign_department $group_assign_department, Department $department, DepartmentUpdate $request)
|
||||
{
|
||||
// dd($id);
|
||||
try {
|
||||
$table = $group_assign_department->where('department_id', $id);
|
||||
@@ -177,12 +195,15 @@ class DepartmentController extends Controller {
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type Department $department
|
||||
* @param type Group_assign_department $group_assign_department
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function destroy($id, Department $department, Group_assign_department $group_assign_department, System $system, Tickets $tickets) {
|
||||
public function destroy($id, Department $department, Group_assign_department $group_assign_department, System $system, Tickets $tickets)
|
||||
{
|
||||
// try {
|
||||
$system = $system->where('id', '=', '1')->first();
|
||||
if ($system->department == $id) {
|
||||
@@ -191,41 +212,41 @@ class DepartmentController extends Controller {
|
||||
$tickets = DB::table('tickets')->where('dept_id', '=', $id)->update(['dept_id' => $system->department]);
|
||||
if ($tickets > 0) {
|
||||
if ($tickets > 1) {
|
||||
$text_tickets = "Tickets";
|
||||
$text_tickets = 'Tickets';
|
||||
} else {
|
||||
$text_tickets = "Ticket";
|
||||
$text_tickets = 'Ticket';
|
||||
}
|
||||
$ticket = '<li>'.$tickets.' '.$text_tickets.' have been moved to default department</li>';
|
||||
} else {
|
||||
$ticket = "";
|
||||
$ticket = '';
|
||||
}
|
||||
$users = DB::table('users')->where('primary_dpt', '=', $id)->update(['primary_dpt' => $system->department]);
|
||||
if ($users > 0) {
|
||||
if ($users > 1) {
|
||||
$text_user = "Users";
|
||||
$text_user = 'Users';
|
||||
} else {
|
||||
$text_user = "User";
|
||||
$text_user = 'User';
|
||||
}
|
||||
$user = '<li>'.$users.' '.$text_user.' have been moved to default department</li>';
|
||||
} else {
|
||||
$user = "";
|
||||
$user = '';
|
||||
}
|
||||
$emails = DB::table('emails')->where('department', '=', $id)->update(['department' => $system->department]);
|
||||
if ($emails > 0) {
|
||||
if ($emails > 1) {
|
||||
$text_emails = "Emails";
|
||||
$text_emails = 'Emails';
|
||||
} else {
|
||||
$text_emails = "Email";
|
||||
$text_emails = 'Email';
|
||||
}
|
||||
$email = '<li>'.$emails.' System '.$text_emails.' have been moved to default department</li>';
|
||||
} else {
|
||||
$email = "";
|
||||
$email = '';
|
||||
}
|
||||
$helptopic = DB::table('help_topic')->where('department', '=', $id)->update(['department' => null], ['status' => '1']);
|
||||
if ($helptopic > 0) {
|
||||
$helptopic = '<li>The associated helptopic has been deactivated</li>';
|
||||
} else {
|
||||
$helptopic = "";
|
||||
$helptopic = '';
|
||||
}
|
||||
$message = $ticket.$user.$email.$helptopic;
|
||||
/* Becouse of foreign key we delete group_assign_department first */
|
||||
@@ -240,5 +261,4 @@ class DepartmentController extends Controller {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -11,39 +11,43 @@ use App\Http\Requests\helpdesk\EmailsRequest;
|
||||
use App\Model\helpdesk\Agent\Department;
|
||||
use App\Model\helpdesk\Email\Emails;
|
||||
use App\Model\helpdesk\Manage\Help_topic;
|
||||
use App\Model\helpdesk\Utility\MailboxProtocol;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Priority;
|
||||
use App\Model\helpdesk\Settings\Email;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Priority;
|
||||
use App\Model\helpdesk\Utility\MailboxProtocol;
|
||||
// classes
|
||||
use Crypt;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* EmailsController
|
||||
* EmailsController.
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class EmailsController extends Controller {
|
||||
|
||||
class EmailsController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
$this->middleware('roles');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @param type Emails $emails
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function index(Emails $emails) {
|
||||
public function index(Emails $emails)
|
||||
{
|
||||
try {
|
||||
$emails = $emails->get();
|
||||
|
||||
return view('themes.default1.admin.helpdesk.emails.emails.index', compact('emails'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
@@ -52,18 +56,22 @@ class EmailsController extends Controller {
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @param type Department $department
|
||||
* @param type Help_topic $help
|
||||
* @param type Priority $priority
|
||||
* @param type MailboxProtocol $mailbox_protocol
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function create(Department $department, Help_topic $help, Ticket_Priority $priority, MailboxProtocol $mailbox_protocol) {
|
||||
public function create(Department $department, Help_topic $help, Ticket_Priority $priority, MailboxProtocol $mailbox_protocol)
|
||||
{
|
||||
try {
|
||||
$departments = $department->get();
|
||||
$helps = $help->get();
|
||||
$priority = $priority->get();
|
||||
$mailbox_protocols = $mailbox_protocol->get();
|
||||
|
||||
return view('themes.default1.admin.helpdesk.emails.emails.create', compact('mailbox_protocols', 'priority', 'departments', 'helps'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
@@ -72,11 +80,14 @@ class EmailsController extends Controller {
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param type Emails $email
|
||||
* @param type EmailsRequest $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function store(Emails $email, EmailsRequest $request) {
|
||||
public function store(Emails $email, EmailsRequest $request)
|
||||
{
|
||||
try {
|
||||
$password = $request->input('password');
|
||||
$encrypted = Crypt::encrypt($password);
|
||||
@@ -116,29 +127,35 @@ class EmailsController extends Controller {
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function show($id) {
|
||||
public function show($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type Department $department
|
||||
* @param type Help_topic $help
|
||||
* @param type Emails $email
|
||||
* @param type Priority $priority
|
||||
* @param type MailboxProtocol $mailbox_protocol
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function edit($id, Department $department, Help_topic $help, Emails $email, Ticket_Priority $priority, MailboxProtocol $mailbox_protocol) {
|
||||
public function edit($id, Department $department, Help_topic $help, Emails $email, Ticket_Priority $priority, MailboxProtocol $mailbox_protocol)
|
||||
{
|
||||
try {
|
||||
$emails = $email->whereId($id)->first();
|
||||
$departments = $department->get();
|
||||
$helps = $help->get();
|
||||
$priority = $priority->get();
|
||||
$mailbox_protocols = $mailbox_protocol->get();
|
||||
|
||||
return view('themes.default1.admin.helpdesk.emails.emails.edit', compact('mailbox_protocols', 'priority', 'departments', 'helps', 'emails'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
@@ -147,12 +164,15 @@ class EmailsController extends Controller {
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param type $id
|
||||
* @param type Emails $email
|
||||
* @param type EmailsEditRequest $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function update($id, Emails $email, EmailsEditRequest $request) {
|
||||
public function update($id, Emails $email, EmailsEditRequest $request)
|
||||
{
|
||||
$password = $request->input('password');
|
||||
$encrypted = Crypt::encrypt($password);
|
||||
//echo $encrypted;
|
||||
@@ -179,6 +199,7 @@ class EmailsController extends Controller {
|
||||
}
|
||||
$emails->password = $encrypted;
|
||||
$emails->save();
|
||||
|
||||
return redirect('emails')->with('success', 'Email Updated sucessfully');
|
||||
} catch (Exception $e) {
|
||||
return redirect('emails')->with('fails', 'Email not updated');
|
||||
@@ -187,11 +208,14 @@ class EmailsController extends Controller {
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type Emails $email
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function destroy($id, Emails $email) {
|
||||
public function destroy($id, Emails $email)
|
||||
{
|
||||
$default_system_email = Email::where('id', '=', '1')->first();
|
||||
if ($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 ');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -13,58 +13,66 @@ use Illuminate\Http\Request;
|
||||
// Class
|
||||
use Input;
|
||||
use Redirect;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* 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>
|
||||
*/
|
||||
class FormController extends Controller {
|
||||
|
||||
class FormController extends Controller
|
||||
{
|
||||
private $fields;
|
||||
private $forms;
|
||||
|
||||
public function __construct(Fields $fields, Forms $forms) {
|
||||
public function __construct(Fields $fields, Forms $forms)
|
||||
{
|
||||
$this->fields = $fields;
|
||||
$this->forms = $forms;
|
||||
// $this->middleware('auth');
|
||||
}
|
||||
|
||||
/**
|
||||
* home
|
||||
* home.
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function home() {
|
||||
public function home()
|
||||
{
|
||||
return view('forms.home');
|
||||
}
|
||||
|
||||
/**
|
||||
* list of forms
|
||||
* list of forms.
|
||||
*
|
||||
* @param type Forms $forms
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function index(Forms $forms) {
|
||||
public function index(Forms $forms)
|
||||
{
|
||||
return view('themes.default1.admin.helpdesk.manage.form.index', compact('forms'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function create() {
|
||||
public function create()
|
||||
{
|
||||
return view('themes.default1.admin.helpdesk.manage.form.form');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function show($id) {
|
||||
public function show($id)
|
||||
{
|
||||
return view('themes.default1.admin.helpdesk.manage.form.preview', compact('id'));
|
||||
}
|
||||
|
||||
@@ -73,13 +81,14 @@ class FormController extends Controller {
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function store(Forms $forms) {
|
||||
public function store(Forms $forms)
|
||||
{
|
||||
if (!Input::get('formname')) {
|
||||
return Redirect::back()->with('fails', 'Please fill Form name');
|
||||
}
|
||||
$required = Input::get('required');
|
||||
$count = count($required);
|
||||
$require = array();
|
||||
$require = [];
|
||||
for ($i = 2; $i < $count + 2; $i++) {
|
||||
for ($j = 0; $j < 1; $j++) {
|
||||
array_push($require, $required[$i][$j]);
|
||||
@@ -88,24 +97,26 @@ class FormController extends Controller {
|
||||
$forms->formname = Input::get('formname');
|
||||
$forms->save();
|
||||
$count = count(Input::get('name'));
|
||||
$fields = array();
|
||||
$fields = [];
|
||||
for ($i = 0; $i <= $count; $i++) {
|
||||
if (!empty(Input::get('name')[$i])) {
|
||||
array_push($fields, array(
|
||||
array_push($fields, [
|
||||
'forms_id' => $forms->id,
|
||||
'label' => Input::get('label')[$i],
|
||||
'name' => Input::get('name')[$i],
|
||||
'type' => Input::get('type')[$i],
|
||||
'value' => Input::get('value')[$i],
|
||||
'required' => $require[$i],
|
||||
));
|
||||
]);
|
||||
}
|
||||
}
|
||||
Fields::insert($fields);
|
||||
|
||||
return Redirect::back()->with('success', 'Successfully created Form');
|
||||
}
|
||||
|
||||
public function delete($id, Forms $forms, Fields $field, Help_topic $help_topic) {
|
||||
public function delete($id, Forms $forms, Fields $field, Help_topic $help_topic)
|
||||
{
|
||||
$fields = $field->where('forms_id', $id)->get();
|
||||
$help_topics = $help_topic->where('custom_form', '=', $id)->get();
|
||||
foreach ($help_topics as $help_topic) {
|
||||
@@ -117,7 +128,7 @@ class FormController extends Controller {
|
||||
}
|
||||
$forms = $forms->where('id', $id)->first();
|
||||
$forms->delete();
|
||||
|
||||
return redirect()->back()->with('success', 'Deleted Successfully');
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -6,45 +6,49 @@ namespace App\Http\Controllers\Admin\helpdesk;
|
||||
use App\Http\Controllers\Controller;
|
||||
// requests
|
||||
use App\Http\Requests\helpdesk\GroupRequest;
|
||||
use Illuminate\Http\Request;
|
||||
// models
|
||||
use App\Model\helpdesk\Agent\Department;
|
||||
use App\Model\helpdesk\Agent\Groups;
|
||||
// models
|
||||
use App\Model\helpdesk\Agent\Group_assign_department;
|
||||
use App\Model\helpdesk\Agent\Groups;
|
||||
use App\User;
|
||||
// classes
|
||||
use Illuminate\Support\Facades\Input;
|
||||
use Exception;
|
||||
// classes
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Input;
|
||||
|
||||
/**
|
||||
* GroupController
|
||||
* GroupController.
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class GroupController extends Controller {
|
||||
|
||||
class GroupController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return type void
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
$this->middleware('roles');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @param type Groups $group
|
||||
* @param type Department $department
|
||||
* @param type Group_assign_department $group_assign_department
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function index(Groups $group, Department $department, Group_assign_department $group_assign_department) {
|
||||
public function index(Groups $group, Department $department, Group_assign_department $group_assign_department)
|
||||
{
|
||||
try {
|
||||
$groups = $group->get();
|
||||
$departments = $department->lists('id');
|
||||
|
||||
return view('themes.default1.admin.helpdesk.agent.groups.index', compact('departments', 'group_assign_department', 'groups'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
@@ -53,9 +57,11 @@ class GroupController extends Controller {
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function create() {
|
||||
public function create()
|
||||
{
|
||||
try {
|
||||
return view('themes.default1.admin.helpdesk.agent.groups.create');
|
||||
} catch (Exception $e) {
|
||||
@@ -65,14 +71,18 @@ class GroupController extends Controller {
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param type Groups $group
|
||||
* @param type GroupRequest $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function store(Groups $group, GroupRequest $request) {
|
||||
public function store(Groups $group, GroupRequest $request)
|
||||
{
|
||||
try {
|
||||
/* Check Whether function success or not */
|
||||
$group->fill($request->input())->save();
|
||||
|
||||
return redirect('groups')->with('success', 'Group Created Successfully');
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
@@ -82,13 +92,17 @@ class GroupController extends Controller {
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type Groups $group
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function edit($id, Groups $group) {
|
||||
public function edit($id, Groups $group)
|
||||
{
|
||||
try {
|
||||
$groups = $group->whereId($id)->first();
|
||||
|
||||
return view('themes.default1.admin.helpdesk.agent.groups.edit', compact('groups'));
|
||||
} catch (Exception $e) {
|
||||
return redirect('groups')->with('fails', 'Groups can not Create'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
@@ -97,12 +111,15 @@ class GroupController extends Controller {
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type Groups $group
|
||||
* @param type Request $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function update($id, Groups $group, Request $request) {
|
||||
public function update($id, Groups $group, Request $request)
|
||||
{
|
||||
$var = $group->whereId($id)->first();
|
||||
//Updating Status
|
||||
$status = $request->Input('group_status');
|
||||
@@ -159,15 +176,19 @@ class GroupController extends Controller {
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type Groups $group
|
||||
* @param type Group_assign_department $group_assign_department
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function destroy($id, Groups $group, Group_assign_department $group_assign_department) {
|
||||
public function destroy($id, Groups $group, Group_assign_department $group_assign_department)
|
||||
{
|
||||
$users = User::where('assign_group', '=', $id)->first();
|
||||
if ($users) {
|
||||
$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);
|
||||
}
|
||||
$group_assign_department->where('group_id', $id)->delete();
|
||||
@@ -182,5 +203,4 @@ class GroupController extends Controller {
|
||||
return redirect('groups')->with('fails', 'Groups cannot Create'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -13,39 +13,43 @@ use App\Model\helpdesk\Agent\Department;
|
||||
use App\Model\helpdesk\Form\Forms;
|
||||
use App\Model\helpdesk\Manage\Help_topic;
|
||||
use App\Model\helpdesk\Manage\Sla_plan;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Priority;
|
||||
use App\Model\helpdesk\Settings\Ticket;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Priority;
|
||||
use App\User;
|
||||
// classes
|
||||
use DB;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* HelptopicController
|
||||
* HelptopicController.
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class HelptopicController extends Controller {
|
||||
|
||||
class HelptopicController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return type vodi
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
$this->middleware('roles');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @param type Help_topic $topic
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function index(Help_topic $topic) {
|
||||
public function index(Help_topic $topic)
|
||||
{
|
||||
try {
|
||||
$topics = $topic->get();
|
||||
|
||||
return view('themes.default1.admin.helpdesk.manage.helptopic.index', compact('topics'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
@@ -54,12 +58,14 @@ class HelptopicController extends Controller {
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @param type Priority $priority
|
||||
* @param type Department $department
|
||||
* @param type Help_topic $topic
|
||||
* @param type Form_name $form
|
||||
* @param type Agents $agent
|
||||
* @param type Sla_plan $sla
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
/*
|
||||
@@ -72,7 +78,8 @@ class HelptopicController extends Controller {
|
||||
| 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 {
|
||||
$departments = $department->get();
|
||||
$topics = $topic->get();
|
||||
@@ -80,6 +87,7 @@ class HelptopicController extends Controller {
|
||||
$agents = $agent->where('role', '=', 'agent')->get();
|
||||
$slas = $sla->get();
|
||||
$priority = $priority->get();
|
||||
|
||||
return view('themes.default1.admin.helpdesk.manage.helptopic.create', compact('priority', 'departments', 'topics', 'forms', 'agents', 'slas'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
@@ -88,11 +96,14 @@ class HelptopicController extends Controller {
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param type Help_topic $topic
|
||||
* @param type HelptopicRequest $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function store(Help_topic $topic, HelptopicRequest $request) {
|
||||
public function store(Help_topic $topic, HelptopicRequest $request)
|
||||
{
|
||||
try {
|
||||
if ($request->custom_form) {
|
||||
$custom_form = $request->custom_form;
|
||||
@@ -117,6 +128,7 @@ class HelptopicController extends Controller {
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param type $id
|
||||
* @param type Priority $priority
|
||||
* @param type Department $department
|
||||
@@ -124,9 +136,11 @@ class HelptopicController extends Controller {
|
||||
* @param type Form_name $form
|
||||
* @param type Agents $agent
|
||||
* @param type Sla_plan $sla
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function edit($id, Ticket_Priority $priority, Department $department, Help_topic $topic, Forms $form, Sla_plan $sla) {
|
||||
public function edit($id, Ticket_Priority $priority, Department $department, Help_topic $topic, Forms $form, Sla_plan $sla)
|
||||
{
|
||||
try {
|
||||
$agents = User::where('role', '=', 'agent')->get();
|
||||
$departments = $department->get();
|
||||
@@ -134,6 +148,7 @@ class HelptopicController extends Controller {
|
||||
$forms = $form->get();
|
||||
$slas = $sla->get();
|
||||
$priority = $priority->get();
|
||||
|
||||
return view('themes.default1.admin.helpdesk.manage.helptopic.edit', compact('priority', 'departments', 'topics', 'forms', 'agents', 'slas'));
|
||||
} catch (Exception $e) {
|
||||
return redirect('helptopic')->with('fails', '<li>'.$e->errorInfo[2].'</li>');
|
||||
@@ -142,12 +157,15 @@ class HelptopicController extends Controller {
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param type $id
|
||||
* @param type Help_topic $topic
|
||||
* @param type HelptopicUpdate $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function update($id, Help_topic $topic, HelptopicUpdate $request) {
|
||||
public function update($id, Help_topic $topic, HelptopicUpdate $request)
|
||||
{
|
||||
// dd($request);
|
||||
try {
|
||||
$topics = $topic->whereId($id)->first();
|
||||
@@ -176,40 +194,42 @@ class HelptopicController extends Controller {
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type Help_topic $topic
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function destroy($id, Help_topic $topic, Ticket $ticket_setting) {
|
||||
public function destroy($id, Help_topic $topic, Ticket $ticket_setting)
|
||||
{
|
||||
$ticket_settings = $ticket_setting->where('id', '=', '1')->first();
|
||||
if ($ticket_settings->help_topic == $id) {
|
||||
return redirect('departments')->with('fails', 'You cannot delete default department');
|
||||
} else {
|
||||
|
||||
$tickets = DB::table('tickets')->where('help_topic_id', '=', $id)->update(['help_topic_id' => $ticket_settings->help_topic]);
|
||||
|
||||
if ($tickets > 0) {
|
||||
if ($tickets > 1) {
|
||||
$text_tickets = "Tickets";
|
||||
$text_tickets = 'Tickets';
|
||||
} else {
|
||||
$text_tickets = "Ticket";
|
||||
$text_tickets = 'Ticket';
|
||||
}
|
||||
$ticket = '<li>'.$tickets.' '.$text_tickets.' have been moved to default Help Topic</li>';
|
||||
} else {
|
||||
$ticket = "";
|
||||
$ticket = '';
|
||||
}
|
||||
|
||||
$emails = DB::table('emails')->where('help_topic', '=', $id)->update(['help_topic' => $ticket_settings->help_topic]);
|
||||
|
||||
if ($emails > 0) {
|
||||
if ($emails > 1) {
|
||||
$text_emails = "Emails";
|
||||
$text_emails = 'Emails';
|
||||
} else {
|
||||
$text_emails = "Email";
|
||||
$text_emails = 'Email';
|
||||
}
|
||||
$email = '<li>'.$emails.' System '.$text_emails.' have been moved to default Help Topic</li>';
|
||||
} else {
|
||||
$email = "";
|
||||
$email = '';
|
||||
}
|
||||
|
||||
$message = $ticket.$email;
|
||||
@@ -226,5 +246,4 @@ class HelptopicController extends Controller {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -10,17 +10,17 @@ namespace App\Http\Controllers\Admin\helpdesk;
|
||||
* are authenticated. Of course, you are free to change or remove the
|
||||
* controller as you wish. It is just here to get your app started!
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class HomeController extends Controller {
|
||||
|
||||
class HomeController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
}
|
||||
|
||||
@@ -29,8 +29,8 @@ class HomeController extends Controller {
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function index() {
|
||||
public function index()
|
||||
{
|
||||
return view('themes/default1/admin/dashboard');
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -3,49 +3,49 @@
|
||||
namespace App\Http\Controllers\Admin\helpdesk;
|
||||
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
use App;
|
||||
// requests
|
||||
use App\Http\Requests;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
//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\Session;
|
||||
use Illuminate\Support\Collection;
|
||||
//classes
|
||||
use Input;
|
||||
use Config;
|
||||
use Validator;
|
||||
use Zipper;
|
||||
use App;
|
||||
use Lang;
|
||||
use Cache;
|
||||
use File;
|
||||
use Exception;
|
||||
use Validator;
|
||||
|
||||
/**
|
||||
* SlaController
|
||||
* SlaController.
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class LanguageController extends Controller {
|
||||
|
||||
class LanguageController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return type void
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
$this->middleware('roles');
|
||||
}
|
||||
|
||||
/**
|
||||
* Switch language at runtime
|
||||
* Switch language at runtime.
|
||||
*
|
||||
* @param type "" $lang
|
||||
*
|
||||
* @return type response
|
||||
*/
|
||||
public function switchLanguage($lang) {
|
||||
public function switchLanguage($lang)
|
||||
{
|
||||
//if(Cache::has('language'))
|
||||
//{
|
||||
// return Cache::get('language');
|
||||
@@ -60,32 +60,39 @@ class LanguageController extends Controller {
|
||||
// dd(Cache::get('language'));
|
||||
// dd()
|
||||
} else {
|
||||
return Redirect::back()->with('fails', Lang::get("lang.language-error"));
|
||||
return Redirect::back()->with('fails', Lang::get('lang.language-error'));
|
||||
}
|
||||
|
||||
return Redirect::back();
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows language page
|
||||
* Shows language page.
|
||||
*
|
||||
* @return type response
|
||||
*/
|
||||
public function index() {
|
||||
public function index()
|
||||
{
|
||||
return view('themes.default1.admin.helpdesk.language.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows Language upload form
|
||||
* Shows Language upload form.
|
||||
*
|
||||
* @return type response
|
||||
*/
|
||||
public function getForm() {
|
||||
public function getForm()
|
||||
{
|
||||
return view('themes.default1.admin.helpdesk.language.create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Provide language datatable to language page
|
||||
* Provide language datatable to language page.
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function getLanguages() {
|
||||
public function getLanguages()
|
||||
{
|
||||
$path = base_path('resources/lang');
|
||||
$values = scandir($path); //Extracts names of directories present in lang directory
|
||||
$values = array_slice($values, 2); // skips array element $value[0] = '.' & $value[1] = '..'
|
||||
@@ -98,17 +105,18 @@ class LanguageController extends Controller {
|
||||
})
|
||||
->addColumn('status', function ($model) {
|
||||
if (Lang::getLocale() === $model) {
|
||||
return "<span style='color:green'>" . Lang::trans("lang.active") . "</span>";
|
||||
} else
|
||||
return "<span style='color:red'>" . Lang::trans("lang.inactive") . "</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>";
|
||||
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>";
|
||||
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')
|
||||
@@ -116,23 +124,25 @@ class LanguageController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* handle language file uploading
|
||||
* handle language file uploading.
|
||||
*
|
||||
* @return response
|
||||
*/
|
||||
public function postForm() {
|
||||
public function postForm()
|
||||
{
|
||||
// getting all of the post data
|
||||
$file = array(
|
||||
$file = [
|
||||
'File' => Input::file('File'),
|
||||
'language-name' => Input::input('language-name'),
|
||||
'iso-code' => Input::input('iso-code')
|
||||
);
|
||||
'iso-code' => Input::input('iso-code'),
|
||||
];
|
||||
|
||||
// setting up rules
|
||||
$rules = array(
|
||||
$rules = [
|
||||
'File' => 'required|mimes:zip|max:30000',
|
||||
'language-name' => 'required',
|
||||
'iso-code' => 'required|max:2'
|
||||
); // and for max size
|
||||
'iso-code' => 'required|max:2',
|
||||
]; // and for max size
|
||||
// doing the validation, passing post data, rules and the messages
|
||||
$validator = Validator::make($file, $rules);
|
||||
if ($validator->fails()) {
|
||||
@@ -141,18 +151,19 @@ class LanguageController extends Controller {
|
||||
return Redirect::back()->withInput()->withErrors($validator);
|
||||
} else {
|
||||
|
||||
|
||||
//Checking if package already exists or not in lang folder
|
||||
$path = base_path('resources/lang');
|
||||
if (in_array(strtolower(Input::get('iso-code')), scandir($path))) {
|
||||
|
||||
//sending back with error message
|
||||
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();
|
||||
} elseif (!array_key_exists(strtolower(Input::get('iso-code')), Config::get('languages'))) {//Checking Valid ISO code form Languages.php
|
||||
//sending back with error message
|
||||
Session::flash('fails', Lang::get('lang.iso-code-error'));
|
||||
|
||||
return Redirect::back()->withInput();
|
||||
} else {
|
||||
|
||||
@@ -174,18 +185,21 @@ class LanguageController extends Controller {
|
||||
if ($success) {
|
||||
//sending back with error message
|
||||
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();
|
||||
}
|
||||
} else {
|
||||
// sending back with success message
|
||||
Session::flash('success', Lang::get("lang.upload-success"));
|
||||
Session::flash('link', "change-language/" . strtolower(Input::get('iso-code')));
|
||||
Session::flash('success', Lang::get('lang.upload-success'));
|
||||
Session::flash('link', 'change-language/'.strtolower(Input::get('iso-code')));
|
||||
|
||||
return Redirect::route('LanguageController');
|
||||
}
|
||||
} else {
|
||||
// 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');
|
||||
}
|
||||
}
|
||||
@@ -193,36 +207,43 @@ class LanguageController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* allow user to download language template file
|
||||
* allow user to download language template file.
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
Public function download() {
|
||||
public function download()
|
||||
{
|
||||
return response()->download('../public/downloads/en.zip');
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is used to delete languages
|
||||
* This function is used to delete languages.
|
||||
*
|
||||
* @param type $lang
|
||||
*
|
||||
* @return type response
|
||||
*/
|
||||
public function deleteLanguage($lang) {
|
||||
public function deleteLanguage($lang)
|
||||
{
|
||||
if ($lang !== App::getLocale()) {
|
||||
$deletePath = base_path('resources/lang').$lang; //define file path to delete
|
||||
$success = File::deleteDirectory($deletePath); //remove extracted folder and it's subfolder from lang
|
||||
if ($success) {
|
||||
//sending back with success message
|
||||
Session::flash('success', Lang::get('lang.delete-success'));
|
||||
|
||||
return Redirect::back();
|
||||
} else {
|
||||
//sending back with error message
|
||||
Session::flash('fails', Lang::get('lang.lang-doesnot-exist'));
|
||||
|
||||
return Redirect::back();
|
||||
}
|
||||
} else {
|
||||
//sending back with error message
|
||||
Session::flash('fails', Lang::get('lang.active-lang-error'));
|
||||
|
||||
return redirect('languages');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -11,33 +11,35 @@ use App\Http\Requests\ProfileRequest;
|
||||
use App\User;
|
||||
// classes
|
||||
use Auth;
|
||||
use Exception;
|
||||
use Hash;
|
||||
use Input;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* ProfileController
|
||||
* ProfileController.
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class ProfileController extends Controller {
|
||||
|
||||
class ProfileController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return type void
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
$this->middleware('roles');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get profile page
|
||||
* Get profile page.
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function getProfile() {
|
||||
public function getProfile()
|
||||
{
|
||||
try {
|
||||
$user = Auth::user();
|
||||
if ($user) {
|
||||
@@ -51,10 +53,12 @@ class ProfileController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get profile Edit page
|
||||
* Get profile Edit page.
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function getProfileedit() {
|
||||
public function getProfileedit()
|
||||
{
|
||||
try {
|
||||
$user = Auth::user();
|
||||
if ($user) {
|
||||
@@ -68,12 +72,15 @@ class ProfileController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Post profile page
|
||||
* Post profile page.
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type ProfileRequest $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function postProfile($id, ProfileRequest $request) {
|
||||
public function postProfile($id, ProfileRequest $request)
|
||||
{
|
||||
$user = Auth::user();
|
||||
$user->gender = $request->input('gender');
|
||||
$user->save();
|
||||
@@ -98,6 +105,7 @@ class ProfileController extends Controller {
|
||||
$user->profile_pic = $fileName;
|
||||
} else {
|
||||
$user->fill($request->except('profile_pic', 'gender'))->save();
|
||||
|
||||
return redirect('guest')->with('success', 'Profile Updated sucessfully');
|
||||
}
|
||||
if ($user->fill($request->except('profile_pic'))->save()) {
|
||||
@@ -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 ProfilePassword $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function postProfilePassword($id, User $user, ProfilePassword $request) {
|
||||
public function postProfilePassword($id, User $user, ProfilePassword $request)
|
||||
{
|
||||
$user = Auth::user();
|
||||
//echo $user->password;
|
||||
if (Hash::check($request->input('old_password'), $user->getAuthPassword())) {
|
||||
$user->password = Hash::make($request->input('new_password'));
|
||||
$user->save();
|
||||
|
||||
return redirect('guest')->with('success', 'Password Updated sucessfully');
|
||||
} else {
|
||||
return redirect('guest')->with('fails', 'Password was not Updated');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -21,51 +21,55 @@ use App\Model\helpdesk\Settings\Email;
|
||||
use App\Model\helpdesk\Settings\Responder;
|
||||
use App\Model\helpdesk\Settings\System;
|
||||
use App\Model\helpdesk\Settings\Ticket;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Priority;
|
||||
use App\Model\helpdesk\Utility\Date_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\Timezones;
|
||||
// classes
|
||||
use Exception;
|
||||
use Illuminate\Http\Request;
|
||||
use Input;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* SettingsController
|
||||
* SettingsController.
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class SettingsController extends Controller {
|
||||
|
||||
class SettingsController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
// $this->smtp();
|
||||
$this->middleware('auth');
|
||||
$this->middleware('roles');
|
||||
}
|
||||
|
||||
/**
|
||||
* Main Settings Page
|
||||
* Main Settings Page.
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function settings() {
|
||||
public function settings()
|
||||
{
|
||||
return view('themes.default1.admin.helpdesk.setting');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
* @return Response
|
||||
* @param $compant instance of company table
|
||||
*
|
||||
* get the form for company setting page
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function getcompany(Company $company) {
|
||||
public function getcompany(Company $company)
|
||||
{
|
||||
try {
|
||||
/* fetch the values of company from company table */
|
||||
$companys = $company->whereId('1')->first();
|
||||
@@ -78,12 +82,15 @@ class SettingsController extends Controller {
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type Company $company
|
||||
* @param type CompanyRequest $request
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function postcompany($id, Company $company, CompanyRequest $request) {
|
||||
public function postcompany($id, Company $company, CompanyRequest $request)
|
||||
{
|
||||
/* fetch the values of company request */
|
||||
$companys = $company->whereId('1')->first();
|
||||
if (Input::file('logo')) {
|
||||
@@ -108,16 +115,19 @@ class SettingsController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* get the form for System setting page
|
||||
* get the form for System setting page.
|
||||
*
|
||||
* @param type System $system
|
||||
* @param type Department $department
|
||||
* @param type Timezones $timezone
|
||||
* @param type Date_format $date
|
||||
* @param type Date_time_format $date_time
|
||||
* @param type Time_format $time
|
||||
*
|
||||
* @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 {
|
||||
/* fetch the values of system from system table */
|
||||
$systems = $system->whereId('1')->first();
|
||||
@@ -134,12 +144,15 @@ class SettingsController extends Controller {
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type System $system
|
||||
* @param type SystemRequest $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function postsystem($id, System $system, SystemRequest $request) {
|
||||
public function postsystem($id, System $system, SystemRequest $request)
|
||||
{
|
||||
try {
|
||||
// dd($request);
|
||||
/* fetch the values of system request */
|
||||
@@ -156,14 +169,17 @@ class SettingsController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 Help_topic $topic
|
||||
* @param type Priority $priority
|
||||
*
|
||||
* @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 {
|
||||
/* fetch the values of ticket from ticket table */
|
||||
$tickets = $ticket->whereId('1')->first();
|
||||
@@ -180,12 +196,15 @@ class SettingsController extends Controller {
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type Ticket $ticket
|
||||
* @param type Request $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function postticket($id, Ticket $ticket, Request $request) {
|
||||
public function postticket($id, Ticket $ticket, Request $request)
|
||||
{
|
||||
try {
|
||||
/* fetch the values of ticket request */
|
||||
$tickets = $ticket->whereId('1')->first();
|
||||
@@ -211,13 +230,16 @@ class SettingsController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* get the form for Email setting page
|
||||
* get the form for Email setting page.
|
||||
*
|
||||
* @param type Email $email
|
||||
* @param type Template $template
|
||||
* @param type Emails $email1
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function getemail(Email $email, Template $template, Emails $email1) {
|
||||
public function getemail(Email $email, Template $template, Emails $email1)
|
||||
{
|
||||
try {
|
||||
/* fetch the values of email from Email table */
|
||||
$emails = $email->whereId('1')->first();
|
||||
@@ -234,12 +256,15 @@ class SettingsController extends Controller {
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type Email $email
|
||||
* @param type EmailRequest $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function postemail($id, Email $email, EmailRequest $request) {
|
||||
public function postemail($id, Email $email, EmailRequest $request)
|
||||
{
|
||||
try {
|
||||
/* fetch the values of email request */
|
||||
$emails = $email->whereId('1')->first();
|
||||
@@ -263,8 +288,10 @@ class SettingsController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* get the form for Access setting page
|
||||
* get the form for Access setting page.
|
||||
*
|
||||
* @param type Access $access
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
// public function getaccess(Access $access) {
|
||||
@@ -280,8 +307,10 @@ class SettingsController extends Controller {
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param type Access $access
|
||||
* @param type Request $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
// 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
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function getresponder(Responder $responder) {
|
||||
public function getresponder(Responder $responder)
|
||||
{
|
||||
try {
|
||||
/* fetch the values of responder from responder table */
|
||||
$responders = $responder->whereId('1')->first();
|
||||
@@ -327,11 +359,14 @@ class SettingsController extends Controller {
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param type Responder $responder
|
||||
* @param type Request $request
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function postresponder(Responder $responder, Request $request) {
|
||||
public function postresponder(Responder $responder, Request $request)
|
||||
{
|
||||
try {
|
||||
/* fetch the values of responder request */
|
||||
$responders = $responder->whereId('1')->first();
|
||||
@@ -353,11 +388,14 @@ class SettingsController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* get the form for Alert setting page
|
||||
* get the form for Alert setting page.
|
||||
*
|
||||
* @param type Alert $alert
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function getalert(Alert $alert) {
|
||||
public function getalert(Alert $alert)
|
||||
{
|
||||
try {
|
||||
/* fetch the values of alert from alert table */
|
||||
$alerts = $alert->whereId('1')->first();
|
||||
@@ -370,12 +408,15 @@ class SettingsController extends Controller {
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param type $id
|
||||
* @param type Alert $alert
|
||||
* @param type Request $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function postalert($id, Alert $alert, Request $request) {
|
||||
public function postalert($id, Alert $alert, Request $request)
|
||||
{
|
||||
try {
|
||||
/* fetch the values of alert request */
|
||||
$alerts = $alert->whereId('1')->first();
|
||||
@@ -435,33 +476,41 @@ class SettingsController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* To display the list of ratings in the system
|
||||
* To display the list of ratings in the system.
|
||||
*
|
||||
* @return type View
|
||||
*/
|
||||
public function RatingSettings() {
|
||||
public function RatingSettings()
|
||||
{
|
||||
$ratings = DB::table('settings_ratings')->get();
|
||||
|
||||
return view('themes.default1.admin.helpdesk.settings.ratings', compact('ratings'));
|
||||
}
|
||||
|
||||
/**
|
||||
* To store rating data
|
||||
* To store rating data.
|
||||
*
|
||||
* @return type Redirect
|
||||
*/
|
||||
public function PostRatingSettings($slug) {
|
||||
public function PostRatingSettings($slug)
|
||||
{
|
||||
$name = Input::get('rating_name');
|
||||
$publish = Input::get('publish');
|
||||
$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');
|
||||
}
|
||||
|
||||
/**
|
||||
* To delete a type of rating
|
||||
* To delete a type of rating.
|
||||
*
|
||||
* @return type Redirect
|
||||
*/
|
||||
public function RatingDelete($slug) {
|
||||
public function RatingDelete($slug)
|
||||
{
|
||||
DB::table('settings_ratings')->whereSlug($slug)->delete();
|
||||
|
||||
return redirect()->back()->with('success', 'Successfully Deleted');
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -15,29 +15,32 @@ use DB;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* SlaController
|
||||
* SlaController.
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class SlaController extends Controller {
|
||||
|
||||
class SlaController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return type void
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
$this->middleware('roles');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @param type Sla_plan $sla
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function index(Sla_plan $sla) {
|
||||
public function index(Sla_plan $sla)
|
||||
{
|
||||
try {
|
||||
/* Declare a Variable $slas to store all Values From Sla_plan Table */
|
||||
$slas = $sla->get();
|
||||
@@ -50,9 +53,11 @@ class SlaController extends Controller {
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function create() {
|
||||
public function create()
|
||||
{
|
||||
try {
|
||||
/* Direct to Create Page */
|
||||
return view('themes.default1.admin.helpdesk.manage.sla.create');
|
||||
@@ -63,11 +68,14 @@ class SlaController extends Controller {
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param type Sla_plan $sla
|
||||
* @param type SlaRequest $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function store(Sla_plan $sla, SlaRequest $request) {
|
||||
public function store(Sla_plan $sla, SlaRequest $request)
|
||||
{
|
||||
try {
|
||||
/* Fill the request values to Sla_plan Table */
|
||||
/* Check whether function success or not */
|
||||
@@ -82,15 +90,19 @@ class SlaController extends Controller {
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type Sla_plan $sla
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function edit($id, Sla_plan $sla) {
|
||||
public function edit($id, Sla_plan $sla)
|
||||
{
|
||||
try {
|
||||
/* Direct to edit page along values of perticular field using Id */
|
||||
$slas = $sla->whereId($id)->first();
|
||||
$slas->get();
|
||||
|
||||
return view('themes.default1.admin.helpdesk.manage.sla.edit', compact('slas'));
|
||||
} catch (Exception $e) {
|
||||
return redirect()->back()->with('fails', $e->errorInfo[2]);
|
||||
@@ -99,12 +111,15 @@ class SlaController extends Controller {
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type Sla_plan $sla
|
||||
* @param type SlaUpdate $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function update($id, Sla_plan $sla, SlaUpdate $request) {
|
||||
public function update($id, Sla_plan $sla, SlaUpdate $request)
|
||||
{
|
||||
try {
|
||||
/* Fill values to selected field using Id except Check box */
|
||||
$slas = $sla->whereId($id)->first();
|
||||
@@ -125,11 +140,14 @@ class SlaController extends Controller {
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type Sla_plan $sla
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function destroy($id, Sla_plan $sla) {
|
||||
public function destroy($id, Sla_plan $sla)
|
||||
{
|
||||
$default_sla = Ticket::where('id', '=', '1')->first();
|
||||
if ($default_sla->sla == $id) {
|
||||
return redirect('departments')->with('fails', 'You cannot delete default department');
|
||||
@@ -137,35 +155,35 @@ class SlaController extends Controller {
|
||||
$tickets = DB::table('tickets')->where('sla', '=', $id)->update(['sla' => $default_sla->sla]);
|
||||
if ($tickets > 0) {
|
||||
if ($tickets > 1) {
|
||||
$text_tickets = "Tickets";
|
||||
$text_tickets = 'Tickets';
|
||||
} else {
|
||||
$text_tickets = "Ticket";
|
||||
$text_tickets = 'Ticket';
|
||||
}
|
||||
$ticket = '<li>'.$tickets.' '.$text_tickets.' have been moved to default SLA</li>';
|
||||
} else {
|
||||
$ticket = "";
|
||||
$ticket = '';
|
||||
}
|
||||
$dept = DB::table('department')->where('sla', '=', $id)->update(['sla' => $default_sla->sla]);
|
||||
if ($dept > 0) {
|
||||
if ($dept > 1) {
|
||||
$text_dept = "Emails";
|
||||
$text_dept = 'Emails';
|
||||
} else {
|
||||
$text_dept = "Email";
|
||||
$text_dept = 'Email';
|
||||
}
|
||||
$dept = '<li>Associated department have been moved to default SLA</li>';
|
||||
} else {
|
||||
$dept = "";
|
||||
$dept = '';
|
||||
}
|
||||
$topic = DB::table('help_topic')->where('sla_plan', '=', $id)->update(['sla_plan' => $default_sla->sla]);
|
||||
if ($topic > 0) {
|
||||
if ($topic > 1) {
|
||||
$text_topic = "Emails";
|
||||
$text_topic = 'Emails';
|
||||
} else {
|
||||
$text_topic = "Email";
|
||||
$text_topic = 'Email';
|
||||
}
|
||||
$topic = '<li>Associated Help Topic have been moved to default SLA</li>';
|
||||
} else {
|
||||
$topic = "";
|
||||
$topic = '';
|
||||
}
|
||||
$message = $ticket.$dept.$topic;
|
||||
/* Delete a perticular field from the database by delete() using Id */
|
||||
@@ -181,5 +199,4 @@ class SlaController extends Controller {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -16,35 +16,39 @@ use DB;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* TeamController
|
||||
* TeamController.
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class TeamController extends Controller {
|
||||
|
||||
class TeamController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return type void
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
$this->middleware('roles');
|
||||
}
|
||||
|
||||
/**
|
||||
* get Index page
|
||||
* get Index page.
|
||||
*
|
||||
* @param type Teams $team
|
||||
* @param type Assign_team_agent $assign_team_agent
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function index(Teams $team, Assign_team_agent $assign_team_agent) {
|
||||
public function index(Teams $team, Assign_team_agent $assign_team_agent)
|
||||
{
|
||||
try {
|
||||
$teams = $team->get();
|
||||
/* find out the Number of Members in the Team */
|
||||
$id = $teams->lists('id');
|
||||
$assign_team_agent = $assign_team_agent->get();
|
||||
|
||||
return view('themes.default1.admin.helpdesk.agent.teams.index', compact('assign_team_agent', 'teams'));
|
||||
} catch (Exception $e) {
|
||||
return redirect()->back()->with('fails', $e->errorInfo[2]);
|
||||
@@ -53,12 +57,16 @@ class TeamController extends Controller {
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @param type User $user
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function create(User $user) {
|
||||
public function create(User $user)
|
||||
{
|
||||
try {
|
||||
$user = $user->get();
|
||||
|
||||
return view('themes.default1.admin.helpdesk.agent.teams.create', compact('user'));
|
||||
} catch (Exception $e) {
|
||||
return redirect()->back()->with('fails', $e->errorInfo[2]);
|
||||
@@ -67,12 +75,14 @@ class TeamController extends Controller {
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param type Teams $team
|
||||
* @param type TeamRequest $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function store(Teams $team, TeamRequest $request) {
|
||||
|
||||
public function store(Teams $team, TeamRequest $request)
|
||||
{
|
||||
if ($request->team_lead) {
|
||||
$team_lead = $request->team_lead;
|
||||
} else {
|
||||
@@ -92,18 +102,22 @@ class TeamController extends Controller {
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param type $id
|
||||
* @param type User $user
|
||||
* @param type Assign_team_agent $assign_team_agent
|
||||
* @param type Teams $team
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function edit($id, User $user, Assign_team_agent $assign_team_agent, Teams $team) {
|
||||
public function edit($id, User $user, Assign_team_agent $assign_team_agent, Teams $team)
|
||||
{
|
||||
try {
|
||||
$user = $user->whereId($id)->first();
|
||||
$teams = $team->whereId($id)->first();
|
||||
$agent_team = $assign_team_agent->where('team_id', $id)->get();
|
||||
$agent_id = $agent_team->lists('agent_id', 'agent_id');
|
||||
|
||||
return view('themes.default1.admin.helpdesk.agent.teams.edit', compact('agent_id', 'user', 'teams', 'allagents'));
|
||||
} catch (Exception $e) {
|
||||
return redirect()->back()->with('fails', $e->errorInfo[2]);
|
||||
@@ -112,13 +126,15 @@ class TeamController extends Controller {
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type Teams $team
|
||||
* @param type TeamUpdate $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function update($id, Teams $team, TeamUpdate $request) {
|
||||
|
||||
public function update($id, Teams $team, TeamUpdate $request)
|
||||
{
|
||||
$teams = $team->whereId($id)->first();
|
||||
//updating check box
|
||||
if ($request->team_lead) {
|
||||
@@ -146,12 +162,15 @@ class TeamController extends Controller {
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type Teams $team
|
||||
* @param type Assign_team_agent $assign_team_agent
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function destroy($id, Teams $team, Assign_team_agent $assign_team_agent) {
|
||||
public function destroy($id, Teams $team, Assign_team_agent $assign_team_agent)
|
||||
{
|
||||
try {
|
||||
$assign_team_agent->where('team_id', $id)->delete();
|
||||
$teams = $team->whereId($id)->first();
|
||||
@@ -165,5 +184,4 @@ class TeamController extends Controller {
|
||||
return redirect('teams')->with('fails', 'Teams can not Delete'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -3,9 +3,9 @@
|
||||
namespace App\Http\Controllers\Admin\helpdesk;
|
||||
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Controllers\Common\SettingsController;
|
||||
use App\Http\Controllers\Common\PhpMailController;
|
||||
use App\Http\Controllers\Common\SettingsController;
|
||||
use App\Http\Controllers\Controller;
|
||||
// requests
|
||||
use App\Http\Requests\helpdesk\TemplateRequest;
|
||||
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\Utility\Languages;
|
||||
// classes
|
||||
use Illuminate\Http\Request;
|
||||
use Mail;
|
||||
use Exception;
|
||||
use Illuminate\Http\Request;
|
||||
use Input;
|
||||
use Mail;
|
||||
|
||||
/**
|
||||
* TemplateController
|
||||
* TemplateController.
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class TemplateController extends Controller {
|
||||
|
||||
class TemplateController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return type void
|
||||
*/
|
||||
public function __construct(PhpMailController $PhpMailController) {
|
||||
public function __construct(PhpMailController $PhpMailController)
|
||||
{
|
||||
$this->PhpMailController = $PhpMailController;
|
||||
SettingsController::smtp();
|
||||
$this->middleware('auth');
|
||||
@@ -41,12 +41,16 @@ class TemplateController extends Controller {
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @param type Template $template
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function index(Template $template) {
|
||||
public function index(Template $template)
|
||||
{
|
||||
try {
|
||||
$templates = $template->get();
|
||||
|
||||
return view('themes.default1.admin.helpdesk.emails.template.index', compact('templates'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
@@ -55,14 +59,18 @@ class TemplateController extends Controller {
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @param type Languages $language
|
||||
* @param type Template $template
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function create(Languages $language, Template $template) {
|
||||
public function create(Languages $language, Template $template)
|
||||
{
|
||||
try {
|
||||
$templates = $template->get();
|
||||
$languages = $language->get();
|
||||
|
||||
return view('themes.default1.admin.helpdesk.emails.template.create', compact('languages', 'templates'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
@@ -71,11 +79,14 @@ class TemplateController extends Controller {
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param type Template $template
|
||||
* @param type TemplateRequest $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function store(Template $template, TemplateRequest $request) {
|
||||
public function store(Template $template, TemplateRequest $request)
|
||||
{
|
||||
try {
|
||||
/* Check whether function success or not */
|
||||
if ($template->fill($request->input())->save() == true) {
|
||||
@@ -93,46 +104,57 @@ class TemplateController extends Controller {
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function show($id) {
|
||||
public function show($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param type $id
|
||||
* @param type Template $template
|
||||
* @param type Languages $language
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function listdirectories() {
|
||||
public function listdirectories()
|
||||
{
|
||||
$path = '../resources/views/emails/';
|
||||
$directories = scandir($path);
|
||||
$directory = str_replace('/', '-', $path);
|
||||
|
||||
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);
|
||||
$directory2 = $paths.$template;
|
||||
|
||||
$templates = scandir($directory2);
|
||||
$directory = str_replace('/', '-', $directory2.'/');
|
||||
|
||||
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);
|
||||
$handle = fopen($directory . $template, "r");
|
||||
$handle = fopen($directory.$template, 'r');
|
||||
$contents = fread($handle, filesize($directory.$template));
|
||||
fclose($handle);
|
||||
|
||||
return view('themes.default1.admin.helpdesk.emails.template.readtemplates', compact('contents', 'template', 'path'));
|
||||
}
|
||||
|
||||
public function createtemplate() {
|
||||
public function createtemplate()
|
||||
{
|
||||
$directory = '../resources/views/emails/';
|
||||
$fname = Input::get('folder_name');
|
||||
$filename = $directory.$fname;
|
||||
@@ -150,8 +172,9 @@ class TemplateController extends Controller {
|
||||
$files = array_filter(scandir($directory.'default'));
|
||||
|
||||
foreach ($files as $file) {
|
||||
if ($file === '.' or $file === '..')
|
||||
if ($file === '.' or $file === '..') {
|
||||
continue;
|
||||
}
|
||||
if (!is_dir($file)) {
|
||||
// $file_to_go = str_replace("code/resources/views/emails/",'code/resources/views/emails/'.$fname,$file);
|
||||
$destination = $directory.$fname.'/';
|
||||
@@ -159,18 +182,22 @@ class TemplateController extends Controller {
|
||||
copy($directory.'default/'.$file, $destination.$file);
|
||||
}
|
||||
}
|
||||
|
||||
return \Redirect::back()->with('success', 'Successfully copied');
|
||||
}
|
||||
|
||||
public function writetemplate($template, $path) {
|
||||
public function writetemplate($template, $path)
|
||||
{
|
||||
$directory = str_replace('-', '/', $path);
|
||||
$b = Input::get('templatedata');
|
||||
|
||||
file_put_contents($directory.$template, print_r($b, true));
|
||||
|
||||
return \Redirect::back()->with('success', 'Successfully updated');
|
||||
}
|
||||
|
||||
public function deletetemplate($template, $path) {
|
||||
public function deletetemplate($template, $path)
|
||||
{
|
||||
$directory = str_replace('-', '/', $path);
|
||||
$dir = $directory.$template;
|
||||
$status = \DB::table('settings_email')->first();
|
||||
@@ -180,26 +207,31 @@ class TemplateController extends Controller {
|
||||
if (is_dir($dir)) {
|
||||
$objects = scandir($dir);
|
||||
foreach ($objects as $object) {
|
||||
if ($object != "." && $object != "..") {
|
||||
unlink($dir . "/" . $object);
|
||||
if ($object != '.' && $object != '..') {
|
||||
unlink($dir.'/'.$object);
|
||||
}
|
||||
}
|
||||
rmdir($dir);
|
||||
} else {
|
||||
rmdir($dir);
|
||||
}
|
||||
|
||||
return \Redirect::back()->with('success', 'Successfully Deleted');
|
||||
}
|
||||
|
||||
public function activateset($setname) {
|
||||
\DB::table('settings_email')->update(array('template' => $setname));
|
||||
public function activateset($setname)
|
||||
{
|
||||
\DB::table('settings_email')->update(['template' => $setname]);
|
||||
|
||||
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 {
|
||||
$templates = $template->whereId($id)->first();
|
||||
$languages = $language->get();
|
||||
|
||||
return view('themes.default1.admin.helpdesk.emails.template.edit', compact('templates', 'languages'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
@@ -208,12 +240,15 @@ class TemplateController extends Controller {
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type Template $template
|
||||
* @param type TemplateUdate $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function update($id, Template $template, TemplateUdate $request) {
|
||||
public function update($id, Template $template, TemplateUdate $request)
|
||||
{
|
||||
try {
|
||||
//TODO validation
|
||||
$templates = $template->whereId($id)->first();
|
||||
@@ -233,11 +268,14 @@ class TemplateController extends Controller {
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type Template $template
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function destroy($id, Template $template) {
|
||||
public function destroy($id, Template $template)
|
||||
{
|
||||
try {
|
||||
$templates = $template->whereId($id)->first();
|
||||
/* Check whether function success or not */
|
||||
@@ -256,12 +294,16 @@ class TemplateController extends Controller {
|
||||
|
||||
/**
|
||||
* Form for Email connection checking.
|
||||
*
|
||||
* @param type Emails $email
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function formDiagno(Emails $email) {
|
||||
public function formDiagno(Emails $email)
|
||||
{
|
||||
try {
|
||||
$emails = $email->get();
|
||||
|
||||
return view('themes.default1.admin.helpdesk.emails.template.formDiagno', compact('emails'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
@@ -269,11 +311,14 @@ class TemplateController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* function to send emails
|
||||
* function to send emails.
|
||||
*
|
||||
* @param type Request $request
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function postDiagno(Request $request) {
|
||||
public function postDiagno(Request $request)
|
||||
{
|
||||
$email = $request->input('to');
|
||||
if ($email == null) {
|
||||
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');
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -11,21 +11,22 @@ use App\Model\helpdesk\Ticket_thread;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* ThreadController
|
||||
* ThreadController.
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @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 Priority $priority
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function getTickets(Ticket_thread $thread, Priority $priority) {
|
||||
public function getTickets(Ticket_thread $thread, Priority $priority)
|
||||
{
|
||||
try {
|
||||
/* get the values of Ticket_thread from Ticket_thread Table */
|
||||
$threads = $thread->get();
|
||||
@@ -37,5 +38,4 @@ class ThreadController extends Controller {
|
||||
return view('404');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -14,25 +14,25 @@ use App\User;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* CannedController
|
||||
* CannedController.
|
||||
*
|
||||
* 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>
|
||||
*/
|
||||
class CannedController extends Controller {
|
||||
|
||||
class CannedController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* constructor to check
|
||||
* 1. authentication
|
||||
* 2. user roles
|
||||
* 3. roles must be agent
|
||||
* 3. roles must be agent.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
// checking authentication
|
||||
$this->middleware('auth');
|
||||
// checking if role is agent
|
||||
@@ -41,27 +41,34 @@ class CannedController extends Controller {
|
||||
|
||||
/**
|
||||
* Display a listing of the Canned Responses.
|
||||
*
|
||||
* @return type View
|
||||
*/
|
||||
public function index() {
|
||||
public function 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
|
||||
*/
|
||||
public function create() {
|
||||
public function create()
|
||||
{
|
||||
return view('themes.default1.agent.helpdesk.canned.create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created Canned Response.
|
||||
*
|
||||
* @param type CannedRequest $request
|
||||
* @param type Canned $canned
|
||||
*
|
||||
* @return type Redirect
|
||||
*/
|
||||
public function store(CannedRequest $request, Canned $canned) {
|
||||
public function store(CannedRequest $request, Canned $canned)
|
||||
{
|
||||
// fetching all the requested inputs
|
||||
$canned->user_id = \Auth::user()->id;
|
||||
$canned->title = $request->input('title');
|
||||
@@ -69,6 +76,7 @@ class CannedController extends Controller {
|
||||
try {
|
||||
// saving inputs
|
||||
$canned->save();
|
||||
|
||||
return redirect()->route('canned.list')->with('success', 'Added Successfully');
|
||||
} catch (Exception $e) {
|
||||
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.
|
||||
*
|
||||
* @param type $id
|
||||
* @param type Canned $canned
|
||||
*
|
||||
* @return type View
|
||||
*/
|
||||
public function edit($id, Canned $canned) {
|
||||
public function edit($id, Canned $canned)
|
||||
{
|
||||
// fetching requested canned response
|
||||
$canned = $canned->where('user_id', '=', \Auth::user()->id)->where('id', '=', $id)->first();
|
||||
|
||||
return view('themes.default1.agent.helpdesk.canned.edit', compact('canned'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the Canned Response in database.
|
||||
*
|
||||
* @param type $id
|
||||
* @param type CannedUpdateRequest $request
|
||||
* @param type Canned $canned
|
||||
*
|
||||
* @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) */
|
||||
$canned = $canned->where('id', '=', $id)->where('user_id', '=', \Auth::user()->id)->first();
|
||||
// fetching all the requested inputs
|
||||
@@ -104,6 +119,7 @@ class CannedController extends Controller {
|
||||
try {
|
||||
// saving inputs
|
||||
$canned->save();
|
||||
|
||||
return redirect()->route('canned.list')->with('success', 'Updated Successfully');
|
||||
} catch (Exception $e) {
|
||||
return redirect()->route('canned.list')->with('fails', $e->errorInfo[2]);
|
||||
@@ -112,11 +128,14 @@ class CannedController extends Controller {
|
||||
|
||||
/**
|
||||
* Delete the Canned Response from storage.
|
||||
*
|
||||
* @param type $id
|
||||
* @param type Canned $canned
|
||||
*
|
||||
* @return type Redirect
|
||||
*/
|
||||
public function destroy($id, Canned $canned) {
|
||||
public function destroy($id, Canned $canned)
|
||||
{
|
||||
/* select the field where id = $id(request Id) */
|
||||
$canned = $canned->whereId($id)->first();
|
||||
/* delete the selected field */
|
||||
@@ -133,20 +152,22 @@ class CannedController extends Controller {
|
||||
|
||||
/**
|
||||
* Fetch Canned Response in the ticket detail page.
|
||||
*
|
||||
* @param type $id
|
||||
*
|
||||
* @return type json
|
||||
*/
|
||||
public function get_canned($id) {
|
||||
public function get_canned($id)
|
||||
{
|
||||
// checking for the canned response with requested value
|
||||
if ($id != "zzz") {
|
||||
if ($id != 'zzz') {
|
||||
// fetching canned response
|
||||
$canned = Canned::where('id', '=', $id)->where('user_id', '=', \Auth::user()->id)->first();
|
||||
$msg = $canned->message;
|
||||
} else {
|
||||
$msg = "";
|
||||
$msg = '';
|
||||
}
|
||||
// returning the canned response in JSON format
|
||||
return \Response::json($msg);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,35 +5,32 @@ namespace App\Http\Controllers\Agent\helpdesk;
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
// models
|
||||
use App\Model\helpdesk\Settings\Company;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Collaborator;
|
||||
use App\Model\helpdesk\Email\Emails;
|
||||
use App\User;
|
||||
// classes
|
||||
use DB;
|
||||
use View;
|
||||
use Auth;
|
||||
use DB;
|
||||
use Exception;
|
||||
use View;
|
||||
|
||||
/**
|
||||
* 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>
|
||||
*/
|
||||
class DashboardController extends Controller {
|
||||
|
||||
class DashboardController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* constructor to check
|
||||
* 1. authentication
|
||||
* 2. user roles
|
||||
* 3. roles must be agent
|
||||
* 3. roles must be agent.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
// checking for authentication
|
||||
$this->middleware('auth');
|
||||
// checking if the role is agent
|
||||
@@ -41,10 +38,12 @@ class DashboardController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the dashboard page
|
||||
* Get the dashboard page.
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function index() {
|
||||
public function index()
|
||||
{
|
||||
// if(Auth::user()->role == "user"){
|
||||
// return \Redirect::route('home');
|
||||
// }
|
||||
@@ -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
|
||||
*/
|
||||
public function ChartData($date111 = "", $date122 = "") {
|
||||
public function ChartData($date111 = '', $date122 = '')
|
||||
{
|
||||
$date11 = strtotime($date122);
|
||||
$date12 = strtotime($date111);
|
||||
if ($date11 && $date12) {
|
||||
@@ -67,14 +68,14 @@ class DashboardController extends Controller {
|
||||
$date1 = $date11;
|
||||
} else {
|
||||
// generating current date
|
||||
$date2 = strtotime(Date('Y-m-d'));
|
||||
$date3 = Date('Y-m-d');
|
||||
$date2 = strtotime(date('Y-m-d'));
|
||||
$date3 = date('Y-m-d');
|
||||
$format = 'Y-m-d';
|
||||
// generating a date range of 1 month
|
||||
$date1 = strtotime(Date($format, strtotime('-1 month' . $date3)));
|
||||
$date1 = strtotime(date($format, strtotime('-1 month'.$date3)));
|
||||
}
|
||||
$return = "";
|
||||
$last = "";
|
||||
$return = '';
|
||||
$last = '';
|
||||
for ($i = $date1; $i <= $date2; $i = $i + 86400) {
|
||||
$thisDate = date('Y-m-d', $i);
|
||||
|
||||
@@ -99,5 +100,4 @@ class DashboardController extends Controller {
|
||||
// ->get();
|
||||
// return $ticketlist;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -3,57 +3,50 @@
|
||||
namespace App\Http\Controllers\Agent\helpdesk;
|
||||
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Controllers\Agent\helpdesk\TicketController;
|
||||
use App;
|
||||
// models
|
||||
use App\User;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Model\helpdesk\Email\Emails;
|
||||
use App\Model\helpdesk\Manage\Help_topic;
|
||||
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\Ticket;
|
||||
use App\Model\helpdesk\Manage\Help_topic;
|
||||
use App\Model\helpdesk\Utility\MailboxProtocol;
|
||||
use App\Model\helpdesk\Ticket\Ticket_attachments;
|
||||
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;
|
||||
// classes
|
||||
use PhpImap\Mailbox as ImapMailbox;
|
||||
use PhpImap\IncomingMail;
|
||||
use PhpImap\IncomingMailAttachment;
|
||||
use \ForceUTF8\Encoding;
|
||||
use App;
|
||||
use DB;
|
||||
use App\Model\helpdesk\Utility\MailboxProtocol;
|
||||
use Crypt;
|
||||
use Schedule;
|
||||
use File;
|
||||
use Artisan;
|
||||
use Exception;
|
||||
use ForceUTF8\Encoding;
|
||||
use PhpImap\Mailbox as ImapMailbox;
|
||||
|
||||
/**
|
||||
* MailController
|
||||
* MailController.
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class MailController extends Controller {
|
||||
|
||||
class MailController extends Controller
|
||||
{
|
||||
/**
|
||||
* constructor
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @param type TicketController $TicketController
|
||||
*/
|
||||
public function __construct(TicketController $TicketController) {
|
||||
public function __construct(TicketController $TicketController)
|
||||
{
|
||||
$this->TicketController = $TicketController;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reademails
|
||||
* Reademails.
|
||||
*
|
||||
* @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;
|
||||
if ($settings_email->first()->email_fetching == 1) {
|
||||
if ($settings_email->first()->all_emails == 1) {
|
||||
@@ -89,8 +82,8 @@ class MailController extends Controller {
|
||||
$imap_config = '{'.$host.':'.$port.$protocol.'}INBOX';
|
||||
$password = Crypt::decrypt($e_mail->password);
|
||||
$mailbox = new ImapMailbox($imap_config, $e_mail->email_address, $password, __DIR__);
|
||||
$mails = array();
|
||||
$mailsIds = $mailbox->searchMailBox('SINCE ' . date('d-M-Y', strtotime("-1 day")));
|
||||
$mails = [];
|
||||
$mailsIds = $mailbox->searchMailBox('SINCE '.date('d-M-Y', strtotime('-1 day')));
|
||||
if (!$mailsIds) {
|
||||
die('Mailbox is empty');
|
||||
}
|
||||
@@ -112,15 +105,15 @@ class MailController extends Controller {
|
||||
}
|
||||
$date = $mail->date;
|
||||
$datetime = $overview[0]->date;
|
||||
$date_time = explode(" ", $datetime);
|
||||
$date = $date_time[1] . "-" . $date_time[2] . "-" . $date_time[3] . " " . $date_time[4];
|
||||
$date_time = explode(' ', $datetime);
|
||||
$date = $date_time[1].'-'.$date_time[2].'-'.$date_time[3].' '.$date_time[4];
|
||||
$date = date('Y-m-d H:i:s', strtotime($date));
|
||||
// dd($date);
|
||||
|
||||
if (isset($mail->subject)) {
|
||||
$subject = $mail->subject;
|
||||
} else {
|
||||
$subject = "No Subject";
|
||||
$subject = 'No Subject';
|
||||
}
|
||||
|
||||
// dd($subject);
|
||||
@@ -128,7 +121,7 @@ class MailController extends Controller {
|
||||
$fromaddress = $mail->fromAddress;
|
||||
$ticket_source = Ticket_source::where('name', '=', 'email')->first();
|
||||
$source = $ticket_source->id;
|
||||
$phone = "";
|
||||
$phone = '';
|
||||
|
||||
$assign = $get_helptopic->auto_assign;
|
||||
$form_data = null;
|
||||
@@ -141,7 +134,7 @@ class MailController extends Controller {
|
||||
$thread_id = $thread_id;
|
||||
|
||||
foreach ($mail->getAttachments() as $attachment) {
|
||||
$support = "support";
|
||||
$support = 'support';
|
||||
// echo $_SERVER['DOCUMENT_ROOT'];
|
||||
$dir_img_paths = __DIR__;
|
||||
$dir_img_path = explode('/code', $dir_img_paths);
|
||||
@@ -159,28 +152,28 @@ class MailController extends Controller {
|
||||
$string = str_replace('-', '', $attachment->name);
|
||||
$filename = explode('src', $attachment->filePath);
|
||||
$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]);
|
||||
|
||||
if ($pos == false) {
|
||||
if ($settings_email->first()->attachment == 1) {
|
||||
$upload = new Ticket_attachments;
|
||||
$upload = new Ticket_attachments();
|
||||
$upload->file = $file_data;
|
||||
$upload->thread_id = $thread_id;
|
||||
$upload->name = $filepath[1];
|
||||
$upload->type = $ext;
|
||||
$upload->size = $filesize;
|
||||
$upload->poster = "ATTACHMENT";
|
||||
$upload->poster = 'ATTACHMENT';
|
||||
$upload->save();
|
||||
}
|
||||
} else {
|
||||
$upload = new Ticket_attachments;
|
||||
$upload = new Ticket_attachments();
|
||||
$upload->file = $file_data;
|
||||
$upload->thread_id = $thread_id;
|
||||
$upload->name = $filepath[1];
|
||||
$upload->type = $ext;
|
||||
$upload->size = $filesize;
|
||||
$upload->poster = "INLINE";
|
||||
$upload->poster = 'INLINE';
|
||||
$upload->save();
|
||||
}
|
||||
unlink($path);
|
||||
@@ -198,35 +191,45 @@ class MailController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* separate reply
|
||||
* separate reply.
|
||||
*
|
||||
* @param type $body
|
||||
*
|
||||
* @return type string
|
||||
*/
|
||||
public function separate_reply($body) {
|
||||
public function separate_reply($body)
|
||||
{
|
||||
$body2 = explode('---Reply above this line---', $body);
|
||||
$body3 = $body2[0];
|
||||
|
||||
return $body3;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode Imap text
|
||||
* Decode Imap text.
|
||||
*
|
||||
* @param type $str
|
||||
*
|
||||
* @return type string
|
||||
*/
|
||||
public function decode_imap_text($str) {
|
||||
public function decode_imap_text($str)
|
||||
{
|
||||
$result = '';
|
||||
$decode_header = imap_mime_header_decode($str);
|
||||
foreach ($decode_header AS $obj) {
|
||||
foreach ($decode_header as $obj) {
|
||||
$result .= htmlspecialchars(rtrim($obj->text, "\t"));
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* fetch_attachments
|
||||
* fetch_attachments.
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function fetch_attachments() {
|
||||
public function fetch_attachments()
|
||||
{
|
||||
$uploads = Upload::all();
|
||||
foreach ($uploads as $attachment) {
|
||||
$image = @imagecreatefromstring($attachment->file);
|
||||
@@ -240,11 +243,14 @@ class MailController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* function to load data
|
||||
* function to load data.
|
||||
*
|
||||
* @param type $id
|
||||
*
|
||||
* @return type file
|
||||
*/
|
||||
public function get_data($id) {
|
||||
public function get_data($id)
|
||||
{
|
||||
$attachments = App\Model\helpdesk\Ticket\Ticket_attachments::where('id', '=', $id)->get();
|
||||
foreach ($attachments as $attachment) {
|
||||
header('Content-type: application/'.$attachment->type.'');
|
||||
@@ -253,5 +259,4 @@ class MailController extends Controller {
|
||||
echo $attachment->file;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,38 +5,35 @@ namespace App\Http\Controllers\Agent\helpdesk;
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
// 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\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\Utility\Log_notification;
|
||||
use App\User;
|
||||
// classes
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* 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>
|
||||
*/
|
||||
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
|
||||
$email = Email::where('id', '=', '1')->first();
|
||||
// checking if the daily notification is enabled or not
|
||||
if ($email->notification_cron == 1) {
|
||||
// checking if current date is equal to the last entered daily notification log
|
||||
$notification = Log_notification::where('log', '=', 'NOT-1')->orderBy('id', 'DESC')->first();
|
||||
$date = explode(" ", $notification->created_at);
|
||||
if (Date('Y-m-d') == $date[0]) {
|
||||
|
||||
$date = explode(' ', $notification->created_at);
|
||||
if (date('Y-m-d') == $date[0]) {
|
||||
} else {
|
||||
// creating a daily notification log
|
||||
Log_notification::create(['log' => 'NOT-1']);
|
||||
@@ -54,17 +51,20 @@ class NotificationController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Admin Notification/Report
|
||||
* Admin Notification/Report.
|
||||
*
|
||||
* @param company
|
||||
*
|
||||
* @return mail
|
||||
* */
|
||||
public function send_notification_to_admin($company) {
|
||||
public function send_notification_to_admin($company)
|
||||
{
|
||||
// get all admin users
|
||||
$users = User::where('role', '=', 'admin')->get();
|
||||
foreach ($users as $user) {
|
||||
// Send notification details to admin
|
||||
$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) {
|
||||
$message->to($email, $user_name)->subject($company.' Daily Report ');
|
||||
});
|
||||
@@ -72,10 +72,12 @@ class NotificationController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Department Manager Notification/Report
|
||||
* Department Manager Notification/Report.
|
||||
*
|
||||
* @return mail
|
||||
* */
|
||||
public function send_notification_to_manager($company) {
|
||||
public function send_notification_to_manager($company)
|
||||
{
|
||||
// get all department managers
|
||||
$depts = Department::all();
|
||||
foreach ($depts as $dept) {
|
||||
@@ -85,7 +87,7 @@ class NotificationController extends Controller {
|
||||
foreach ($users as $user) {
|
||||
// Send notification details to manager of a department
|
||||
$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) {
|
||||
$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
|
||||
* */
|
||||
public function send_notification_to_team_lead($company) {
|
||||
public function send_notification_to_team_lead($company)
|
||||
{
|
||||
// get all Team leads
|
||||
$teams = Teams::all();
|
||||
foreach ($teams as $team) {
|
||||
@@ -108,7 +112,7 @@ class NotificationController extends Controller {
|
||||
foreach ($users as $user) {
|
||||
// Send notification details to team lead
|
||||
$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) {
|
||||
$message->to($email, $user_name)->subject($company.' Daily Report for Team Lead of team '.$team_name);
|
||||
});
|
||||
@@ -118,16 +122,18 @@ class NotificationController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Agent Notification/Report
|
||||
* Agent Notification/Report.
|
||||
*
|
||||
* @return mail
|
||||
* */
|
||||
public function send_notification_to_agent($company) {
|
||||
public function send_notification_to_agent($company)
|
||||
{
|
||||
// get all agents users
|
||||
$users = User::where('role', '=', 'agent')->get();
|
||||
foreach ($users as $user) {
|
||||
// Send notification details to all the agents
|
||||
$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) {
|
||||
$message->to($email, $user_name)->subject($company.' Daily Report for Agents');
|
||||
});
|
||||
@@ -135,18 +141,21 @@ class NotificationController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetching company name
|
||||
* Fetching company name.
|
||||
*
|
||||
* @return type variable
|
||||
*/
|
||||
public function company() {
|
||||
public function company()
|
||||
{
|
||||
// fetching comapny model
|
||||
$company = Company::Where('id', '=', '1')->first();
|
||||
// fetching company name
|
||||
if ($company->company_name == null) {
|
||||
$company = "Support Center";
|
||||
$company = 'Support Center';
|
||||
} else {
|
||||
$company = $company->company_name;
|
||||
}
|
||||
|
||||
return $company;
|
||||
}
|
||||
|
||||
|
@@ -6,13 +6,11 @@ namespace App\Http\Controllers\Agent\helpdesk;
|
||||
use App\Http\Controllers\Controller;
|
||||
// requests
|
||||
use App\Http\Requests\helpdesk\OrganizationRequest;
|
||||
|
||||
/* include organization model */
|
||||
use App\Http\Requests\helpdesk\OrganizationUpdate;
|
||||
// models
|
||||
/* Define OrganizationRequest to validate the create form */
|
||||
use App\Model\helpdesk\Agent_panel\Organization;
|
||||
|
||||
/* Define OrganizationUpdate to validate the create form */
|
||||
use App\Model\helpdesk\Agent_panel\User_org;
|
||||
// classes
|
||||
@@ -22,21 +20,21 @@ use Exception;
|
||||
* OrganizationController
|
||||
* This controller is used to CRUD organization detail.
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class OrganizationController extends Controller {
|
||||
|
||||
class OrganizationController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* constructor to check
|
||||
* 1. authentication
|
||||
* 2. user roles
|
||||
* 3. roles must be agent
|
||||
* 3. roles must be agent.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
// checking for authentication
|
||||
$this->middleware('auth');
|
||||
// checking if the role is agent
|
||||
@@ -45,10 +43,13 @@ class OrganizationController extends Controller {
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @param type Organization $org
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function index() {
|
||||
public function index()
|
||||
{
|
||||
try {
|
||||
/* get all values of table organization */
|
||||
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
|
||||
*/
|
||||
public function org_list() {
|
||||
public function org_list()
|
||||
{
|
||||
// chumper datable package call to display Advance datatable
|
||||
return \Datatable::collection(Organization::all())
|
||||
/* searchable name */
|
||||
@@ -77,16 +80,19 @@ class OrganizationController extends Controller {
|
||||
} else {
|
||||
$orgname = $model->name;
|
||||
}
|
||||
|
||||
return $orgname;
|
||||
})
|
||||
/* column website */
|
||||
->addColumn('website', function ($model) {
|
||||
$website = $model->website;
|
||||
|
||||
return $website;
|
||||
})
|
||||
/* column phone number */
|
||||
->addColumn('phone', function ($model) {
|
||||
$phone = $model->phone;
|
||||
|
||||
return $phone;
|
||||
})
|
||||
/* column action buttons */
|
||||
@@ -117,9 +123,11 @@ class OrganizationController extends Controller {
|
||||
|
||||
/**
|
||||
* Show the form for creating a new organization.
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function create() {
|
||||
public function create()
|
||||
{
|
||||
try {
|
||||
return view('themes.default1.agent.helpdesk.organization.create');
|
||||
} catch (Exception $e) {
|
||||
@@ -129,11 +137,14 @@ class OrganizationController extends Controller {
|
||||
|
||||
/**
|
||||
* Store a newly created organization in storage.
|
||||
*
|
||||
* @param type Organization $org
|
||||
* @param type OrganizationRequest $request
|
||||
*
|
||||
* @return type Redirect
|
||||
*/
|
||||
public function store(Organization $org, OrganizationRequest $request) {
|
||||
public function store(Organization $org, OrganizationRequest $request)
|
||||
{
|
||||
try {
|
||||
/* Insert the all input request to organization table */
|
||||
/* Check whether function success or not */
|
||||
@@ -152,11 +163,14 @@ class OrganizationController extends Controller {
|
||||
|
||||
/**
|
||||
* Display the specified organization.
|
||||
*
|
||||
* @param type $id
|
||||
* @param type Organization $org
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function show($id, Organization $org) {
|
||||
public function show($id, Organization $org)
|
||||
{
|
||||
try {
|
||||
/* select the field by id */
|
||||
$orgs = $org->whereId($id)->first();
|
||||
@@ -169,11 +183,14 @@ class OrganizationController extends Controller {
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified organization.
|
||||
*
|
||||
* @param type $id
|
||||
* @param type Organization $org
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function edit($id, Organization $org) {
|
||||
public function edit($id, Organization $org)
|
||||
{
|
||||
try {
|
||||
/* select the field by id */
|
||||
$orgs = $org->whereId($id)->first();
|
||||
@@ -186,12 +203,15 @@ class OrganizationController extends Controller {
|
||||
|
||||
/**
|
||||
* Update the specified organization in storage.
|
||||
*
|
||||
* @param type $id
|
||||
* @param type Organization $org
|
||||
* @param type OrganizationUpdate $request
|
||||
*
|
||||
* @return type Redirect
|
||||
*/
|
||||
public function update($id, Organization $org, OrganizationUpdate $request) {
|
||||
public function update($id, Organization $org, OrganizationUpdate $request)
|
||||
{
|
||||
|
||||
/* select the field by id */
|
||||
$orgs = $org->whereId($id)->first();
|
||||
@@ -213,10 +233,13 @@ class OrganizationController extends Controller {
|
||||
|
||||
/**
|
||||
* Delete a specified organization from storage.
|
||||
*
|
||||
* @param type int $id
|
||||
*
|
||||
* @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 */
|
||||
$orgs = $org->whereId($id)->first();
|
||||
@@ -237,11 +260,14 @@ class OrganizationController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Soring an organization head
|
||||
* Soring an organization head.
|
||||
*
|
||||
* @param type $id
|
||||
*
|
||||
* @return type boolean
|
||||
*/
|
||||
public function Head_Org($id) {
|
||||
public function Head_Org($id)
|
||||
{
|
||||
// get the user to make organization head
|
||||
$head_user = \Input::get('user');
|
||||
// get an instance of the selected organization
|
||||
@@ -249,7 +275,7 @@ class OrganizationController extends Controller {
|
||||
$org_head->head = $head_user;
|
||||
// save the user to organization head
|
||||
$org_head->save();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -3,56 +3,39 @@
|
||||
namespace App\Http\Controllers\Agent\helpdesk;
|
||||
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Controllers\Agent\helpdesk\TicketController;
|
||||
use App\Http\Controllers\Common\SettingsController;
|
||||
use App\Http\Controllers\Common\SettingsController;use App\Http\Controllers\Controller;
|
||||
// requests
|
||||
use App\Http\Requests\helpdesk\CreateTicketRequest;
|
||||
use App\Http\Requests\helpdesk\TicketRequest;
|
||||
use App\Http\Requests\helpdesk\TicketEditRequest;
|
||||
// models
|
||||
use App\Model\helpdesk\Email\Banlist;
|
||||
use App\Model\helpdesk\Ticket\Tickets;
|
||||
use App\Model\helpdesk\Ticket\Ticket_attachments;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Collaborator;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Thread;
|
||||
use App\Model\helpdesk\Settings\Company;
|
||||
use App\Model\helpdesk\Settings\System;
|
||||
use App\Model\helpdesk\Settings\Alert;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Status;
|
||||
use App\Model\helpdesk\Email\Emails;
|
||||
use App\Model\helpdesk\Agent\Department;
|
||||
use App\User;
|
||||
// classes
|
||||
use Auth;
|
||||
use Hash;
|
||||
use Input;
|
||||
use Mail;
|
||||
use PDF;
|
||||
|
||||
/**
|
||||
* TicketController2
|
||||
* TicketController2.
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class Ticket2Controller extends Controller {
|
||||
|
||||
class Ticket2Controller extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return type response
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
SettingsController::smtp();
|
||||
$this->middleware('auth');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the Inbox ticket list page
|
||||
* Show the Inbox ticket list page.
|
||||
*
|
||||
* @return type response
|
||||
*/
|
||||
public function deptopen($id) {
|
||||
public function deptopen($id)
|
||||
{
|
||||
$dept = Department::where('name', '=', $id)->first();
|
||||
if (Auth::user()->role == 'agent') {
|
||||
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
|
||||
*/
|
||||
public function deptclose($id) {
|
||||
public function deptclose($id)
|
||||
{
|
||||
$dept = Department::where('name', '=', $id)->first();
|
||||
if (Auth::user()->role == 'agent') {
|
||||
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
|
||||
*/
|
||||
public function deptinprogress($id) {
|
||||
public function deptinprogress($id)
|
||||
{
|
||||
$dept = Department::where('name', '=', $id)->first();
|
||||
if (Auth::user()->role == 'agent') {
|
||||
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'));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -19,30 +19,30 @@ use App\Model\helpdesk\Agent_panel\User_org;
|
||||
use App\User;
|
||||
// classes
|
||||
use Auth;
|
||||
use Exception;
|
||||
use Hash;
|
||||
use Input;
|
||||
use Redirect;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* 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>
|
||||
*/
|
||||
class UserController extends Controller {
|
||||
|
||||
class UserController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* constructor to check
|
||||
* 1. authentication
|
||||
* 2. user roles
|
||||
* 3. roles must be agent
|
||||
* 3. roles must be agent.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
// checking authentication
|
||||
$this->middleware('auth');
|
||||
// checking if role is agent
|
||||
@@ -51,10 +51,13 @@ class UserController extends Controller {
|
||||
|
||||
/**
|
||||
* Display all list of the users.
|
||||
*
|
||||
* @param type User $user
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function index() {
|
||||
public function index()
|
||||
{
|
||||
try {
|
||||
/* get all values in Sys_user */
|
||||
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
|
||||
*/
|
||||
public function user_list() {
|
||||
public function user_list()
|
||||
{
|
||||
// displaying list of users with chumper datatables
|
||||
return \Datatable::collection(User::where('role', '!=', 'admin')->where('role', '!=', 'agent')->get())
|
||||
/* searchable column username */
|
||||
@@ -82,24 +87,27 @@ class UserController extends Controller {
|
||||
} else {
|
||||
$username = $model->user_name;
|
||||
}
|
||||
|
||||
return $username;
|
||||
})
|
||||
/* column email */
|
||||
->addColumn('email', function ($model) {
|
||||
$email = $model->email;
|
||||
|
||||
return $email;
|
||||
})
|
||||
/* column phone */
|
||||
->addColumn('phone', function ($model) {
|
||||
$phone = "";
|
||||
$phone = '';
|
||||
if ($model->phone_number) {
|
||||
$phone = $model->ext.' '.$model->phone_number;
|
||||
}
|
||||
$mobile = "";
|
||||
$mobile = '';
|
||||
if ($model->mobile) {
|
||||
$mobile = $model->mobile;
|
||||
}
|
||||
$phone = $phone . " " . $mobile;
|
||||
$phone = $phone.' '.$mobile;
|
||||
|
||||
return $phone;
|
||||
})
|
||||
/* column account status */
|
||||
@@ -110,6 +118,7 @@ class UserController extends Controller {
|
||||
} else {
|
||||
$stat = '<button class="btn btn-danger btn-xs">Inactive</button>';
|
||||
}
|
||||
|
||||
return $stat;
|
||||
})
|
||||
/* column ban status */
|
||||
@@ -120,11 +129,13 @@ class UserController extends Controller {
|
||||
} else {
|
||||
$stat = '<button class="btn btn-success btn-xs">Active</button>';
|
||||
}
|
||||
|
||||
return $stat;
|
||||
})
|
||||
/* column last login date */
|
||||
->addColumn('lastlogin', function ($model) {
|
||||
$t = $model->updated_at;
|
||||
|
||||
return TicketController::usertimezone($t);
|
||||
})
|
||||
/* column actions */
|
||||
@@ -136,9 +147,11 @@ class UserController extends Controller {
|
||||
|
||||
/**
|
||||
* Show the form for creating a new users.
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function create() {
|
||||
public function create()
|
||||
{
|
||||
try {
|
||||
return view('themes.default1.agent.helpdesk.user.create');
|
||||
} catch (Exception $e) {
|
||||
@@ -148,11 +161,14 @@ class UserController extends Controller {
|
||||
|
||||
/**
|
||||
* Store a newly created users in storage.
|
||||
*
|
||||
* @param type User $user
|
||||
* @param type Sys_userRequest $request
|
||||
*
|
||||
* @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 */
|
||||
/* Check whether function success or not */
|
||||
$user->email = $request->input('email');
|
||||
@@ -175,14 +191,18 @@ class UserController extends Controller {
|
||||
|
||||
/**
|
||||
* Display the specified users.
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type User $user
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function show($id, User $user) {
|
||||
public function show($id, User $user)
|
||||
{
|
||||
try {
|
||||
/* select the field where id = $id(request Id) */
|
||||
$users = $user->whereId($id)->first();
|
||||
|
||||
return view('themes.default1.agent.helpdesk.user.show', compact('users'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
@@ -191,14 +211,18 @@ class UserController extends Controller {
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type User $user
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function edit($id, User $user) {
|
||||
public function edit($id, User $user)
|
||||
{
|
||||
try {
|
||||
/* select the field where id = $id(request Id) */
|
||||
$users = $user->whereId($id)->first();
|
||||
|
||||
return view('themes.default1.agent.helpdesk.user.edit', compact('users'));
|
||||
} catch (Exception $e) {
|
||||
return redirect()->back()->with('fails', $e->errorInfo[2]);
|
||||
@@ -207,12 +231,15 @@ class UserController extends Controller {
|
||||
|
||||
/**
|
||||
* Update the specified user in storage.
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type User $user
|
||||
* @param type Sys_userUpdate $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function update($id, User $user, Sys_userUpdate $request) {
|
||||
public function update($id, User $user, Sys_userUpdate $request)
|
||||
{
|
||||
|
||||
/* select the field where id = $id(request Id) */
|
||||
$users = $user->whereId($id)->first();
|
||||
@@ -229,10 +256,12 @@ class UserController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* get agent profile page
|
||||
* get agent profile page.
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function getProfile() {
|
||||
public function getProfile()
|
||||
{
|
||||
$user = Auth::user();
|
||||
try {
|
||||
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
|
||||
*/
|
||||
public function getProfileedit() {
|
||||
public function getProfileedit()
|
||||
{
|
||||
$user = Auth::user();
|
||||
try {
|
||||
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 ProfileRequest $request
|
||||
*
|
||||
* @return type Redirect
|
||||
*/
|
||||
public function postProfileedit(ProfileRequest $request) {
|
||||
public function postProfileedit(ProfileRequest $request)
|
||||
{
|
||||
// geet authenticated user details
|
||||
$user = Auth::user();
|
||||
$user->gender = $request->input('gender');
|
||||
@@ -292,6 +326,7 @@ class UserController extends Controller {
|
||||
} else {
|
||||
try {
|
||||
$user->fill($request->except('profile_pic', 'gender'))->save();
|
||||
|
||||
return Redirect::route('profile')->with('success', 'Profile Updated sucessfully');
|
||||
} catch (Exception $e) {
|
||||
return Redirect::route('profile')->with('success', $e->errorInfo[2]);
|
||||
@@ -303,12 +338,15 @@ class UserController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Post profile password
|
||||
* Post profile password.
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type ProfilePassword $request
|
||||
*
|
||||
* @return type Redirect
|
||||
*/
|
||||
public function postProfilePassword($id, ProfilePassword $request) {
|
||||
public function postProfilePassword($id, ProfilePassword $request)
|
||||
{
|
||||
// get authenticated user
|
||||
$user = Auth::user();
|
||||
// checking if the old password matches the new password
|
||||
@@ -316,6 +354,7 @@ class UserController extends Controller {
|
||||
$user->password = Hash::make($request->input('new_password'));
|
||||
try {
|
||||
$user->save();
|
||||
|
||||
return redirect('profile-edit')->with('success1', 'Password Updated sucessfully');
|
||||
} catch (Exception $e) {
|
||||
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
|
||||
*
|
||||
* @return type boolean
|
||||
*/
|
||||
public function UserAssignOrg($id) {
|
||||
public function UserAssignOrg($id)
|
||||
{
|
||||
$org = Input::get('org');
|
||||
$user_org = new User_org;
|
||||
$user_org = new User_org();
|
||||
$user_org->org_id = $org;
|
||||
$user_org->user_id = $id;
|
||||
$user_org->save();
|
||||
|
||||
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
|
||||
*
|
||||
* @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
|
||||
if (Input::get('website') != null) {
|
||||
// checking website
|
||||
@@ -356,14 +402,14 @@ class UserController extends Controller {
|
||||
$check2 = Organization::where('name', '=', Input::get('name'))->first();
|
||||
// if any of the fields is not available then return false
|
||||
if (\Input::get('name') == null) {
|
||||
return "Name is required";
|
||||
return 'Name is required';
|
||||
} elseif ($check2 != null) {
|
||||
return "Name should be Unique";
|
||||
return 'Name should be Unique';
|
||||
} elseif ($check != null) {
|
||||
return "Website should be Unique";
|
||||
return 'Website should be Unique';
|
||||
} else {
|
||||
// storing organization details and assigning the current user to that organization
|
||||
$org = new Organization;
|
||||
$org = new Organization();
|
||||
$org->name = Input::get('name');
|
||||
$org->phone = Input::get('phone');
|
||||
$org->website = Input::get('website');
|
||||
@@ -371,7 +417,7 @@ class UserController extends Controller {
|
||||
$org->internal_notes = Input::get('internal');
|
||||
$org->save();
|
||||
|
||||
$user_org = new User_org;
|
||||
$user_org = new User_org();
|
||||
$user_org->org_id = $org->id;
|
||||
$user_org->user_id = $id;
|
||||
$user_org->save();
|
||||
@@ -379,5 +425,4 @@ class UserController extends Controller {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -3,47 +3,46 @@
|
||||
namespace App\Http\Controllers\Agent\kb;
|
||||
|
||||
// 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\Controller;
|
||||
// Requests
|
||||
use App\Http\Requests\kb\ArticleRequest;
|
||||
use App\Http\Requests\kb\ArticleUpdate;
|
||||
// Models
|
||||
use App\Model\kb\Article;
|
||||
use App\Model\kb\Category;
|
||||
use App\Model\kb\Comment;
|
||||
use App\Model\kb\Relationship;
|
||||
use App\Model\kb\Settings;
|
||||
use App\Model\kb\Comment;
|
||||
// Classes
|
||||
use Auth;
|
||||
use Chumper\Datatable\Table;
|
||||
use Datatable;
|
||||
use DB;
|
||||
use Exception;
|
||||
use Illuminate\Http\Request;
|
||||
use Redirect;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* ArticleController
|
||||
* This controller is used to CRUD Articles
|
||||
* This controller is used to CRUD Articles.
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class ArticleController extends Controller {
|
||||
|
||||
class ArticleController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* constructor to check
|
||||
* 1. authentication
|
||||
* 2. user roles
|
||||
* 3. roles must be agent
|
||||
* 3. roles must be agent.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
// checking authentication
|
||||
$this->middleware('auth');
|
||||
// checking roles
|
||||
@@ -51,16 +50,19 @@ class ArticleController extends Controller {
|
||||
SettingsController::language();
|
||||
}
|
||||
|
||||
public function test() {
|
||||
public function test()
|
||||
{
|
||||
//$table = $this->setDatatable();
|
||||
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
|
||||
*/
|
||||
public function getData() {
|
||||
public function getData()
|
||||
{
|
||||
// returns chumper datatable
|
||||
return Datatable::collection(Article::All())
|
||||
/* searcable column name */
|
||||
@@ -74,6 +76,7 @@ class ArticleController extends Controller {
|
||||
/* add column Created */
|
||||
->addColumn('Created', function ($model) {
|
||||
$t = $model->created_at;
|
||||
|
||||
return TicketController::usertimezone($t);
|
||||
})
|
||||
/* add column action */
|
||||
@@ -102,10 +105,12 @@ class ArticleController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* List of Articles
|
||||
* List of Articles.
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function index() {
|
||||
public function index()
|
||||
{
|
||||
/* show article list */
|
||||
try {
|
||||
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
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function create(Category $category) {
|
||||
public function create(Category $category)
|
||||
{
|
||||
/* get the attributes of the category */
|
||||
$category = $category->lists('id', 'name');
|
||||
/* 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 ArticleRequest $request
|
||||
*
|
||||
* @return type redirect
|
||||
*/
|
||||
public function store(Article $article, ArticleRequest $request) {
|
||||
public function store(Article $article, ArticleRequest $request)
|
||||
{
|
||||
// requesting the values to store article data
|
||||
$publishTime = $request->input('year').'-'.$request->input('month').'-'.$request->input('day').' '.$request->input('hour').':'.$request->input('minute').':00';
|
||||
|
||||
$sl = $request->input('slug');
|
||||
$slug = str_slug($sl, "-");
|
||||
$slug = str_slug($sl, '-');
|
||||
$article->slug = $slug;
|
||||
$article->publish_time = $publishTime;
|
||||
$article->fill($request->except('created_at', 'slug'))->save();
|
||||
@@ -155,6 +166,7 @@ class ArticleController extends Controller {
|
||||
/* insert the values to the article table */
|
||||
try {
|
||||
$article->fill($request->except('slug'))->save();
|
||||
|
||||
return redirect('article')->with('success', 'Article Inserted Successfully');
|
||||
} catch (Exception $e) {
|
||||
return redirect('article')->with('fails', 'Article Not Inserted'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
@@ -162,14 +174,17 @@ class ArticleController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit an Article by id
|
||||
* Edit an Article by id.
|
||||
*
|
||||
* @param type Integer $id
|
||||
* @param type Article $article
|
||||
* @param type Relationship $relation
|
||||
* @param type Category $category
|
||||
*
|
||||
* @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();
|
||||
$id = $aid->id;
|
||||
/* 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 Relationship $relation
|
||||
* @param type ArticleRequest $request
|
||||
*
|
||||
* @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();
|
||||
$publishTime = $request->input('year').'-'.$request->input('month').'-'.$request->input('day').' '.$request->input('hour').':'.$request->input('minute').':00';
|
||||
|
||||
$id = $aid->id;
|
||||
$sl = $request->input('slug');
|
||||
$slug = str_slug($sl, "-");
|
||||
$slug = str_slug($sl, '-');
|
||||
// dd($slug);
|
||||
|
||||
$article->slug = $slug;
|
||||
@@ -221,6 +239,7 @@ class ArticleController extends Controller {
|
||||
$article->slug = $slug;
|
||||
$article->publish_time = $publishTime;
|
||||
$article->save();
|
||||
|
||||
return redirect('article')->with('success', 'Article Updated Successfully');
|
||||
} catch (Exception $e) {
|
||||
return redirect('article')->with('fails', 'Article Not Updated'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
@@ -228,20 +247,24 @@ class ArticleController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete an Agent by id
|
||||
* Delete an Agent by id.
|
||||
*
|
||||
* @param type $id
|
||||
* @param type Article $article
|
||||
*
|
||||
* @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 */
|
||||
$article = $article->where('slug', $slug)->first(); //get the selected article via id
|
||||
$id = $article->id;
|
||||
$comments = $comment->where('article_id', $id)->get();
|
||||
if ($comments) {
|
||||
foreach ($comments as $comment)
|
||||
foreach ($comments as $comment) {
|
||||
$comment->delete();
|
||||
}
|
||||
}
|
||||
// deleting relationship
|
||||
$relation = $relation->where('article_id', $id)->first();
|
||||
if ($relation) {
|
||||
@@ -260,11 +283,14 @@ class ArticleController extends Controller {
|
||||
|
||||
/**
|
||||
* user time zone
|
||||
* fetching timezone
|
||||
* fetching timezone.
|
||||
*
|
||||
* @param type $utc
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
static function usertimezone($utc) {
|
||||
public static function usertimezone($utc)
|
||||
{
|
||||
$user = Auth::user();
|
||||
$tz = $user->timezone;
|
||||
$set = Settings::whereId('1')->first();
|
||||
@@ -275,5 +301,4 @@ class ArticleController extends Controller {
|
||||
$date = date($format, strtotime($utc) + $offset);
|
||||
echo $date;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -3,11 +3,8 @@
|
||||
namespace App\Http\Controllers\Agent\kb;
|
||||
|
||||
// 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\Controller;
|
||||
// Requests
|
||||
use App\Http\Requests\kb\CategoryRequest;
|
||||
use App\Http\Requests\kb\CategoryUpdate;
|
||||
@@ -16,28 +13,28 @@ use App\Model\kb\Category;
|
||||
use App\Model\kb\Relationship;
|
||||
// Classes
|
||||
use Datatable;
|
||||
use Redirect;
|
||||
use Exception;
|
||||
use Redirect;
|
||||
|
||||
/**
|
||||
* CategoryController
|
||||
* This controller is used to CRUD category
|
||||
* This controller is used to CRUD category.
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class CategoryController extends Controller {
|
||||
|
||||
class CategoryController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* constructor to check
|
||||
* 1. authentication
|
||||
* 2. user roles
|
||||
* 3. roles must be agent
|
||||
* 3. roles must be agent.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
// checking authentication
|
||||
$this->middleware('auth');
|
||||
// checking roles
|
||||
@@ -46,11 +43,14 @@ class CategoryController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Indexing all Category
|
||||
* Indexing all Category.
|
||||
*
|
||||
* @param type Category $category
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function index() {
|
||||
public function index()
|
||||
{
|
||||
/* get the view of index of the catogorys with all attributes
|
||||
of category model */
|
||||
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
|
||||
*/
|
||||
public function getData() {
|
||||
public function getData()
|
||||
{
|
||||
/* fetching chumper datatables */
|
||||
return Datatable::collection(Category::All())
|
||||
/* search column name */
|
||||
@@ -78,12 +80,13 @@ class CategoryController extends Controller {
|
||||
/* add column Created */
|
||||
->addColumn('Created', function ($model) {
|
||||
$t = $model->created_at;
|
||||
|
||||
return TicketController::usertimezone($t);
|
||||
})
|
||||
/* add column Actions */
|
||||
/* there are action buttons and modal popup to delete a data column */
|
||||
->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> <a href=category/' . $model->id . '/edit class="btn btn-warning btn-xs">' . \Lang::get("lang.edit") . '</a> <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> <a href=category/'.$model->id.'/edit class="btn btn-warning btn-xs">'.\Lang::get('lang.edit').'</a> <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-dialog">
|
||||
<div class="modal-content">
|
||||
@@ -106,11 +109,14 @@ class CategoryController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a Category
|
||||
* Create a Category.
|
||||
*
|
||||
* @param type Category $category
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function create(Category $category) {
|
||||
public function create(Category $category)
|
||||
{
|
||||
/* Get the all attributes in the category model */
|
||||
$category = $category->get();
|
||||
/* get the view page to create new category with all attributes
|
||||
@@ -123,19 +129,23 @@ class CategoryController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* To store the selected category
|
||||
* To store the selected category.
|
||||
*
|
||||
* @param type Category $category
|
||||
* @param type CategoryRequest $request
|
||||
*
|
||||
* @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 */
|
||||
$sl = $request->input('slug');
|
||||
$slug = str_slug($sl, "-");
|
||||
$slug = str_slug($sl, '-');
|
||||
$category->slug = $slug;
|
||||
// send success message to index page
|
||||
try {
|
||||
$category->fill($request->except('slug'))->save();
|
||||
|
||||
return Redirect::back()->with('success', 'Category Inserted Successfully');
|
||||
} catch (Exception $e) {
|
||||
return Redirect::back()->with('fails', 'Category Not Inserted'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
@@ -144,11 +154,14 @@ class CategoryController extends Controller {
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified category.
|
||||
*
|
||||
* @param type $slug
|
||||
* @param type Category $category
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function edit($slug, Category $category) {
|
||||
public function edit($slug, Category $category)
|
||||
{
|
||||
// fetch the category
|
||||
$cid = $category->where('id', $slug)->first();
|
||||
$id = $cid->id;
|
||||
@@ -160,17 +173,20 @@ class CategoryController extends Controller {
|
||||
|
||||
/**
|
||||
* Update the specified Category in storage.
|
||||
*
|
||||
* @param type $slug
|
||||
* @param type Category $category
|
||||
* @param type CategoryUpdate $request
|
||||
*
|
||||
* @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 */
|
||||
$category = $category->where('id', $slug)->first();
|
||||
$sl = $request->input('slug');
|
||||
$slug = str_slug($sl, "-");
|
||||
$slug = str_slug($sl, '-');
|
||||
// dd($slug);
|
||||
$category->slug = $slug;
|
||||
/* update the values at the table via model according with the request */
|
||||
@@ -179,6 +195,7 @@ class CategoryController extends Controller {
|
||||
$category->fill($request->all())->save();
|
||||
$category->slug = $slug;
|
||||
$category->save();
|
||||
|
||||
return redirect('category')->with('success', 'Category Updated Successfully');
|
||||
} catch (Exception $e) {
|
||||
//redirect to index with fails message
|
||||
@@ -188,13 +205,15 @@ class CategoryController extends Controller {
|
||||
|
||||
/**
|
||||
* Remove the specified category from storage.
|
||||
*
|
||||
* @param type $id
|
||||
* @param type Category $category
|
||||
* @param type Relationship $relation
|
||||
*
|
||||
* @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();
|
||||
if ($relation != null) {
|
||||
return Redirect::back()->with('fails', 'Category Not Deleted');
|
||||
@@ -204,11 +223,11 @@ class CategoryController extends Controller {
|
||||
// redirect to index with success message
|
||||
try {
|
||||
$category->delete();
|
||||
|
||||
return Redirect::back()->with('success', 'Category Deleted Successfully');
|
||||
} catch (Exception $e) {
|
||||
return Redirect::back()->with('fails', 'Category Not Deleted'.'<li>'.$e->errorInfo[2].'</li>');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -2,41 +2,37 @@
|
||||
|
||||
namespace App\Http\Controllers\Agent\kb;
|
||||
|
||||
// controllers
|
||||
use App\Http\Controllers\client\kb\UserController;
|
||||
use App\Http\Controllers\Agent\kb\ArticleController;
|
||||
// controllersuse App\Http\Controllers\Agent\helpdesk\TicketController;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Controllers\Agent\kb\SettingsController;
|
||||
use App\Http\Controllers\Agent\helpdesk\TicketController;
|
||||
// request
|
||||
use App\Http\Requests\kb\PageRequest;
|
||||
use App\Http\Requests\kb\PageUpdate;
|
||||
use Illuminate\Http\Request;
|
||||
// Model
|
||||
use App\Model\kb\Page;
|
||||
// classes
|
||||
// Model
|
||||
use Datatable;
|
||||
// classes
|
||||
use Exception;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
/**
|
||||
* PageController
|
||||
* This controller is used to CRUD Pages
|
||||
* This controller is used to CRUD Pages.
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class PageController extends Controller {
|
||||
|
||||
class PageController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* constructor to check
|
||||
* 1. authentication
|
||||
* 2. user roles
|
||||
* 3. roles must be agent
|
||||
* 3. roles must be agent.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Page $page) {
|
||||
public function __construct(Page $page)
|
||||
{
|
||||
// checking authentication
|
||||
$this->middleware('auth');
|
||||
// checking roles
|
||||
@@ -46,10 +42,12 @@ class PageController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the list of pages
|
||||
* Display the list of pages.
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function index() {
|
||||
public function index()
|
||||
{
|
||||
$pages = $this->page->paginate(3);
|
||||
$pages->setPath('page');
|
||||
try {
|
||||
@@ -60,10 +58,12 @@ class PageController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* fetching pages list in chumper datatables
|
||||
* fetching pages list in chumper datatables.
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function getData() {
|
||||
public function getData()
|
||||
{
|
||||
/* fetching chumper datatables */
|
||||
return Datatable::collection(Page::All())
|
||||
/* search column name */
|
||||
@@ -77,6 +77,7 @@ class PageController extends Controller {
|
||||
/* add column Created */
|
||||
->addColumn('Created', function ($model) {
|
||||
$t = $model->created_at;
|
||||
|
||||
return TicketController::usertimezone($t);
|
||||
})
|
||||
/* add column Actions */
|
||||
@@ -106,23 +107,29 @@ class PageController extends Controller {
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function create() {
|
||||
public function 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
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function store(PageRequest $request) {
|
||||
public function store(PageRequest $request)
|
||||
{
|
||||
$sl = $request->input('slug');
|
||||
$slug = str_slug($sl, "-");
|
||||
$slug = str_slug($sl, '-');
|
||||
$this->page->slug = $slug;
|
||||
try {
|
||||
$this->page->fill($request->except('slug'))->save();
|
||||
|
||||
return redirect('page')->with('success', 'Page created successfully');
|
||||
} catch (Exception $e) {
|
||||
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
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function edit($slug) {
|
||||
public function edit($slug)
|
||||
{
|
||||
try {
|
||||
$page = $this->page->where('slug', $slug)->first();
|
||||
|
||||
return view('themes.default1.agent.kb.pages.edit', compact('page'));
|
||||
} catch (Exception $e) {
|
||||
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
|
||||
*
|
||||
* @return type redirect
|
||||
*/
|
||||
public function update($slug, PageUpdate $request) {
|
||||
public function update($slug, PageUpdate $request)
|
||||
{
|
||||
// get pages with respect to slug
|
||||
$pages = $this->page->where('slug', $slug)->first();
|
||||
$sl = $request->input('slug');
|
||||
$slug = str_slug($sl, "-");
|
||||
$slug = str_slug($sl, '-');
|
||||
$this->page->slug = $slug;
|
||||
try {
|
||||
$pages->fill($request->all())->save();
|
||||
$pages->slug = $slug;
|
||||
$pages->save();
|
||||
|
||||
return redirect('page')->with('success', 'Your Page Updated Successfully');
|
||||
} catch (Exception $e) {
|
||||
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
|
||||
*
|
||||
* @return type redirect
|
||||
*/
|
||||
public function destroy($id) {
|
||||
public function destroy($id)
|
||||
{
|
||||
try {
|
||||
// get the page to be deleted
|
||||
$page = $this->page->whereId($id)->first();
|
||||
$page->delete();
|
||||
|
||||
return redirect('page')->with('success', 'Page Deleted Successfully');
|
||||
} catch (Exception $e) {
|
||||
return redirect('page')->with('fails', $e->errorInfo[2]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -2,54 +2,45 @@
|
||||
|
||||
namespace App\Http\Controllers\Agent\kb;
|
||||
|
||||
// Controllers
|
||||
use App\Http\Controllers\Agent\kb\ArticleController;
|
||||
use App\Http\Controllers\Agent\helpdesk\TicketController;
|
||||
// Controllersuse App\Http\Controllers\Agent\helpdesk\TicketController;
|
||||
use App\Http\Controllers\Controller;
|
||||
// Request
|
||||
use App\Http\Requests\kb\FooterRequest;
|
||||
use App\Http\Requests\kb\ProfilePassword;
|
||||
use App\Http\Requests\kb\ProfileRequest;
|
||||
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;
|
||||
// Classes
|
||||
// Model
|
||||
use App\Model\helpdesk\Utility\Timezones;
|
||||
use App\Model\kb\Comment;
|
||||
use App\Model\kb\Settings;
|
||||
use Auth;
|
||||
// Classes
|
||||
use Config;
|
||||
use Datatable;
|
||||
use Exception;
|
||||
use Hash;
|
||||
use Illuminate\Http\Request;
|
||||
use Image;
|
||||
use Input;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* 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>
|
||||
*/
|
||||
class SettingsController extends Controller {
|
||||
|
||||
class SettingsController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* constructor to check
|
||||
* 1. authentication
|
||||
* 2. user roles
|
||||
* 3. roles must be agent
|
||||
* 3. roles must be agent.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
// checking authentication
|
||||
$this->middleware('auth');
|
||||
// checking roles
|
||||
@@ -58,11 +49,12 @@ class SettingsController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* to get the settings page
|
||||
* to get the settings page.
|
||||
*
|
||||
* @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 */
|
||||
$settings = $settings->whereId('1')->first();
|
||||
$time = $time->get();
|
||||
@@ -74,9 +66,11 @@ class SettingsController extends Controller {
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function postSettings($id, Settings $settings, SettingsRequests $request) {
|
||||
public function postSettings($id, Settings $settings, SettingsRequests $request)
|
||||
{
|
||||
try {
|
||||
/* fetch the values of company request */
|
||||
$settings = $settings->whereId('1')->first();
|
||||
@@ -88,11 +82,11 @@ class SettingsController extends Controller {
|
||||
Input::file('logo')->move($destinationPath, $fileName);
|
||||
$settings->logo = $fileName;
|
||||
//$thDestinationPath = 'dist/th';
|
||||
Image::make($destinationPath . '/' . $fileName, array(
|
||||
Image::make($destinationPath.'/'.$fileName, [
|
||||
'width' => 300,
|
||||
'height' => 300,
|
||||
'grayscale' => false,
|
||||
))->save('lb-faveo/dist/image/' . $fileName);
|
||||
])->save('lb-faveo/dist/image/'.$fileName);
|
||||
}
|
||||
if (Input::file('background')) {
|
||||
$name = Input::file('background')->getClientOriginalName();
|
||||
@@ -102,11 +96,11 @@ class SettingsController extends Controller {
|
||||
Input::file('background')->move($destinationPath, $fileName);
|
||||
$settings->background = $fileName;
|
||||
//$thDestinationPath = 'dist/th';
|
||||
Image::make($destinationPath . '/' . $fileName, array(
|
||||
Image::make($destinationPath.'/'.$fileName, [
|
||||
'width' => 300,
|
||||
'height' => 300,
|
||||
'grayscale' => false,
|
||||
))->save('lb-faveo/dist/image/' . $fileName);
|
||||
])->save('lb-faveo/dist/image/'.$fileName);
|
||||
}
|
||||
/* Check whether function success or not */
|
||||
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
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function comment(Comment $comment) {
|
||||
public function comment(Comment $comment)
|
||||
{
|
||||
return view('themes.default1.agent.kb.settings.comment');
|
||||
}
|
||||
|
||||
/**
|
||||
* getdata
|
||||
* getdata.
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function getData() {
|
||||
public function getData()
|
||||
{
|
||||
return \Datatable::collection(Comment::All())
|
||||
->searchColumns('name', 'email', 'comment', 'created')
|
||||
->orderColumns('name')
|
||||
@@ -169,12 +168,15 @@ class SettingsController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Admin can publish the comment
|
||||
* Admin can publish the comment.
|
||||
*
|
||||
* @param type $id
|
||||
* @param type Comment $comment
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function publish($id, Comment $comment) {
|
||||
public function publish($id, Comment $comment)
|
||||
{
|
||||
$comment = $comment->whereId($id)->first();
|
||||
$comment->status = 1;
|
||||
if ($comment->save()) {
|
||||
@@ -185,12 +187,15 @@ class SettingsController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* delete the comment
|
||||
* delete the comment.
|
||||
*
|
||||
* @param type $id
|
||||
* @param type Comment $comment
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function delete($id, Comment $comment) {
|
||||
public function delete($id, Comment $comment)
|
||||
{
|
||||
$comment = $comment->whereId($id)->first();
|
||||
if ($comment->delete()) {
|
||||
return redirect('comment')->with('success', $comment->name."'s!".'Comment Deleted');
|
||||
@@ -200,21 +205,27 @@ class SettingsController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* get profile page
|
||||
* get profile page.
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function getProfile() {
|
||||
public function getProfile()
|
||||
{
|
||||
$time = Timezone::all();
|
||||
$user = Auth::user();
|
||||
|
||||
return view('themes.default1.agent.kb.settings.profile', compact('user', 'time'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Post profile page
|
||||
* Post profile page.
|
||||
*
|
||||
* @param type ProfileRequest $request
|
||||
*
|
||||
* @return type redirect
|
||||
*/
|
||||
public function postProfile(ProfileRequest $request) {
|
||||
public function postProfile(ProfileRequest $request)
|
||||
{
|
||||
$user = Auth::user();
|
||||
$user->gender = $request->input('gender');
|
||||
$user->save();
|
||||
@@ -239,6 +250,7 @@ class SettingsController extends Controller {
|
||||
$user->profile_pic = $fileName;
|
||||
} else {
|
||||
$user->fill($request->except('profile_pic', 'gender'))->save();
|
||||
|
||||
return redirect()->back()->with('success1', 'Profile Updated sucessfully');
|
||||
}
|
||||
if ($user->fill($request->except('profile_pic'))->save()) {
|
||||
@@ -249,18 +261,22 @@ class SettingsController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* post profile password
|
||||
* post profile password.
|
||||
*
|
||||
* @param type $id
|
||||
* @param type ProfilePassword $request
|
||||
*
|
||||
* @return type redirect
|
||||
*/
|
||||
public function postProfilePassword($id, ProfilePassword $request) {
|
||||
public function postProfilePassword($id, ProfilePassword $request)
|
||||
{
|
||||
$user = Auth::user();
|
||||
//echo $user->password;
|
||||
|
||||
if (Hash::check($request->input('old_password'), $user->getAuthPassword())) {
|
||||
$user->password = Hash::make($request->input('new_password'));
|
||||
$user->save();
|
||||
|
||||
return redirect('profile')->with('success2', 'Password Updated sucessfully');
|
||||
} else {
|
||||
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
|
||||
*/
|
||||
static function language() {
|
||||
public static function language()
|
||||
{
|
||||
// $set = Settings::whereId(1)->first();
|
||||
// $lang = $set->language;
|
||||
Config::set('app.locale', 'en');
|
||||
Config::get('app');
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -2,40 +2,37 @@
|
||||
|
||||
namespace App\Http\Controllers\Api\v1;
|
||||
|
||||
use App\Http\Requests;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Api\v1\TicketController;
|
||||
//use Illuminate\Support\Facades\Request as Value;
|
||||
use App\Model\helpdesk\Ticket\Tickets;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Thread;
|
||||
use App\Model\helpdesk\Ticket\Ticket_attachments;
|
||||
use App\Http\Requests\helpdesk\TicketRequest;
|
||||
use App\User;
|
||||
//use Illuminate\Support\Facades\Request as Value;
|
||||
use App\Model\helpdesk\Agent\Department;
|
||||
use App\Model\helpdesk\Agent\Teams;
|
||||
use App\Model\helpdesk\Settings\System;
|
||||
use App\Model\helpdesk\Manage\Help_topic;
|
||||
use App\Model\helpdesk\Manage\Sla_plan;
|
||||
use App\Model\helpdesk\Utility\Priority;
|
||||
use App\Model\helpdesk\Agent\Department;
|
||||
use App\Model\helpdesk\Settings\System;
|
||||
use App\Model\helpdesk\Ticket\Ticket_attachments;
|
||||
use App\Model\helpdesk\Ticket\Ticket_source;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Thread;
|
||||
use App\Model\helpdesk\Ticket\Tickets;
|
||||
use App\Model\helpdesk\Utility\Priority;
|
||||
use App\User;
|
||||
use Exception;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
/**
|
||||
* -----------------------------------------------------------------------------
|
||||
* Api Controller
|
||||
* -----------------------------------------------------------------------------
|
||||
* -----------------------------------------------------------------------------.
|
||||
*
|
||||
*
|
||||
* @author Vijay Sebastian <vijay.sebastian@ladybirdweb.com>
|
||||
* @copyright (c) 2016, Ladybird Web Solution
|
||||
* @name Faveo HELPDESK
|
||||
*
|
||||
* @version v1
|
||||
*
|
||||
*
|
||||
*/
|
||||
class ApiController extends Controller {
|
||||
|
||||
class ApiController extends Controller
|
||||
{
|
||||
public $user;
|
||||
public $request;
|
||||
public $ticket;
|
||||
@@ -53,11 +50,10 @@ class ApiController extends Controller {
|
||||
public $source;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param Request $request
|
||||
*/
|
||||
public function __construct(Request $request) {
|
||||
|
||||
public function __construct(Request $request)
|
||||
{
|
||||
$this->request = $request;
|
||||
|
||||
$this->middleware('jwt.auth');
|
||||
@@ -107,12 +103,16 @@ class ApiController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create Tickets
|
||||
* Create Tickets.
|
||||
*
|
||||
* @method POST
|
||||
*
|
||||
* @param user_id,subject,body,helptopic,sla,priority,dept
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function createTicket() {
|
||||
public function createTicket()
|
||||
{
|
||||
try {
|
||||
$v = \Validator::make($this->request->all(), [
|
||||
'user_id' => 'required|exists:users,id',
|
||||
@@ -125,12 +125,12 @@ class ApiController extends Controller {
|
||||
]);
|
||||
if ($v->fails()) {
|
||||
$error = $v->errors();
|
||||
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
|
||||
$user_id = $this->request->input('user_id');
|
||||
|
||||
|
||||
$subject = $this->request->input('subject');
|
||||
$body = $this->request->input('body');
|
||||
$helptopic = $this->request->input('helptopic');
|
||||
@@ -143,12 +143,12 @@ class ApiController extends Controller {
|
||||
$form_data = $this->request->input('form_data');
|
||||
$source = $this->request->input('source');
|
||||
$attach = $this->request->input('attachments');
|
||||
/**
|
||||
/*
|
||||
* return s ticket number
|
||||
*/
|
||||
$response = $this->ticket->createTicket($user_id, $subject, $body, $helptopic, $sla, $priority, $source, $headers, $dept, $assignto, $form_data, $attach);
|
||||
|
||||
/**
|
||||
/*
|
||||
* return ticket details
|
||||
*/
|
||||
//dd($response);
|
||||
@@ -159,19 +159,24 @@ class ApiController extends Controller {
|
||||
$error = $e->getMessage();
|
||||
$line = $e->getLine();
|
||||
$file = $e->getFile();
|
||||
|
||||
return response()->json(compact('error', 'file', 'line'));
|
||||
} catch (\TokenExpiredException $e) {
|
||||
$error = $e->getMessage();
|
||||
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reply for the ticket
|
||||
* Reply for the ticket.
|
||||
*
|
||||
* @param TicketRequest $request
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function ticketReply() {
|
||||
public function ticketReply()
|
||||
{
|
||||
try {
|
||||
$v = \Validator::make($this->request->all(), [
|
||||
'ticket_ID' => 'required|exists:tickets,id',
|
||||
@@ -179,27 +184,33 @@ class ApiController extends Controller {
|
||||
]);
|
||||
if ($v->fails()) {
|
||||
$error = $v->errors();
|
||||
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
$attach = $this->request->input('attachments');
|
||||
$result = $this->ticket->reply($this->thread, $this->request, $this->attach, $attach);
|
||||
|
||||
return response()->json(compact('result'));
|
||||
} catch (\Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
$line = $e->getLine();
|
||||
$file = $e->getFile();
|
||||
|
||||
return response()->json(compact('error', 'file', 'line'));
|
||||
} catch (\TokenExpiredException $e) {
|
||||
$error = $e->getMessage();
|
||||
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit a ticket
|
||||
* Edit a ticket.
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function editTicket() {
|
||||
public function editTicket()
|
||||
{
|
||||
try {
|
||||
$v = \Validator::make($this->request->all(), [
|
||||
'ticket_id' => 'required|exists:tickets,id',
|
||||
@@ -211,55 +222,67 @@ class ApiController extends Controller {
|
||||
]);
|
||||
if ($v->fails()) {
|
||||
$error = $v->errors();
|
||||
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
$ticket_id = $this->request->input('ticket_id');
|
||||
$result = $this->ticket->ticketEditPost($ticket_id, $this->thread, $this->model);
|
||||
|
||||
return response()->json(compact('result'));
|
||||
} catch (\Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
$line = $e->getLine();
|
||||
$file = $e->getFile();
|
||||
|
||||
return response()->json(compact('error', 'file', 'line'));
|
||||
} catch (\TokenExpiredException $e) {
|
||||
$error = $e->getMessage();
|
||||
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete The Ticket
|
||||
* Delete The Ticket.
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function deleteTicket() {
|
||||
public function deleteTicket()
|
||||
{
|
||||
try {
|
||||
$v = \Validator::make($this->request->all(), [
|
||||
'ticket_id' => 'required|exists:tickets,id',
|
||||
]);
|
||||
if ($v->fails()) {
|
||||
$error = $v->errors();
|
||||
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
$id = $this->request->input('ticket_id');
|
||||
|
||||
$result = $this->ticket->delete($id, $this->model);
|
||||
|
||||
return response()->json(compact('result'));
|
||||
} catch (\Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
$line = $e->getLine();
|
||||
$file = $e->getFile();
|
||||
|
||||
return response()->json(compact('error', 'file', 'line'));
|
||||
} catch (\TokenExpiredException $e) {
|
||||
$error = $e->getMessage();
|
||||
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all opened tickets
|
||||
* Get all opened tickets.
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function openedTickets() {
|
||||
public function openedTickets()
|
||||
{
|
||||
try {
|
||||
// $result = $this->model->where('status', '=', 1)->where('isanswered', '=', 0)->where('assigned_to', '=', null)->orderBy('id', 'DESC')->get();
|
||||
// return response()->json(compact('result'));
|
||||
@@ -282,24 +305,28 @@ class ApiController extends Controller {
|
||||
->distinct()
|
||||
->paginate(10)
|
||||
->toJson();
|
||||
return $result;
|
||||
|
||||
return $result;
|
||||
} catch (\Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
$line = $e->getLine();
|
||||
$file = $e->getFile();
|
||||
|
||||
return response()->json(compact('error', 'file', 'line'));
|
||||
} catch (\TokenExpiredException $e) {
|
||||
$error = $e->getMessage();
|
||||
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Unsigned Tickets
|
||||
* Get Unsigned Tickets.
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function unassignedTickets() {
|
||||
public function unassignedTickets()
|
||||
{
|
||||
try {
|
||||
//dd('sdhjbc');
|
||||
// $result = $this->model->where('assigned_to', '=', null)->where('status', '1')->orderBy('id', 'DESC')->get();
|
||||
@@ -322,23 +349,28 @@ class ApiController extends Controller {
|
||||
->distinct()
|
||||
->paginate(10)
|
||||
->toJson();
|
||||
|
||||
return $unassigned;
|
||||
} catch (\Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
$line = $e->getLine();
|
||||
$file = $e->getFile();
|
||||
|
||||
return response()->json(compact('error', 'file', 'line'));
|
||||
} catch (\TokenExpiredException $e) {
|
||||
$error = $e->getMessage();
|
||||
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get closed Tickets
|
||||
* Get closed Tickets.
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function closeTickets() {
|
||||
public function closeTickets()
|
||||
{
|
||||
try {
|
||||
// $result = $this->model->where('status', '>', 1)->where('status', '<', 4)->orderBy('id', 'DESC')->get();
|
||||
// return response()->json(compact('result'));
|
||||
@@ -361,61 +393,76 @@ class ApiController extends Controller {
|
||||
->distinct()
|
||||
->paginate(10)
|
||||
->toJson();
|
||||
|
||||
return $result;
|
||||
} catch (\Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
$line = $e->getLine();
|
||||
$file = $e->getFile();
|
||||
|
||||
return response()->json(compact('error', 'file', 'line'));
|
||||
} catch (\TokenExpiredException $e) {
|
||||
$error = $e->getMessage();
|
||||
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get All agents
|
||||
* Get All agents.
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function getAgents() {
|
||||
public function getAgents()
|
||||
{
|
||||
try {
|
||||
$result = $this->faveoUser->where('role', 'agent')->orWhere('role', 'admin')->where('active', 1)->get();
|
||||
|
||||
return response()->json(compact('result'));
|
||||
} catch (Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
$line = $e->getLine();
|
||||
$file = $e->getFile();
|
||||
|
||||
return response()->json(compact('error', 'file', 'line'));
|
||||
} catch (\TokenExpiredException $e) {
|
||||
$error = $e->getMessage();
|
||||
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get All Teams
|
||||
* Get All Teams.
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function getTeams() {
|
||||
public function getTeams()
|
||||
{
|
||||
try {
|
||||
$result = $this->team->get();
|
||||
|
||||
return response()->json(compact('result'));
|
||||
} catch (Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
$line = $e->getLine();
|
||||
$file = $e->getFile();
|
||||
|
||||
return response()->json(compact('error', 'file', 'line'));
|
||||
} catch (\TokenExpiredException $e) {
|
||||
$error = $e->getMessage();
|
||||
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* To assign a ticket
|
||||
* To assign a ticket.
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function assignTicket() {
|
||||
public function assignTicket()
|
||||
{
|
||||
try {
|
||||
$v = \Validator::make($this->request->all(), [
|
||||
'ticket_id' => 'required',
|
||||
@@ -423,12 +470,14 @@ class ApiController extends Controller {
|
||||
]);
|
||||
if ($v->fails()) {
|
||||
$error = $v->errors();
|
||||
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
$id = $this->request->input('ticket_id');
|
||||
$response = $this->ticket->assign($id);
|
||||
if ($response == 1) {
|
||||
$result = 'success';
|
||||
|
||||
return response()->json(compact('result'));
|
||||
} else {
|
||||
return response()->json(compact('response'));
|
||||
@@ -437,165 +486,200 @@ class ApiController extends Controller {
|
||||
$error = $e->getMessage();
|
||||
$line = $e->getLine();
|
||||
$file = $e->getFile();
|
||||
|
||||
return response()->json(compact('error', 'file', 'line'));
|
||||
} catch (\TokenExpiredException $e) {
|
||||
$error = $e->getMessage();
|
||||
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all customers
|
||||
* Get all customers.
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function getCustomers() {
|
||||
public function getCustomers()
|
||||
{
|
||||
try {
|
||||
$v = \Validator::make($this->request->all(), [
|
||||
'search' => 'required',
|
||||
]);
|
||||
if ($v->fails()) {
|
||||
$error = $v->errors();
|
||||
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
$search = $this->request->input('search');
|
||||
$result = $this->faveoUser->where('first_name', 'like', '%'.$search.'%')->orWhere('last_name', 'like', '%'.$search.'%')->orWhere('user_name', 'like', '%'.$search.'%')->orWhere('email', 'like', '%'.$search.'%')->get();
|
||||
|
||||
return response()->json(compact('result'));
|
||||
} catch (Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
$line = $e->getLine();
|
||||
$file = $e->getFile();
|
||||
|
||||
return response()->json(compact('error', 'file', 'line'));
|
||||
} catch (\TokenExpiredException $e) {
|
||||
$error = $e->getMessage();
|
||||
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a customer by id
|
||||
* Get a customer by id.
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function getCustomer() {
|
||||
public function getCustomer()
|
||||
{
|
||||
try {
|
||||
$v = \Validator::make($this->request->all(), [
|
||||
'user_id' => 'required',
|
||||
]);
|
||||
if ($v->fails()) {
|
||||
$error = $v->errors();
|
||||
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
$id = $this->request->input('user_id');
|
||||
$result = $this->faveoUser->where('id', $id)->first();
|
||||
|
||||
return response()->json(compact('result'));
|
||||
} catch (Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
$line = $e->getLine();
|
||||
$file = $e->getFile();
|
||||
|
||||
return response()->json(compact('error', 'file', 'line'));
|
||||
} catch (\TokenExpiredException $e) {
|
||||
$error = $e->getMessage();
|
||||
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Search tickets
|
||||
* Search tickets.
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function searchTicket() {
|
||||
public function searchTicket()
|
||||
{
|
||||
try {
|
||||
$v = \Validator::make($this->request->all(), [
|
||||
'search' => 'required',
|
||||
]);
|
||||
if ($v->fails()) {
|
||||
$error = $v->errors();
|
||||
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
$search = $this->request->input('search');
|
||||
$result = $this->thread->select('ticket_id')->where('title', 'like', '%'.$search.'%')->orWhere('body', 'like', '%'.$search.'%')->get();
|
||||
|
||||
return response()->json(compact('result'));
|
||||
} catch (Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
$line = $e->getLine();
|
||||
$file = $e->getFile();
|
||||
|
||||
return response()->json(compact('error', 'file', 'line'));
|
||||
} catch (\TokenExpiredException $e) {
|
||||
$error = $e->getMessage();
|
||||
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get threads of a ticket
|
||||
* Get threads of a ticket.
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function ticketThreads() {
|
||||
public function ticketThreads()
|
||||
{
|
||||
try {
|
||||
$v = \Validator::make($this->request->all(), [
|
||||
'id' => 'required',
|
||||
]);
|
||||
if ($v->fails()) {
|
||||
$error = $v->errors();
|
||||
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
$id = $this->request->input('id');
|
||||
$result = $this->thread->where('ticket_id', $id)->get();
|
||||
|
||||
return response()->json(compact('result'));
|
||||
} catch (\Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
$line = $e->getLine();
|
||||
$file = $e->getFile();
|
||||
|
||||
return response()->json(compact('error', 'file', 'line'));
|
||||
} catch (\TokenExpiredException $e) {
|
||||
$error = $e->getMessage();
|
||||
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the url is valid or not
|
||||
* Check the url is valid or not.
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function checkUrl() {
|
||||
public function checkUrl()
|
||||
{
|
||||
//dd($this->request);
|
||||
try {
|
||||
$v = \Validator::make($this->request->all(), [
|
||||
'url' => 'required|url'
|
||||
'url' => 'required|url',
|
||||
]);
|
||||
if ($v->fails()) {
|
||||
$error = $v->errors();
|
||||
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
|
||||
$url = $this->request->input('url');
|
||||
$url = $url . "/api/v1/helpdesk/check-url?api_key=" . $this->request->input('api_key') . "&token=" . \Config::get('app.token');
|
||||
$url = $url.'/api/v1/helpdesk/check-url?api_key='.$this->request->input('api_key').'&token='.\Config::get('app.token');
|
||||
$result = $this->CallGetApi($url);
|
||||
//dd($result);
|
||||
return response()->json(compact('result'));
|
||||
} catch (\Exception $ex) {
|
||||
$error = $e->getMessage();
|
||||
|
||||
return response()->json(compact('error'));
|
||||
} catch (\TokenExpiredException $e) {
|
||||
$error = $e->getMessage();
|
||||
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Success for currect url
|
||||
* Success for currect url.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function urlResult() {
|
||||
return "success";
|
||||
public function urlResult()
|
||||
{
|
||||
return 'success';
|
||||
}
|
||||
|
||||
/**
|
||||
* Call curl function for Get Method
|
||||
* Call curl function for Get Method.
|
||||
*
|
||||
* @param type $url
|
||||
*
|
||||
* @return type int|string|json
|
||||
*/
|
||||
public function callGetApi($url) {
|
||||
|
||||
public function callGetApi($url)
|
||||
{
|
||||
$curl = curl_init($url);
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($curl, CURLOPT_URL, $url);
|
||||
@@ -612,13 +696,15 @@ class ApiController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Call curl function for POST Method
|
||||
* Call curl function for POST Method.
|
||||
*
|
||||
* @param type $url
|
||||
* @param type $data
|
||||
*
|
||||
* @return type int|string|json
|
||||
*/
|
||||
public function callPostApi($url, $data) {
|
||||
|
||||
public function callPostApi($url, $data)
|
||||
{
|
||||
$curl = curl_init($url);
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($curl, CURLOPT_URL, $url);
|
||||
@@ -636,11 +722,12 @@ class ApiController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* To generate api string
|
||||
* To generate api string.
|
||||
*
|
||||
* @return type | json
|
||||
*/
|
||||
public function generateApiKey() {
|
||||
public function generateApiKey()
|
||||
{
|
||||
try {
|
||||
$set = $this->setting->where('id', '1')->first();
|
||||
//dd($set);
|
||||
@@ -649,123 +736,154 @@ class ApiController extends Controller {
|
||||
$set->api_key = $key;
|
||||
$set->save();
|
||||
$result = $set->api_key;
|
||||
|
||||
return response()->json(compact('result'));
|
||||
} else {
|
||||
$result = 'please enable api';
|
||||
|
||||
return response()->json(compact('result'));
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
$line = $e->getLine();
|
||||
$file = $e->getFile();
|
||||
|
||||
return response()->json(compact('error', 'file', 'line'));
|
||||
} catch (\TokenExpiredException $e) {
|
||||
$error = $e->getMessage();
|
||||
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get help topics
|
||||
* Get help topics.
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function getHelpTopic() {
|
||||
public function getHelpTopic()
|
||||
{
|
||||
try {
|
||||
$result = $this->helptopic->get();
|
||||
|
||||
return response()->json(compact('result'));
|
||||
} catch (\Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
$line = $e->getLine();
|
||||
$file = $e->getFile();
|
||||
|
||||
return response()->json(compact('error', 'file', 'line'));
|
||||
} catch (\TokenExpiredException $e) {
|
||||
$error = $e->getMessage();
|
||||
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Sla plans
|
||||
* Get Sla plans.
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function getSlaPlan() {
|
||||
public function getSlaPlan()
|
||||
{
|
||||
try {
|
||||
$result = $this->slaPlan->get();
|
||||
|
||||
return response()->json(compact('result'));
|
||||
} catch (\Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
$line = $e->getLine();
|
||||
$file = $e->getFile();
|
||||
|
||||
return response()->json(compact('error', 'file', 'line'));
|
||||
} catch (\TokenExpiredException $e) {
|
||||
$error = $e->getMessage();
|
||||
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get priorities
|
||||
* Get priorities.
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function getPriority() {
|
||||
public function getPriority()
|
||||
{
|
||||
try {
|
||||
$result = $this->priority->get();
|
||||
|
||||
return response()->json(compact('result'));
|
||||
} catch (\Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
$line = $e->getLine();
|
||||
$file = $e->getFile();
|
||||
|
||||
return response()->json(compact('error', 'file', 'line'));
|
||||
} catch (\TokenExpiredException $e) {
|
||||
$error = $e->getMessage();
|
||||
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get departments
|
||||
* Get departments.
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function getDepartment() {
|
||||
public function getDepartment()
|
||||
{
|
||||
try {
|
||||
$result = $this->department->get();
|
||||
|
||||
return response()->json(compact('result'));
|
||||
} catch (\Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
$line = $e->getLine();
|
||||
$file = $e->getFile();
|
||||
|
||||
return response()->json(compact('error', 'file', 'line'));
|
||||
} catch (\TokenExpiredException $e) {
|
||||
$error = $e->getMessage();
|
||||
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Getting the tickets
|
||||
* Getting the tickets.
|
||||
*
|
||||
* @return type json
|
||||
*/
|
||||
public function getTickets() {
|
||||
public function getTickets()
|
||||
{
|
||||
try {
|
||||
$tickets = $this->model->paginate(10);
|
||||
$tickets->toJson();
|
||||
|
||||
return $tickets;
|
||||
} catch (\Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
$line = $e->getLine();
|
||||
$file = $e->getFile();
|
||||
|
||||
return response()->json(compact('error', 'file', 'line'));
|
||||
} catch (\TokenExpiredException $e) {
|
||||
$error = $e->getMessage();
|
||||
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetching the Inbox details
|
||||
* Fetching the Inbox details.
|
||||
*
|
||||
* @return type json
|
||||
*/
|
||||
public function inbox() {
|
||||
public function inbox()
|
||||
{
|
||||
try {
|
||||
$inbox = $this->user->join('tickets', 'users.id', '=', 'tickets.user_id')
|
||||
->join('department', 'department.id', '=', 'tickets.dept_id')
|
||||
@@ -782,23 +900,28 @@ class ApiController extends Controller {
|
||||
->distinct()
|
||||
->paginate(10)
|
||||
->toJson();
|
||||
|
||||
return $inbox;
|
||||
} catch (\Exception $ex) {
|
||||
$error = $e->getMessage();
|
||||
$line = $e->getLine();
|
||||
$file = $e->getFile();
|
||||
|
||||
return response()->json(compact('error', 'file', 'line'));
|
||||
} catch (\TokenExpiredException $e) {
|
||||
$error = $e->getMessage();
|
||||
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create internal note
|
||||
* Create internal note.
|
||||
*
|
||||
* @return type json
|
||||
*/
|
||||
public function internalNote() {
|
||||
public function internalNote()
|
||||
{
|
||||
try {
|
||||
$v = \Validator::make($this->request->all(), [
|
||||
'userid' => 'required|exists:users,id',
|
||||
@@ -807,6 +930,7 @@ class ApiController extends Controller {
|
||||
]);
|
||||
if ($v->fails()) {
|
||||
$error = $v->errors();
|
||||
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
$userid = $this->request->input('userid');
|
||||
@@ -814,19 +938,23 @@ class ApiController extends Controller {
|
||||
|
||||
$body = $this->request->input('body');
|
||||
$thread = $this->thread->create(['ticket_id' => $ticketid, 'user_id' => $userid, 'is_internal' => 1, 'body' => $body]);
|
||||
|
||||
return response()->json(compact('thread'));
|
||||
} catch (\Exception $ex) {
|
||||
$error = $e->getMessage();
|
||||
$line = $e->getLine();
|
||||
$file = $e->getFile();
|
||||
|
||||
return response()->json(compact('error', 'file', 'line'));
|
||||
} catch (\TokenExpiredException $e) {
|
||||
$error = $e->getMessage();
|
||||
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
}
|
||||
|
||||
public function getTrash(){
|
||||
public function getTrash()
|
||||
{
|
||||
try {
|
||||
$trash = $this->user->join('tickets', function ($join) {
|
||||
$join->on('users.id', '=', 'tickets.user_id')
|
||||
@@ -846,32 +974,36 @@ class ApiController extends Controller {
|
||||
->distinct()
|
||||
->paginate(10)
|
||||
->toJson();
|
||||
|
||||
return $trash;
|
||||
|
||||
|
||||
} catch (\Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
$line = $e->getLine();
|
||||
$file = $e->getFile();
|
||||
|
||||
return response()->json(compact('error', 'file', 'line'));
|
||||
} catch (\TokenExpiredException $e) {
|
||||
$error = $e->getMessage();
|
||||
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
}
|
||||
public function getMyTickets(){
|
||||
|
||||
public function getMyTickets()
|
||||
{
|
||||
try {
|
||||
$v = \Validator::make($this->request->all(), [
|
||||
'user_id' => 'required|exists:users,id'
|
||||
'user_id' => 'required|exists:users,id',
|
||||
]);
|
||||
if ($v->fails()) {
|
||||
$error = $v->errors();
|
||||
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
$id = $this->request->input('user_id');
|
||||
if ($this->user->where('id', $id)->first()->role == 'user') {
|
||||
$error = "This user is not an Aget or Admin";
|
||||
$error = 'This user is not an Aget or Admin';
|
||||
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
$result = $this->user->join('tickets', function ($join) use ($id) {
|
||||
@@ -892,18 +1024,18 @@ class ApiController extends Controller {
|
||||
->distinct()
|
||||
->paginate(10)
|
||||
->toJson();
|
||||
|
||||
return $result;
|
||||
|
||||
|
||||
} catch (\Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
$line = $e->getLine();
|
||||
$file = $e->getFile();
|
||||
|
||||
return response()->json(compact('error', 'file', 'line'));
|
||||
} catch (\TokenExpiredException $e) {
|
||||
$error = $e->getMessage();
|
||||
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,52 +5,42 @@ namespace App\Http\Controllers\Api\v1;
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
// 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\Form\Form_details;
|
||||
// models
|
||||
use App\Model\helpdesk\Utility\Date_time_format;
|
||||
use App\Model\helpdesk\Utility\Timezones;
|
||||
// classes
|
||||
use App;
|
||||
use App\User;
|
||||
use Artisan;
|
||||
// classes
|
||||
use Config;
|
||||
use File;
|
||||
use Hash;
|
||||
use Input;
|
||||
use Redirect;
|
||||
use Session;
|
||||
use View;
|
||||
use Exception;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
/**
|
||||
* |=======================================================================
|
||||
* |Class: InstallController
|
||||
* |=======================================================================
|
||||
* |=======================================================================.
|
||||
*
|
||||
* Class to perform the first install operation without this the database
|
||||
* settings could not be started
|
||||
*
|
||||
* @package Faveo HELPDESK
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*
|
||||
*/
|
||||
class InstallerApiController extends Controller {
|
||||
|
||||
class InstallerApiController extends Controller
|
||||
{
|
||||
/**
|
||||
* config_database
|
||||
* This function is to configure the database and install the application via API call.
|
||||
*
|
||||
* @return type Json
|
||||
*/
|
||||
public function config_database(Request $request) {
|
||||
public function config_database(Request $request)
|
||||
{
|
||||
error_reporting(E_ALL & ~E_NOTICE);
|
||||
|
||||
// Check for pre install
|
||||
if (\Config::get('database.install') == '%0%') {
|
||||
|
||||
$default = $request->database;
|
||||
$host = $request->host;
|
||||
$database = $request->databasename;
|
||||
@@ -74,7 +64,7 @@ class InstallerApiController extends Controller {
|
||||
}
|
||||
|
||||
// Write environment file
|
||||
$fp = fopen(base_path() . "/.env", 'w');
|
||||
$fp = fopen(base_path().'/.env', 'w');
|
||||
fwrite($fp, $config);
|
||||
fclose($fp);
|
||||
|
||||
@@ -90,9 +80,11 @@ class InstallerApiController extends Controller {
|
||||
/**
|
||||
* config_database
|
||||
* This function is to configure the database and install the application via API call.
|
||||
*
|
||||
* @return type Json
|
||||
*/
|
||||
public function config_system(Request $request) {
|
||||
public function config_system(Request $request)
|
||||
{
|
||||
// Check for pre install
|
||||
if (\Config::get('database.install') == '%0%') {
|
||||
$firstname = $request->firstname;
|
||||
@@ -104,8 +96,8 @@ class InstallerApiController extends Controller {
|
||||
$datetime = $request->datetime;
|
||||
|
||||
// Migrate database
|
||||
Artisan::call('migrate', array('--force' => true));
|
||||
Artisan::call('db:seed', array('--force' => true));
|
||||
Artisan::call('migrate', ['--force' => true]);
|
||||
Artisan::call('db:seed', ['--force' => true]);
|
||||
|
||||
// checking requested timezone for the admin and system
|
||||
$timezones = Timezones::where('name', '=', $timezone)->first();
|
||||
@@ -118,7 +110,7 @@ class InstallerApiController extends Controller {
|
||||
return ['response' => 'fail', 'reason' => 'invalid date-time format', 'status' => '0'];
|
||||
}
|
||||
// Creating minum settings for system
|
||||
$system = new System;
|
||||
$system = new System();
|
||||
$system->status = 1;
|
||||
$system->department = 1;
|
||||
$system->date_time_format = $date_time_format->id;
|
||||
@@ -126,7 +118,7 @@ class InstallerApiController extends Controller {
|
||||
$system->save();
|
||||
|
||||
// Creating user
|
||||
$user = User::create(array(
|
||||
$user = User::create([
|
||||
'first_name' => $firstname,
|
||||
'last_name' => $lastname,
|
||||
'email' => $email,
|
||||
@@ -136,7 +128,7 @@ class InstallerApiController extends Controller {
|
||||
'role' => 'admin',
|
||||
'assign_group' => 1,
|
||||
'primary_dpt' => 1,
|
||||
));
|
||||
]);
|
||||
|
||||
// Setting database installed status
|
||||
$value = '1';
|
||||
@@ -165,5 +157,4 @@ class InstallerApiController extends Controller {
|
||||
return ['response' => 'fail', 'reason' => 'this system is already installed', 'status' => '0'];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -2,26 +2,26 @@
|
||||
|
||||
namespace App\Http\Controllers\Api\v1;
|
||||
|
||||
use App\Http\Requests;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Exception;
|
||||
|
||||
class TestController extends Controller {
|
||||
|
||||
class TestController extends Controller
|
||||
{
|
||||
public $server;
|
||||
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
$server = new Request();
|
||||
$url = $_SERVER['REQUEST_URI'];
|
||||
$server = parse_url($url);
|
||||
$server["path"] = dirname($server["path"]);
|
||||
$server = parse_url($server["path"]);
|
||||
$server["path"] = dirname($server["path"]);
|
||||
$this->server = "http://" . $_SERVER['HTTP_HOST'] . $server['path'] . "/";
|
||||
$server['path'] = dirname($server['path']);
|
||||
$server = parse_url($server['path']);
|
||||
$server['path'] = dirname($server['path']);
|
||||
$this->server = 'http://'.$_SERVER['HTTP_HOST'].$server['path'].'/';
|
||||
}
|
||||
|
||||
static function callGetApi($url) {
|
||||
public static function callGetApi($url)
|
||||
{
|
||||
//dd($url);
|
||||
$curl = curl_init($url);
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
|
||||
@@ -38,7 +38,8 @@ class TestController extends Controller {
|
||||
curl_close($curl);
|
||||
}
|
||||
|
||||
static function callPostApi($url, $data) {
|
||||
public static function callPostApi($url, $data)
|
||||
{
|
||||
//dd($url);
|
||||
$curl = curl_init($url);
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
|
||||
@@ -56,7 +57,8 @@ class TestController extends Controller {
|
||||
curl_close($curl);
|
||||
}
|
||||
|
||||
public function ticketReply() {
|
||||
public function ticketReply()
|
||||
{
|
||||
|
||||
//$file = file_get_contents(base_path() . '/../lb-faveo/Img/Ladybird.png');
|
||||
|
||||
@@ -82,14 +84,16 @@ class TestController extends Controller {
|
||||
];
|
||||
$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();
|
||||
$respose = $_this->callPostApi($url, $data);
|
||||
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function createTicket() {
|
||||
public function createTicket()
|
||||
{
|
||||
|
||||
//$file = file_get_contents(base_path() . '/../lb-faveo/Img/Ladybird.png');
|
||||
|
||||
@@ -103,7 +107,7 @@ class TestController extends Controller {
|
||||
'headers' => [0 => 'vijaycodename47@gmail.com'],
|
||||
'dept' => '1',
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN',
|
||||
/** if attachment */
|
||||
/* if attachment */
|
||||
// 'attachments' => [
|
||||
// [
|
||||
// 'name' => 'ladybird',
|
||||
@@ -121,53 +125,60 @@ class TestController extends Controller {
|
||||
];
|
||||
$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();
|
||||
$respose = $_this->callPostApi($url, $data);
|
||||
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function generateToken() {
|
||||
public function generateToken()
|
||||
{
|
||||
$data = [
|
||||
//'email'=>'vijaycodename47@gmail.com',
|
||||
'username' => 'vijay',
|
||||
'password' => 'manjapra',
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN'
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN',
|
||||
];
|
||||
|
||||
$data = http_build_query($data, '', '&');
|
||||
|
||||
$url = $this->server . "authenticate";
|
||||
$url = $this->server.'authenticate';
|
||||
//dd($url);
|
||||
$_this = new self();
|
||||
$respose = $_this->callPostApi($url, $data);
|
||||
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function createUser() {
|
||||
public function createUser()
|
||||
{
|
||||
$data = [
|
||||
'email' => 'vijaycodename@gmail.com',
|
||||
'password' => 'manjapra',
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN'
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN',
|
||||
];
|
||||
|
||||
$data = http_build_query($data, '', '&');
|
||||
$url = $this->server . "register";
|
||||
$url = $this->server.'register';
|
||||
$_this = new self();
|
||||
$respose = $_this->callPostApi($url, $data);
|
||||
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function getAuthUser() {
|
||||
|
||||
$url = $this->server . "authenticate/user?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
public function getAuthUser()
|
||||
{
|
||||
$url = $this->server.'authenticate/user?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token='.\Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->callGetApi($url);
|
||||
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function editTicket() {
|
||||
public function editTicket()
|
||||
{
|
||||
$data = [
|
||||
'ticket_id' => '13',
|
||||
'subject' => 'Api editing ticket via faveo api',
|
||||
@@ -179,222 +190,266 @@ class TestController extends Controller {
|
||||
];
|
||||
|
||||
$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();
|
||||
$respose = $_this->callPostApi($url, $data);
|
||||
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function deleteTicket() {
|
||||
public function deleteTicket()
|
||||
{
|
||||
$data = [
|
||||
'ticket_id' => [11],
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN'
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN',
|
||||
];
|
||||
|
||||
$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();
|
||||
$respose = $_this->callPostApi($url, $data);
|
||||
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function openedTickets() {
|
||||
$url = $this->server . "helpdesk/open?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
public function openedTickets()
|
||||
{
|
||||
$url = $this->server.'helpdesk/open?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token='.\Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->callGetApi($url);
|
||||
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function unassignedTickets() {
|
||||
public function unassignedTickets()
|
||||
{
|
||||
//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();
|
||||
$respose = $_this->callGetApi($url);
|
||||
//dd($respose);
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function closeTickets() {
|
||||
$url = $this->server . "helpdesk/closed?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
public function closeTickets()
|
||||
{
|
||||
$url = $this->server.'helpdesk/closed?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token='.\Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->callGetApi($url);
|
||||
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function getAgents() {
|
||||
$url = $this->server . "helpdesk/agents?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
public function getAgents()
|
||||
{
|
||||
$url = $this->server.'helpdesk/agents?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token='.\Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->callGetApi($url);
|
||||
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function getTeams() {
|
||||
$url = $this->server . "helpdesk/teams?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
public function getTeams()
|
||||
{
|
||||
$url = $this->server.'helpdesk/teams?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token='.\Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->callGetApi($url);
|
||||
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function assignTicket() {
|
||||
public function assignTicket()
|
||||
{
|
||||
$data = [
|
||||
'ticket_id' => 1,
|
||||
'user' => 'vijay.sebastian@ladybirdweb.com',
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN'
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN',
|
||||
];
|
||||
$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();
|
||||
$respose = $_this->callPostApi($url, $data);
|
||||
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function getCustomers() {
|
||||
public function getCustomers()
|
||||
{
|
||||
$search = [
|
||||
'search' => 'vij',
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN'
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN',
|
||||
];
|
||||
$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;
|
||||
$_this = new self();
|
||||
$respose = $_this->callGetApi($url);
|
||||
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function getCustomer() {
|
||||
public function getCustomer()
|
||||
{
|
||||
$search = [
|
||||
'user_id' => '1',
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN'
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN',
|
||||
];
|
||||
$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;
|
||||
$_this = new self();
|
||||
$respose = $_this->callGetApi($url);
|
||||
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function getSearch() {
|
||||
public function getSearch()
|
||||
{
|
||||
$search = [
|
||||
'search' => 'api',
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN'
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN',
|
||||
];
|
||||
$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;
|
||||
$_this = new self();
|
||||
$respose = $_this->callGetApi($url);
|
||||
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function ticketThreads() {
|
||||
public function ticketThreads()
|
||||
{
|
||||
$search = [
|
||||
'id' => '1',
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN'
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN',
|
||||
];
|
||||
$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;
|
||||
$_this = new self();
|
||||
$respose = $_this->callGetApi($url);
|
||||
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function url() {
|
||||
public function url()
|
||||
{
|
||||
$search = [
|
||||
'url' => 'http://localhost/faveo-helpdesk-github/public/',
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN'
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN',
|
||||
];
|
||||
$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;
|
||||
$_this = new self();
|
||||
$respose = $_this->callGetApi($url);
|
||||
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function generateApiKey() {
|
||||
$url = $this->server . "helpdesk/api_key?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
public function generateApiKey()
|
||||
{
|
||||
$url = $this->server.'helpdesk/api_key?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token='.\Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->callGetApi($url);
|
||||
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function getHelpTopic() {
|
||||
$url = $this->server . "helpdesk/help-topic?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
public function getHelpTopic()
|
||||
{
|
||||
$url = $this->server.'helpdesk/help-topic?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token='.\Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->callGetApi($url);
|
||||
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function getSlaPlan() {
|
||||
$url = $this->server . "helpdesk/sla-plan?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
public function getSlaPlan()
|
||||
{
|
||||
$url = $this->server.'helpdesk/sla-plan?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token='.\Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->callGetApi($url);
|
||||
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function getPriority() {
|
||||
$url = $this->server . "helpdesk/priority?api_key=clYbe1g7BYVEJznBdvCEBR0xDCLDqKgg&token=" . \Config::get('app.token');
|
||||
public function getPriority()
|
||||
{
|
||||
$url = $this->server.'helpdesk/priority?api_key=clYbe1g7BYVEJznBdvCEBR0xDCLDqKgg&token='.\Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->callGetApi($url);
|
||||
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function getDepartment() {
|
||||
$url = $this->server . "helpdesk/department?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
public function getDepartment()
|
||||
{
|
||||
$url = $this->server.'helpdesk/department?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token='.\Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->callGetApi($url);
|
||||
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function getTickets() {
|
||||
$url = $this->server . "helpdesk/tickets?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
public function getTickets()
|
||||
{
|
||||
$url = $this->server.'helpdesk/tickets?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token='.\Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->callGetApi($url);
|
||||
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function inbox() {
|
||||
$url = $this->server . "helpdesk/inbox?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
public function inbox()
|
||||
{
|
||||
$url = $this->server.'helpdesk/inbox?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token='.\Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->callGetApi($url);
|
||||
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function internalNote() {
|
||||
public function internalNote()
|
||||
{
|
||||
$data = [
|
||||
'ticketid' => '1',
|
||||
'userid' => 1,
|
||||
'body' => 'Testing the api internal note',
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN'
|
||||
'api_key' => '9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN',
|
||||
];
|
||||
$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();
|
||||
$respose = $_this->callPostApi($url, $data);
|
||||
|
||||
return $respose;
|
||||
}
|
||||
|
||||
public function trash() {
|
||||
$url = $this->server . "helpdesk/trash?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
|
||||
public function trash()
|
||||
{
|
||||
$url = $this->server.'helpdesk/trash?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token='.\Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->callGetApi($url);
|
||||
|
||||
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');
|
||||
$url = $this->server.'helpdesk/my-tickets?user_id=1&api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token='.\Config::get('app.token');
|
||||
$_this = new self();
|
||||
$respose = $_this->callGetApi($url);
|
||||
|
||||
return $respose;
|
||||
} catch (\Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
$line = $e->getLine();
|
||||
$file = $e->getFile();
|
||||
|
||||
return response()->json(compact('error', 'file', 'line'));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -2,70 +2,72 @@
|
||||
|
||||
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 Auth;
|
||||
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\Http\Controllers\Controller;
|
||||
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 Input;
|
||||
use Mail;
|
||||
|
||||
/**
|
||||
* -----------------------------------------------------------------------------
|
||||
* Ticket Controller
|
||||
* -----------------------------------------------------------------------------
|
||||
* -----------------------------------------------------------------------------.
|
||||
*
|
||||
*
|
||||
* @author Vijay Sebastian <vijay.sebastian@ladybirdweb.com>
|
||||
* @copyright (c) 2016, Ladybird Web Solution
|
||||
* @name Faveo HELPDESK
|
||||
*
|
||||
* @version v1
|
||||
*
|
||||
*
|
||||
*/
|
||||
class TicketController extends Controller {
|
||||
|
||||
class TicketController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return type response
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
$PhpMailController = new PhpMailController();
|
||||
$this->PhpMailController = $PhpMailController;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create Ticket
|
||||
* Create Ticket.
|
||||
*
|
||||
* @param type $user_id
|
||||
* @param type $subject
|
||||
* @param type $body
|
||||
* @param type $helptopic
|
||||
* @param type $sla
|
||||
* @param type $priority
|
||||
*
|
||||
* @return type string
|
||||
*/
|
||||
public function 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 {
|
||||
$max_number = Tickets::whereRaw('id = (select max(`id`) from tickets)')->first();
|
||||
//dd($max_number);
|
||||
if ($max_number == null) {
|
||||
$ticket_number = "AAAA-9999-9999999";
|
||||
$ticket_number = 'AAAA-9999-9999999';
|
||||
} else {
|
||||
foreach ($max_number as $number) {
|
||||
$ticket_number = $max_number->ticket_number;
|
||||
}
|
||||
}
|
||||
$ticket = new Tickets;
|
||||
$ticket = new Tickets();
|
||||
$ticket->ticket_number = $this->ticketNumber($ticket_number);
|
||||
//dd($this->ticketNumber($ticket_number));
|
||||
$ticket->user_id = $user_id;
|
||||
@@ -86,7 +88,7 @@ class TicketController extends Controller {
|
||||
foreach ($form_data as $key => $form_details) {
|
||||
foreach ($forms as $from) {
|
||||
if ($from->name == $key) {
|
||||
$form_value = new Ticket_Form_Data;
|
||||
$form_value = new Ticket_Form_Data();
|
||||
$form_value->ticket_id = $id;
|
||||
$form_value->title = $from->label;
|
||||
$form_value->content = $form_details;
|
||||
@@ -96,27 +98,30 @@ class TicketController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
$this->storeCollaborators($headers, $id);
|
||||
|
||||
$thread = $this->ticketThread($subject, $body, $id, $user_id);
|
||||
if (!empty($attach)) {
|
||||
$this->attach($thread, $attach);
|
||||
}
|
||||
|
||||
return $thread;
|
||||
} catch (\Exception $e) {
|
||||
dd($e);
|
||||
|
||||
return $e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* store_collaborators
|
||||
* store_collaborators.
|
||||
*
|
||||
* @param type $headers
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function storeCollaborators($headers, $id) {
|
||||
public function storeCollaborators($headers, $id)
|
||||
{
|
||||
try {
|
||||
$company = $this->company();
|
||||
if (isset($headers)) {
|
||||
@@ -124,11 +129,11 @@ class TicketController extends Controller {
|
||||
$name = $name;
|
||||
$email = $email;
|
||||
if ($this->checkEmail($email) == false) {
|
||||
$create_user = new User;
|
||||
$create_user = new User();
|
||||
$create_user->user_name = $name;
|
||||
$create_user->email = $email;
|
||||
$create_user->active = 1;
|
||||
$create_user->role = "user";
|
||||
$create_user->role = 'user';
|
||||
$password = $this->generateRandomString();
|
||||
$create_user->password = Hash::make($password);
|
||||
$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]);
|
||||
|
||||
} else {
|
||||
$user = $this->checkEmail($email);
|
||||
$user_id = $user->id;
|
||||
}
|
||||
$collaborator_store = new Ticket_Collaborator;
|
||||
$collaborator_store = new Ticket_Collaborator();
|
||||
$collaborator_store->isactive = 1;
|
||||
$collaborator_store->ticket_id = $id;
|
||||
$collaborator_store->user_id = $user_id;
|
||||
$collaborator_store->role = "ccc";
|
||||
$collaborator_store->role = 'ccc';
|
||||
$collaborator_store->save();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
return $e->getMessage();
|
||||
@@ -158,22 +163,26 @@ class TicketController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate Ticket Thread
|
||||
* Generate Ticket Thread.
|
||||
*
|
||||
* @param type $subject
|
||||
* @param type $body
|
||||
* @param type $id
|
||||
* @param type $user_id
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function ticketThread($subject, $body, $id, $user_id) {
|
||||
public function ticketThread($subject, $body, $id, $user_id)
|
||||
{
|
||||
try {
|
||||
$thread = new Ticket_Thread;
|
||||
$thread = new Ticket_Thread();
|
||||
$thread->user_id = $user_id;
|
||||
$thread->ticket_id = $id;
|
||||
$thread->poster = 'client';
|
||||
$thread->title = $subject;
|
||||
$thread->body = $body;
|
||||
$thread->save();
|
||||
|
||||
return $thread->id;
|
||||
} catch (\Exception $e) {
|
||||
return $e->getMessage();
|
||||
@@ -181,11 +190,14 @@ class TicketController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates Ticket Number
|
||||
* Generates Ticket Number.
|
||||
*
|
||||
* @param type $ticket_number
|
||||
*
|
||||
* @return type integer
|
||||
*/
|
||||
public function ticketNumber($ticket_number) {
|
||||
public function ticketNumber($ticket_number)
|
||||
{
|
||||
try {
|
||||
//dd($ticket_number);
|
||||
$number = $ticket_number;
|
||||
@@ -207,21 +219,26 @@ class TicketController extends Controller {
|
||||
$number3++;
|
||||
$number2 = sprintf('%04s', $number2);
|
||||
$number3 = sprintf('%07s', $number3);
|
||||
$array = array($number1, $number2, $number3);
|
||||
$array = [$number1, $number2, $number3];
|
||||
$number = implode('-', $array);
|
||||
|
||||
return $number;
|
||||
} catch (\Exception $e) {
|
||||
dd($e);
|
||||
|
||||
return $e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a random string for password
|
||||
* Generate a random string for password.
|
||||
*
|
||||
* @param type $length
|
||||
*
|
||||
* @return type string
|
||||
*/
|
||||
public function generateRandomString($length = 10) {
|
||||
public function generateRandomString($length = 10)
|
||||
{
|
||||
try {
|
||||
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
$charactersLength = strlen($characters);
|
||||
@@ -229,6 +246,7 @@ class TicketController extends Controller {
|
||||
for ($i = 0; $i < $length; $i++) {
|
||||
$randomString .= $characters[rand(0, $charactersLength - 1)];
|
||||
}
|
||||
|
||||
return $randomString;
|
||||
} catch (\Exception $e) {
|
||||
return $e->getMessage();
|
||||
@@ -236,14 +254,16 @@ class TicketController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Replying a ticket
|
||||
* Replying a ticket.
|
||||
*
|
||||
* @param type Ticket_Thread $thread
|
||||
* @param type TicketRequest $request
|
||||
*
|
||||
* @return type bool
|
||||
*/
|
||||
public function reply($thread, $request, $ta, $attach = '') {
|
||||
public function reply($thread, $request, $ta, $attach = '')
|
||||
{
|
||||
try {
|
||||
|
||||
$check_attachment = null;
|
||||
$eventthread = $thread->where('ticket_id', $request->input('ticket_ID'))->first();
|
||||
$eventuserid = $eventthread->user_id;
|
||||
@@ -266,11 +286,11 @@ class TicketController extends Controller {
|
||||
if ($tickets->assigned_to == 0) {
|
||||
$tickets->assigned_to = Auth::user()->id;
|
||||
$tickets->save();
|
||||
$thread2 = New Ticket_Thread;
|
||||
$thread2 = new Ticket_Thread();
|
||||
$thread2->ticket_id = $thread->ticket_id;
|
||||
$thread2->user_id = Auth::user()->id;
|
||||
$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();
|
||||
}
|
||||
if ($tickets->status > 1) {
|
||||
@@ -280,7 +300,6 @@ class TicketController extends Controller {
|
||||
}
|
||||
$thread->save();
|
||||
|
||||
|
||||
if (!empty($attach)) {
|
||||
$check_attachment = $this->attach($thread->id, $attach);
|
||||
}
|
||||
@@ -315,20 +334,18 @@ class TicketController extends Controller {
|
||||
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]);
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
$collaborators = Ticket_Collaborator::where('ticket_id', '=', $ticket_id)->get();
|
||||
foreach ($collaborators as $collaborator) {
|
||||
//mail to collaborators
|
||||
$collab_user_id = $collaborator->user_id;
|
||||
$user_id_collab = User::where('id', '=', $collab_user_id)->first();
|
||||
$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;
|
||||
} 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) {
|
||||
// $message->to($collab_email, $collab_user_name)->subject($ticket_subject . '[#' . $ticket_number . ']');
|
||||
@@ -343,11 +360,9 @@ 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]);
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
return $thread;
|
||||
} catch (\Exception $e) {
|
||||
return $e->getMessage();
|
||||
@@ -355,17 +370,20 @@ try {
|
||||
}
|
||||
|
||||
/**
|
||||
* company
|
||||
* company.
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function company() {
|
||||
public function company()
|
||||
{
|
||||
try {
|
||||
$company = Company::Where('id', '=', '1')->first();
|
||||
if ($company->company_name == null) {
|
||||
$company = "Support Center";
|
||||
$company = 'Support Center';
|
||||
} else {
|
||||
$company = $company->company_name;
|
||||
}
|
||||
|
||||
return $company;
|
||||
} catch (\Exception $e) {
|
||||
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_Thread $thread
|
||||
*
|
||||
* @return type bool
|
||||
*/
|
||||
public function ticketEditPost($ticket_id, $thread, $ticket) {
|
||||
public function ticketEditPost($ticket_id, $thread, $ticket)
|
||||
{
|
||||
try {
|
||||
|
||||
$ticket = $ticket->where('id', '=', $ticket_id)->first();
|
||||
|
||||
$ticket->sla = Input::get("sla_plan");
|
||||
$ticket->help_topic_id = Input::get("help_topic");
|
||||
$ticket->source = Input::get("ticket_source");
|
||||
$ticket->priority_id = Input::get("ticket_priority");
|
||||
$ticket->sla = Input::get('sla_plan');
|
||||
$ticket->help_topic_id = Input::get('help_topic');
|
||||
$ticket->source = Input::get('ticket_source');
|
||||
$ticket->priority_id = Input::get('ticket_priority');
|
||||
$ticket->save();
|
||||
|
||||
$threads = $thread->where('ticket_id', '=', $ticket_id)->first();
|
||||
$threads->title = Input::get("subject");
|
||||
$threads->title = Input::get('subject');
|
||||
$threads->save();
|
||||
|
||||
return $threads;
|
||||
} catch (\Exception $e) {
|
||||
return $e->getMessage();
|
||||
@@ -399,11 +420,14 @@ try {
|
||||
}
|
||||
|
||||
/**
|
||||
* function to assign ticket
|
||||
* function to assign ticket.
|
||||
*
|
||||
* @param type $id
|
||||
*
|
||||
* @return type bool
|
||||
*/
|
||||
public function assign($id) {
|
||||
public function assign($id)
|
||||
{
|
||||
try {
|
||||
$UserEmail = Input::get('user');
|
||||
//dd($UserEmail);
|
||||
@@ -425,11 +449,11 @@ try {
|
||||
return ['error' => 'No thread not found'];
|
||||
}
|
||||
$ticket_subject = $ticket_thread->title;
|
||||
$thread = New Ticket_Thread;
|
||||
$thread = new Ticket_Thread();
|
||||
$thread->ticket_id = $ticket->id;
|
||||
$thread->user_id = Auth::user()->id;
|
||||
$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();
|
||||
|
||||
$company = $this->company();
|
||||
@@ -438,7 +462,7 @@ try {
|
||||
$agent = $user->first_name;
|
||||
$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) {
|
||||
// // 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) {
|
||||
@@ -450,9 +474,6 @@ try {
|
||||
} catch (\Exception $e) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
return 1;
|
||||
@@ -462,13 +483,15 @@ try {
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to delete ticket
|
||||
* Function to delete ticket.
|
||||
*
|
||||
* @param type $id
|
||||
* @param type Tickets $ticket
|
||||
*
|
||||
* @return type string
|
||||
*/
|
||||
public function delete($ids, $ticket) {
|
||||
|
||||
public function delete($ids, $ticket)
|
||||
{
|
||||
try {
|
||||
foreach ($ids as $id) {
|
||||
$ticket_delete = $ticket->where('id', '=', $id)->first();
|
||||
@@ -496,29 +519,33 @@ try {
|
||||
$ticket_delete->status = 5;
|
||||
$ticket_delete->save();
|
||||
$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->user_id = Auth::user()->id;
|
||||
$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();
|
||||
}
|
||||
} else {
|
||||
return "ticket not found";
|
||||
return 'ticket not found';
|
||||
}
|
||||
}
|
||||
return "your tickets has been deleted";
|
||||
|
||||
return 'your tickets has been deleted';
|
||||
} catch (\Exception $e) {
|
||||
return $e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* check email for dublicate entry
|
||||
* check email for dublicate entry.
|
||||
*
|
||||
* @param type $email
|
||||
*
|
||||
* @return type bool
|
||||
*/
|
||||
public function checkEmail($email) {
|
||||
public function checkEmail($email)
|
||||
{
|
||||
try {
|
||||
$check = User::where('email', '=', $email)->first();
|
||||
if ($check == true) {
|
||||
@@ -532,17 +559,20 @@ try {
|
||||
}
|
||||
|
||||
/**
|
||||
* system
|
||||
* system.
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function system() {
|
||||
public function system()
|
||||
{
|
||||
try {
|
||||
$system = System::Where('id', '=', '1')->first();
|
||||
if ($system->name == null) {
|
||||
$system = "Support Center";
|
||||
$system = 'Support Center';
|
||||
} else {
|
||||
$system = $system->name;
|
||||
}
|
||||
|
||||
return $system;
|
||||
} catch (\Exception $e) {
|
||||
return $e->getMessage();
|
||||
@@ -550,22 +580,25 @@ try {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create Attachment
|
||||
* Create Attachment.
|
||||
*
|
||||
* @param type $thread
|
||||
* @param type $attach
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function attach($thread, $attach) {
|
||||
public function attach($thread, $attach)
|
||||
{
|
||||
try {
|
||||
$ta = new Ticket_attachments();
|
||||
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' => $name, 'size' => $size, 'type' => $type, 'file' => $file, 'poster' => 'ATTACHMENT']);
|
||||
|
||||
return 1;
|
||||
} catch (\Exception $e) {
|
||||
return $e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -3,39 +3,40 @@
|
||||
namespace App\Http\Controllers\Api\v1;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\User;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use JWTAuth;
|
||||
use Tymon\JWTAuth\Exceptions\JWTException;
|
||||
use App\Http\Requests;
|
||||
use Illuminate\Http\Request;
|
||||
use App\User;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
|
||||
/**
|
||||
* -----------------------------------------------------------------------------
|
||||
* Token authenticate Controller
|
||||
* -----------------------------------------------------------------------------
|
||||
* -----------------------------------------------------------------------------.
|
||||
*
|
||||
*
|
||||
* @author Vijay Sebastian <vijay.sebastian@ladybirdweb.com>
|
||||
* @copyright (c) 2016, Ladybird Web Solution
|
||||
* @name Faveo HELPDESK
|
||||
*
|
||||
* @version v1
|
||||
*
|
||||
*
|
||||
*/
|
||||
class TokenAuthController extends Controller {
|
||||
|
||||
public function __construct() {
|
||||
class TokenAuthController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('api');
|
||||
}
|
||||
|
||||
/**
|
||||
* Authenticating user with username and password and retuen token
|
||||
* Authenticating user with username and password and retuen token.
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return type json
|
||||
*/
|
||||
public function authenticate(Request $request) {
|
||||
|
||||
public function authenticate(Request $request)
|
||||
{
|
||||
$usernameinput = $request->input('username');
|
||||
$password = $request->input('password');
|
||||
$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]);
|
||||
} catch (\Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
|
||||
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
|
||||
*/
|
||||
public function getAuthenticatedUser() {
|
||||
public function getAuthenticatedUser()
|
||||
{
|
||||
//dd(JWTAuth::parseToken()->authenticate());
|
||||
try {
|
||||
|
||||
if (!$user = JWTAuth::parseToken()->authenticate()) {
|
||||
return response()->json(['user_not_found', 404]);
|
||||
}
|
||||
} catch (\Tymon\JWTAuth\Exceptions\TokenExpiredException $e) {
|
||||
|
||||
return response()->json(['token_expired', $e->getStatusCode()]);
|
||||
} catch (\Tymon\JWTAuth\Exceptions\TokenInvalidException $e) {
|
||||
|
||||
return response()->json(['token_invalid', $e->getStatusCode()]);
|
||||
} catch (\Tymon\JWTAuth\Exceptions\JWTException $e) {
|
||||
|
||||
return response()->json(['token_absent', $e->getStatusCode()]);
|
||||
} catch (\Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
//dd($user);
|
||||
@@ -86,11 +87,14 @@ class TokenAuthController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a user with username and password
|
||||
* Register a user with username and password.
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return type json
|
||||
*/
|
||||
public function register(Request $request) {
|
||||
public function register(Request $request)
|
||||
{
|
||||
try {
|
||||
$v = \Validator::make($request->all(), [
|
||||
'email' => 'required|email|unique:users',
|
||||
@@ -98,6 +102,7 @@ class TokenAuthController extends Controller {
|
||||
]);
|
||||
if ($v->fails()) {
|
||||
$error = $v->errors();
|
||||
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
$newuser = $request->all();
|
||||
@@ -108,21 +113,25 @@ class TokenAuthController extends Controller {
|
||||
return User::create($newuser);
|
||||
} catch (\Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* verify the url is existing or not
|
||||
* verify the url is existing or not.
|
||||
*
|
||||
* @return type json
|
||||
*/
|
||||
public function checkUrl() {
|
||||
public function checkUrl()
|
||||
{
|
||||
try {
|
||||
$v = \Validator::make($request->all(), [
|
||||
'url' => 'required|url'
|
||||
'url' => 'required|url',
|
||||
]);
|
||||
if ($v->fails()) {
|
||||
$error = $v->errors();
|
||||
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
|
||||
@@ -130,8 +139,8 @@ class TokenAuthController extends Controller {
|
||||
$url = $url.'/api/v1/helpdesk/check-url';
|
||||
} catch (Exception $ex) {
|
||||
$error = $e->getMessage();
|
||||
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -3,21 +3,20 @@
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Controllers\Common\SettingsController;
|
||||
use App\Http\Controllers\Common\PhpMailController;
|
||||
use App\Http\Controllers\Common\SettingsController;
|
||||
use App\Http\Controllers\Controller;
|
||||
// requests
|
||||
use App\Http\Requests\helpdesk\LoginRequest;
|
||||
use App\Http\Requests\helpdesk\RegisterRequest;
|
||||
use App\User;
|
||||
// classes
|
||||
use Auth;
|
||||
use Hash;
|
||||
use Illuminate\Contracts\Auth\Guard;
|
||||
use Illuminate\Contracts\Auth\Registrar;
|
||||
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;
|
||||
use Mail;
|
||||
use Auth;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* ---------------------------------------------------
|
||||
@@ -27,12 +26,10 @@ use Exception;
|
||||
* authentication of existing users. By default, this controller uses
|
||||
* a simple trait to add these behaviors. Why don't you explore it?
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class AuthController extends Controller {
|
||||
|
||||
class AuthController extends Controller
|
||||
{
|
||||
use AuthenticatesAndRegistersUsers;
|
||||
/* to redirect after login */
|
||||
|
||||
@@ -49,9 +46,11 @@ class AuthController extends Controller {
|
||||
*
|
||||
* @param \Illuminate\Contracts\Auth\Guard $auth
|
||||
* @param \Illuminate\Contracts\Auth\Registrar $registrar
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Guard $auth, Registrar $registrar, PhpMailController $PhpMailController) {
|
||||
public function __construct(Guard $auth, Registrar $registrar, PhpMailController $PhpMailController)
|
||||
{
|
||||
$this->PhpMailController = $PhpMailController;
|
||||
SettingsController::smtp();
|
||||
$this->auth = $auth;
|
||||
@@ -60,16 +59,18 @@ class AuthController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the form for registration
|
||||
* Get the form for registration.
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function getRegister() {
|
||||
public function getRegister()
|
||||
{
|
||||
// Event for login
|
||||
\Event::fire(new \App\Events\FormRegisterEvent());
|
||||
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');
|
||||
} elseif (Auth::user()->role == "user") {
|
||||
} elseif (Auth::user()->role == 'user') {
|
||||
// return view('auth.register');
|
||||
}
|
||||
} else {
|
||||
@@ -78,12 +79,15 @@ class AuthController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Post registration form
|
||||
* Post registration form.
|
||||
*
|
||||
* @param type User $user
|
||||
* @param type RegisterRequest $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function postRegister(User $user, RegisterRequest $request) {
|
||||
public function postRegister(User $user, RegisterRequest $request)
|
||||
{
|
||||
// Event for login
|
||||
\Event::fire(new \App\Events\LoginEvent($request));
|
||||
|
||||
@@ -107,22 +111,24 @@ class AuthController extends Controller {
|
||||
|
||||
$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');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get mail function
|
||||
* Get mail function.
|
||||
*
|
||||
* @param type $token
|
||||
* @param type User $user
|
||||
*
|
||||
* @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();
|
||||
if ($user) {
|
||||
$user->active = 1;
|
||||
$user->save();
|
||||
|
||||
return redirect('auth/login');
|
||||
} else {
|
||||
return redirect('auth/login');
|
||||
@@ -130,14 +136,16 @@ class AuthController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get login page
|
||||
* Get login page.
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function getLogin() {
|
||||
public function getLogin()
|
||||
{
|
||||
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');
|
||||
} elseif (Auth::user()->role == "user") {
|
||||
} elseif (Auth::user()->role == 'user') {
|
||||
return \Redirect::route('home');
|
||||
}
|
||||
} else {
|
||||
@@ -146,11 +154,14 @@ class AuthController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Post of login page
|
||||
* Post of login page.
|
||||
*
|
||||
* @param type LoginRequest $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function postLogin(LoginRequest $request) {
|
||||
public function postLogin(LoginRequest $request)
|
||||
{
|
||||
// Set login attempts and login time
|
||||
$loginAttempts = 1;
|
||||
$usernameinput = $request->input('email');
|
||||
@@ -186,6 +197,7 @@ class AuthController extends Controller {
|
||||
return redirect()->intended($this->redirectPath());
|
||||
}
|
||||
}
|
||||
|
||||
return redirect($this->loginPath())
|
||||
->withInput($request->only('email', 'remember'))
|
||||
->withErrors([
|
||||
@@ -196,11 +208,12 @@ class AuthController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Failed login message
|
||||
* Get Failed login message.
|
||||
*
|
||||
* @return type string
|
||||
*/
|
||||
protected function getFailedLoginMessage() {
|
||||
protected function getFailedLoginMessage()
|
||||
{
|
||||
return 'This Field do not match our records.';
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -3,29 +3,25 @@
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Controllers\Common\SettingsController;
|
||||
use App\Http\Controllers\Common\PhpMailController;
|
||||
use App\Http\Controllers\Common\SettingsController;
|
||||
use App\Http\Controllers\Controller;
|
||||
// request
|
||||
use Illuminate\Http\Request;
|
||||
// model
|
||||
use App\User;
|
||||
// classes
|
||||
// model
|
||||
use Illuminate\Contracts\Auth\Guard;
|
||||
// classes
|
||||
use Illuminate\Contracts\Auth\PasswordBroker;
|
||||
use Illuminate\Foundation\Auth\ResetsPasswords;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use Exception;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
/**
|
||||
* PasswordController
|
||||
* PasswordController.
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class PasswordController extends Controller {
|
||||
|
||||
class PasswordController extends Controller
|
||||
{
|
||||
use ResetsPasswords;
|
||||
|
||||
/**
|
||||
@@ -33,9 +29,11 @@ class PasswordController extends Controller {
|
||||
*
|
||||
* @param \Illuminate\Contracts\Auth\Guard $auth
|
||||
* @param \Illuminate\Contracts\Auth\PasswordBroker $passwords
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Guard $auth, PasswordBroker $passwords, PhpMailController $PhpMailController) {
|
||||
public function __construct(Guard $auth, PasswordBroker $passwords, PhpMailController $PhpMailController)
|
||||
{
|
||||
$this->PhpMailController = $PhpMailController;
|
||||
$this->auth = $auth;
|
||||
$this->passwords = $passwords;
|
||||
@@ -48,7 +46,8 @@ class PasswordController extends Controller {
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function getEmail() {
|
||||
public function getEmail()
|
||||
{
|
||||
return view('auth.password');
|
||||
}
|
||||
|
||||
@@ -57,7 +56,8 @@ class PasswordController extends Controller {
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function postEmail(Request $request) {
|
||||
public function postEmail(Request $request)
|
||||
{
|
||||
$date = date('Y-m-d H:i:s');
|
||||
$this->validate($request, ['email' => 'required|email']);
|
||||
$user = User::where('email', '=', $request->only('email'))->first();
|
||||
@@ -67,7 +67,6 @@ class PasswordController extends Controller {
|
||||
$code = str_random(60);
|
||||
$password_reset_table = \DB::table('password_resets')->where('email', '=', $user->email)->first();
|
||||
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->token = $code;
|
||||
// $password_reset_table->update(['token' => $code]);
|
||||
@@ -82,5 +81,4 @@ class PasswordController extends Controller {
|
||||
return redirect()->back()->with('errors', "We can't find a user with that e-mail address.");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -32,24 +32,23 @@ use Input;
|
||||
use Redirect;
|
||||
|
||||
/**
|
||||
* UserController
|
||||
* UserController.
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class UserController extends Controller {
|
||||
|
||||
class UserController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* constructor to check
|
||||
* 1. authentication
|
||||
* 2. user roles
|
||||
* 3. roles must be agent
|
||||
* 3. roles must be agent.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
$this->middleware('role.agent');
|
||||
// $this->middleware('roles');
|
||||
@@ -57,10 +56,13 @@ class UserController extends Controller {
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @param type User $user
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function index() {
|
||||
public function index()
|
||||
{
|
||||
try {
|
||||
/* get all values in Sys_user */
|
||||
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
|
||||
*/
|
||||
public function user_list() {
|
||||
|
||||
public function user_list()
|
||||
{
|
||||
return \Datatable::collection(User::where('role', '!=', 'admin')->where('role', '!=', 'agent')->get())
|
||||
->searchColumns('user_name')
|
||||
->orderColumns('user_name', 'email')
|
||||
@@ -83,18 +86,20 @@ class UserController extends Controller {
|
||||
})
|
||||
->addColumn('email', function ($model) {
|
||||
$email = $model->email;
|
||||
|
||||
return $email;
|
||||
})
|
||||
->addColumn('phone', function ($model) {
|
||||
$phone = "";
|
||||
$phone = '';
|
||||
if ($model->phone_number) {
|
||||
$phone = $model->ext.' '.$model->phone_number;
|
||||
}
|
||||
$mobile = "";
|
||||
$mobile = '';
|
||||
if ($model->mobile) {
|
||||
$mobile = $model->mobile;
|
||||
}
|
||||
$phone = $phone . " " . $mobile;
|
||||
$phone = $phone.' '.$mobile;
|
||||
|
||||
return $phone;
|
||||
})
|
||||
->addColumn('status', function ($model) {
|
||||
@@ -104,10 +109,12 @@ class UserController extends Controller {
|
||||
} else {
|
||||
$stat = '<button class="btn btn-danger btn-xs">Inactive</button>';
|
||||
}
|
||||
|
||||
return $stat;
|
||||
})
|
||||
->addColumn('lastlogin', function ($model) {
|
||||
$t = $model->updated_at;
|
||||
|
||||
return TicketController::usertimezone($t);
|
||||
})
|
||||
->addColumn('Actions', function ($model) {
|
||||
@@ -137,9 +144,11 @@ class UserController extends Controller {
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function create() {
|
||||
public function create()
|
||||
{
|
||||
try {
|
||||
return view('themes.default1.agent.helpdesk.user.create');
|
||||
} catch (Exception $e) {
|
||||
@@ -149,11 +158,14 @@ class UserController extends Controller {
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param type User $user
|
||||
* @param type Sys_userRequest $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function store(User $user, Sys_userRequest $request) {
|
||||
public function store(User $user, Sys_userRequest $request)
|
||||
{
|
||||
try {
|
||||
/* insert the input request to sys_user table */
|
||||
/* Check whether function success or not */
|
||||
@@ -180,14 +192,18 @@ class UserController extends Controller {
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type User $user
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function show($id, User $user) {
|
||||
public function show($id, User $user)
|
||||
{
|
||||
try {
|
||||
/* select the field where id = $id(request Id) */
|
||||
$users = $user->whereId($id)->first();
|
||||
|
||||
return view('themes.default1.agent.helpdesk.user.show', compact('users'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
@@ -196,14 +212,18 @@ class UserController extends Controller {
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type User $user
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function edit($id, User $user) {
|
||||
public function edit($id, User $user)
|
||||
{
|
||||
try {
|
||||
/* select the field where id = $id(request Id) */
|
||||
$users = $user->whereId($id)->first();
|
||||
|
||||
return view('themes.default1.agent.helpdesk.user.edit', compact('users'));
|
||||
} catch (Exception $e) {
|
||||
return view('404');
|
||||
@@ -212,12 +232,15 @@ class UserController extends Controller {
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type User $user
|
||||
* @param type Sys_userUpdate $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function update($id, User $user, Sys_userUpdate $request) {
|
||||
public function update($id, User $user, Sys_userUpdate $request)
|
||||
{
|
||||
try {
|
||||
/* select the field where id = $id(request Id) */
|
||||
$users = $user->whereId($id)->first();
|
||||
@@ -238,11 +261,14 @@ class UserController extends Controller {
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type User $user
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function destroy($id, User $user) {
|
||||
public function destroy($id, User $user)
|
||||
{
|
||||
try {
|
||||
/* select the field where id = $id(request Id) */
|
||||
$users = $user->whereId($id)->first();
|
||||
@@ -262,30 +288,39 @@ class UserController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* get profile page
|
||||
* get profile page.
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function getProfile() {
|
||||
public function getProfile()
|
||||
{
|
||||
$user = Auth::user();
|
||||
|
||||
return view('themes.default1.agent.helpdesk.user.profile', compact('user'));
|
||||
}
|
||||
|
||||
/**
|
||||
* get profile edit page
|
||||
* get profile edit page.
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function getProfileedit() {
|
||||
public function getProfileedit()
|
||||
{
|
||||
$user = Auth::user();
|
||||
|
||||
return view('themes.default1.agent.helpdesk.user.profile-edit', compact('user'));
|
||||
}
|
||||
|
||||
/**
|
||||
* post profile page
|
||||
* post profile page.
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type ProfileRequest $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function postProfileedit(ProfileRequest $request) {
|
||||
public function postProfileedit(ProfileRequest $request)
|
||||
{
|
||||
$user = Auth::user();
|
||||
$user->gender = $request->input('gender');
|
||||
$user->save();
|
||||
@@ -310,6 +345,7 @@ class UserController extends Controller {
|
||||
$user->profile_pic = $fileName;
|
||||
} else {
|
||||
$user->fill($request->except('profile_pic', 'gender'))->save();
|
||||
|
||||
return Redirect::route('profile')->with('success', 'Profile Updated sucessfully');
|
||||
}
|
||||
if ($user->fill($request->except('profile_pic'))->save()) {
|
||||
@@ -318,17 +354,21 @@ class UserController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Post profile password
|
||||
* Post profile password.
|
||||
*
|
||||
* @param type int $id
|
||||
* @param type ProfilePassword $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function postProfilePassword($id, ProfilePassword $request) {
|
||||
public function postProfilePassword($id, ProfilePassword $request)
|
||||
{
|
||||
$user = Auth::user();
|
||||
//echo $user->password;
|
||||
if (Hash::check($request->input('old_password'), $user->getAuthPassword())) {
|
||||
$user->password = Hash::make($request->input('new_password'));
|
||||
$user->save();
|
||||
|
||||
return redirect('profile-edit')->with('success1', 'Password Updated sucessfully');
|
||||
} else {
|
||||
return redirect('profile-edit')->with('fails1', 'Password was not Updated. Incorrect old password');
|
||||
@@ -336,25 +376,30 @@ class UserController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* User Assign Org
|
||||
* User Assign Org.
|
||||
*
|
||||
* @param type $id
|
||||
*
|
||||
* @return type boolean
|
||||
*/
|
||||
public function UserAssignOrg($id) {
|
||||
public function UserAssignOrg($id)
|
||||
{
|
||||
$org = Input::get('org');
|
||||
$user_org = new User_org;
|
||||
$user_org = new User_org();
|
||||
$user_org->org_id = $org;
|
||||
$user_org->user_id = $id;
|
||||
$user_org->save();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* user create organisation
|
||||
* user create organisation.
|
||||
*
|
||||
* @return type value
|
||||
*/
|
||||
public function User_Create_Org($id) {
|
||||
|
||||
public function User_Create_Org($id)
|
||||
{
|
||||
if (Input::get('website') != null) {
|
||||
// checking website
|
||||
$check = Organization::where('website', '=', Input::get('website'))->first();
|
||||
@@ -366,13 +411,13 @@ class UserController extends Controller {
|
||||
$check2 = Organization::where('name', '=', Input::get('name'))->first();
|
||||
|
||||
if (\Input::get('name') == null) {
|
||||
return "Name is required";
|
||||
return 'Name is required';
|
||||
} elseif ($check2 != null) {
|
||||
return "Name should be Unique";
|
||||
return 'Name should be Unique';
|
||||
} elseif ($check != null) {
|
||||
return "Website should be Unique";
|
||||
return 'Website should be Unique';
|
||||
} else {
|
||||
$org = new Organization;
|
||||
$org = new Organization();
|
||||
$org->name = Input::get('name');
|
||||
$org->phone = Input::get('phone');
|
||||
$org->website = Input::get('website');
|
||||
@@ -380,7 +425,7 @@ class UserController extends Controller {
|
||||
$org->internal_notes = Input::get('internal');
|
||||
$org->save();
|
||||
|
||||
$user_org = new User_org;
|
||||
$user_org = new User_org();
|
||||
$user_org->org_id = $org->id;
|
||||
$user_org->user_id = $id;
|
||||
$user_org->save();
|
||||
@@ -388,5 +433,4 @@ class UserController extends Controller {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -3,70 +3,60 @@
|
||||
namespace App\Http\Controllers\Client\helpdesk;
|
||||
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Controllers\Agent\helpdesk\TicketController;
|
||||
use App\Http\Controllers\Common\SettingsController;
|
||||
use App\Http\Controllers\Controller;
|
||||
// requests
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Requests\helpdesk\CreateTicketRequest;
|
||||
use App\Http\Requests\helpdesk\TicketRequest;
|
||||
use App\Http\Requests\helpdesk\TicketEditRequest;
|
||||
// models
|
||||
use App\Model\helpdesk\Email\Banlist;
|
||||
use App\Model\helpdesk\Ticket\Tickets;
|
||||
use App\Model\helpdesk\Ticket\Ticket_attachments;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Collaborator;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Thread;
|
||||
use App\Model\helpdesk\Settings\Company;
|
||||
use App\Model\helpdesk\Settings\System;
|
||||
use App\Model\helpdesk\Settings\Alert;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Status;
|
||||
use App\Model\helpdesk\Email\Emails;
|
||||
use App\Model\helpdesk\Agent\Department;
|
||||
// models
|
||||
use App\Model\helpdesk\Ticket\Tickets;
|
||||
use App\User;
|
||||
// classes
|
||||
use Auth;
|
||||
use Hash;
|
||||
use Input;
|
||||
use Mail;
|
||||
use PDF;
|
||||
// classes
|
||||
use Exception;
|
||||
use Illuminate\Http\Request;
|
||||
use Input;
|
||||
|
||||
/**
|
||||
* TicketController2
|
||||
* TicketController2.
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class ClientTicketController extends Controller {
|
||||
|
||||
class ClientTicketController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return type response
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
SettingsController::smtp();
|
||||
// $this->middleware('auth');
|
||||
// $this->middleware('role.user');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Checked ticket
|
||||
* Get Checked ticket.
|
||||
*
|
||||
* @param type Tickets $ticket
|
||||
* @param type User $user
|
||||
*
|
||||
* @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'));
|
||||
}
|
||||
|
||||
/**
|
||||
* reply
|
||||
* reply.
|
||||
*
|
||||
* @param type $value
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function reply($id, Request $request) {
|
||||
public function reply($id, Request $request)
|
||||
{
|
||||
$comment = $request->input('comment');
|
||||
if ($comment != null) {
|
||||
$tickets = Tickets::where('id', '=', $id)->first();
|
||||
@@ -74,14 +64,15 @@ class ClientTicketController extends Controller {
|
||||
$tickets->closed = 0;
|
||||
$tickets->reopened_at = date('Y-m-d H:i:s');
|
||||
$tickets->reopened = 1;
|
||||
$threads = new Ticket_Thread;
|
||||
$threads = new Ticket_Thread();
|
||||
$threads->user_id = Auth::user()->id;
|
||||
$threads->ticket_id = $tickets->id;
|
||||
$threads->poster = "client";
|
||||
$threads->poster = 'client';
|
||||
$threads->body = $comment;
|
||||
try {
|
||||
$threads->save();
|
||||
$tickets->save();
|
||||
|
||||
return \Redirect::back()->with('success1', 'Successfully replied');
|
||||
} catch (Exception $e) {
|
||||
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!');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -7,45 +7,47 @@ use App\Http\Controllers\Controller;
|
||||
// models
|
||||
use App\Model\helpdesk\Email\Emails;
|
||||
// classes
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* EmailController
|
||||
* EmailController.
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class OuthouseController extends Controller {
|
||||
|
||||
class EmailController extends Controller
|
||||
{
|
||||
/**
|
||||
* post port
|
||||
* post port.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function port() {
|
||||
public static function port()
|
||||
{
|
||||
$port = Emails::where('id', '=', '1')->first();
|
||||
$portvalue = $port->option_value;
|
||||
|
||||
return $portvalue;
|
||||
}
|
||||
|
||||
/**
|
||||
* post host
|
||||
* post host.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function host() {
|
||||
public static function host()
|
||||
{
|
||||
$host = Option::where('option_name', '=', 'host')->first();
|
||||
$hostvalue = $host->option_value;
|
||||
|
||||
return $hostvalue;
|
||||
}
|
||||
|
||||
/**
|
||||
* post username
|
||||
* post username.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function username() {
|
||||
public static function username()
|
||||
{
|
||||
$username = Option::where('option_name', '=', 'username')->first();
|
||||
$uservalue = $username->option_value;
|
||||
|
||||
@@ -53,11 +55,12 @@ class OuthouseController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* post passowrd
|
||||
* post passowrd.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function password() {
|
||||
public static function password()
|
||||
{
|
||||
$password = Option::where('option_name', '=', 'password')->first();
|
||||
$passvalue = $password->option_value;
|
||||
|
||||
@@ -65,15 +68,15 @@ class OuthouseController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* post encryption
|
||||
* post encryption.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function encryption() {
|
||||
public static function encryption()
|
||||
{
|
||||
$encryption = Option::where('option_name', '=', 'encryption')->first();
|
||||
$encryptvalue = $encryption->option_value;
|
||||
|
||||
return $encryptvalue;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -3,51 +3,44 @@
|
||||
namespace App\Http\Controllers\Client\helpdesk;
|
||||
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Controllers\Agent\helpdesk\TicketController;
|
||||
use App\Http\Controllers\Common\SettingsController;
|
||||
use App\Http\Controllers\Controller;
|
||||
// requests
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Requests\helpdesk\ClientRequest;
|
||||
use App\Model\helpdesk\Agent\Department;
|
||||
// models
|
||||
use App\Model\helpdesk\Form\Forms;
|
||||
use App\Model\helpdesk\Form\Fields;
|
||||
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\Ticket;
|
||||
use App\Model\helpdesk\Agent\Department;
|
||||
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\Model\helpdesk\Form\Fields;
|
||||
use App\Model\helpdesk\Form\Form_value;
|
||||
use Exception;
|
||||
// classes
|
||||
use Form;
|
||||
use Illuminate\Http\Request;
|
||||
use Input;
|
||||
use Mail;
|
||||
use Hash;
|
||||
use Redirect;
|
||||
use Config;
|
||||
use DateTime;
|
||||
use DateTimeZone;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* FormController
|
||||
* FormController.
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class FormController extends Controller {
|
||||
|
||||
class FormController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* Constructor to check
|
||||
* Constructor to check.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(TicketController $TicketController) {
|
||||
public function __construct(TicketController $TicketController)
|
||||
{
|
||||
// mail smtp settings
|
||||
SettingsController::smtp();
|
||||
// creating a TicketController instance
|
||||
@@ -55,16 +48,20 @@ class FormController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* getform
|
||||
* getform.
|
||||
*
|
||||
* @param type Help_topic $topic
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function getForm(Help_topic $topic) {
|
||||
public function getForm(Help_topic $topic)
|
||||
{
|
||||
if (\Config::get('database.install') == '%0%') {
|
||||
return \Redirect::route('license');
|
||||
}
|
||||
if (System::first()->status == 1) {
|
||||
$topics = $topic->get();
|
||||
|
||||
return view('themes.default1.client.helpdesk.form', compact('topics'));
|
||||
} else {
|
||||
return \Redirect::route('home');
|
||||
@@ -72,22 +69,25 @@ 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_details $details
|
||||
*
|
||||
* @return type string
|
||||
*/
|
||||
public function postForm($id, Help_topic $topic) {
|
||||
public function postForm($id, Help_topic $topic)
|
||||
{
|
||||
// dd($id);
|
||||
if ($id != 0) {
|
||||
$helptopic = $topic->where('id', '=', $id)->first();
|
||||
$custom_form = $helptopic->custom_form;
|
||||
$values = Fields::where('forms_id', '=', $custom_form)->get();
|
||||
if (!$values) {
|
||||
|
||||
} if ($values) {
|
||||
}
|
||||
if ($values) {
|
||||
foreach ($values as $value) {
|
||||
if ($value->type == "select") {
|
||||
if ($value->type == 'select') {
|
||||
$data = $value->value;
|
||||
$value = explode(',', $data);
|
||||
echo '<select class="form-control">';
|
||||
@@ -95,12 +95,12 @@ class FormController extends Controller {
|
||||
echo '<option>'.$option.'</option>';
|
||||
}
|
||||
echo '</select></br>';
|
||||
} elseif ($value->type == "radio") {
|
||||
} elseif ($value->type == 'radio') {
|
||||
$type2 = $value->value;
|
||||
$val = explode(',', $type2);
|
||||
echo '<label class="radio-inline">'.$value->label.'</label>   <input type="'.$value->type.'" name="'.$value->name.'"> '.$val[0].'
|
||||
   <input type="'.$value->type.'" name="'.$value->name.'"> '.$val[1].'</br>';
|
||||
} elseif ($value->type == "textarea") {
|
||||
} elseif ($value->type == 'textarea') {
|
||||
$type3 = $value->value;
|
||||
$v = explode(',', $type3);
|
||||
//dd($v);
|
||||
@@ -109,7 +109,7 @@ class FormController extends Controller {
|
||||
} else {
|
||||
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;
|
||||
$check = explode(',', $type4);
|
||||
echo '<label class="radio-inline">'.$value->label.'   <input type="'.$value->type.'" name="'.$value->name.'">  '.$check[0].'</label><label class="radio-inline"><input type="'.$value->type.'" name="'.$value->name.'">  '.$check[1].'</label></br>';
|
||||
@@ -119,17 +119,18 @@ class FormController extends Controller {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Posted form
|
||||
* Posted form.
|
||||
*
|
||||
* @param type Request $request
|
||||
* @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');
|
||||
|
||||
$name = $request->input('Name');
|
||||
@@ -157,26 +158,30 @@ class FormController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* reply
|
||||
* reply.
|
||||
*
|
||||
* @param type $value
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function post_ticket_reply($id, Request $request) {
|
||||
public function post_ticket_reply($id, Request $request)
|
||||
{
|
||||
$comment = $request->input('comment');
|
||||
if ($comment != null) {
|
||||
$tickets = Tickets::where('id', '=', $id)->first();
|
||||
$threads = new Ticket_Thread;
|
||||
$threads = new Ticket_Thread();
|
||||
$tickets->closed_at = null;
|
||||
$tickets->closed = 0;
|
||||
$tickets->reopened_at = date('Y-m-d H:i:s');
|
||||
$tickets->reopened = 1;
|
||||
$threads->user_id = $tickets->user_id;
|
||||
$threads->ticket_id = $tickets->id;
|
||||
$threads->poster = "client";
|
||||
$threads->poster = 'client';
|
||||
$threads->body = $comment;
|
||||
try {
|
||||
$threads->save();
|
||||
$tickets->save();
|
||||
|
||||
return \Redirect::back()->with('success1', 'Successfully replied');
|
||||
} catch (Exception $e) {
|
||||
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!');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -3,9 +3,9 @@
|
||||
namespace App\Http\Controllers\Client\helpdesk;
|
||||
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Controllers\Common\SettingsController;
|
||||
use App\Http\Controllers\Common\PhpMailController;
|
||||
use App\Http\Controllers\Common\SettingsController;
|
||||
use App\Http\Controllers\Controller;
|
||||
// requests
|
||||
use App\Http\Requests\helpdesk\CheckTicket;
|
||||
use App\Http\Requests\helpdesk\ProfilePassword;
|
||||
@@ -13,31 +13,31 @@ use App\Http\Requests\helpdesk\ProfileRequest;
|
||||
use App\Http\Requests\helpdesk\TicketRequest;
|
||||
// models
|
||||
use App\Model\helpdesk\Manage\Help_topic;
|
||||
use App\Model\helpdesk\Ticket\Tickets;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Thread;
|
||||
use App\Model\helpdesk\Settings\Company;
|
||||
use App\Model\helpdesk\Settings\System;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Thread;
|
||||
use App\Model\helpdesk\Ticket\Tickets;
|
||||
use App\User;
|
||||
// classes
|
||||
use Auth;
|
||||
use Exception;
|
||||
use Hash;
|
||||
use Input;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* GuestController
|
||||
* GuestController.
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class GuestController extends Controller {
|
||||
|
||||
class GuestController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return type void
|
||||
*/
|
||||
public function __construct(PhpMailController $PhpMailController) {
|
||||
public function __construct(PhpMailController $PhpMailController)
|
||||
{
|
||||
$this->PhpMailController = $PhpMailController;
|
||||
SettingsController::smtp();
|
||||
// checking authentication
|
||||
@@ -45,21 +45,27 @@ class GuestController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get profile
|
||||
* Get profile.
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function getProfile() {
|
||||
public function getProfile()
|
||||
{
|
||||
$user = Auth::user();
|
||||
|
||||
return view('themes.default1.client.helpdesk.profile', compact('user'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Save profile data
|
||||
* Save profile data.
|
||||
*
|
||||
* @param type $id
|
||||
* @param type ProfileRequest $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function postProfile(ProfileRequest $request) {
|
||||
public function postProfile(ProfileRequest $request)
|
||||
{
|
||||
$user = User::where('id', '=', Auth::user()->id)->first();
|
||||
$user->gender = $request->get('gender');
|
||||
$user->save();
|
||||
@@ -84,6 +90,7 @@ class GuestController extends Controller {
|
||||
$user->profile_pic = $fileName;
|
||||
} else {
|
||||
$user->fill($request->except('profile_pic', 'gender'))->save();
|
||||
|
||||
return redirect()->back()->with('success1', 'Profile Updated sucessfully');
|
||||
}
|
||||
if ($user->fill($request->except('profile_pic'))->save()) {
|
||||
@@ -92,26 +99,34 @@ class GuestController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Ticket page
|
||||
* Get Ticket page.
|
||||
*
|
||||
* @param type Help_topic $topic
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function getTicket(Help_topic $topic) {
|
||||
public function getTicket(Help_topic $topic)
|
||||
{
|
||||
$topics = $topic->get();
|
||||
|
||||
return view('themes.default1.client.helpdesk.tickets.form', compact('topics'));
|
||||
}
|
||||
|
||||
/**
|
||||
* getform
|
||||
* getform.
|
||||
*
|
||||
* @param type Help_topic $topic
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function getForm(Help_topic $topic) {
|
||||
public function getForm(Help_topic $topic)
|
||||
{
|
||||
if (\Config::get('database.install') == '%0%') {
|
||||
return \Redirect::route('license');
|
||||
}
|
||||
if (System::first()->status == 1) {
|
||||
$topics = $topic->get();
|
||||
|
||||
return view('themes.default1.client.helpdesk.form', compact('topics'));
|
||||
} else {
|
||||
return \Redirect::route('home');
|
||||
@@ -119,24 +134,30 @@ class GuestController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get my ticket
|
||||
* Get my ticket.
|
||||
*
|
||||
* @param type Tickets $tickets
|
||||
* @param type Ticket_Thread $thread
|
||||
* @param type User $user
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function getMyticket() {
|
||||
public function getMyticket()
|
||||
{
|
||||
return view('themes.default1.client.helpdesk.mytickets');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get ticket-thread
|
||||
* Get ticket-thread.
|
||||
*
|
||||
* @param type Ticket_Thread $thread
|
||||
* @param type Tickets $tickets
|
||||
* @param type User $user
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function thread(Ticket_Thread $thread, Tickets $tickets, User $user) {
|
||||
public function thread(Ticket_Thread $thread, Tickets $tickets, User $user)
|
||||
{
|
||||
$user_id = Auth::user()->id;
|
||||
//dd($user_id);
|
||||
/* get the ticket's id == ticket_id of thread */
|
||||
@@ -149,26 +170,31 @@ class GuestController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* ticket Edit
|
||||
* ticket Edit.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public function ticketEdit() {
|
||||
|
||||
public function ticketEdit()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Post porfile password
|
||||
* Post porfile password.
|
||||
*
|
||||
* @param type $id
|
||||
* @param type ProfilePassword $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function postProfilePassword(ProfilePassword $request) {
|
||||
public function postProfilePassword(ProfilePassword $request)
|
||||
{
|
||||
$user = Auth::user();
|
||||
//echo $user->password;
|
||||
if (Hash::check($request->input('old_password'), $user->getAuthPassword())) {
|
||||
$user->password = Hash::make($request->input('new_password'));
|
||||
try {
|
||||
$user->save();
|
||||
|
||||
return redirect()->back()->with('success2', 'Password Updated sucessfully');
|
||||
} catch (Exception $e) {
|
||||
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 TicketRequest $request
|
||||
*
|
||||
* @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->title = $request->input('To');
|
||||
$thread->user_id = Auth::user()->id;
|
||||
@@ -194,29 +223,35 @@ class GuestController extends Controller {
|
||||
$ticket_id = $request->input('ticket_ID');
|
||||
$tickets = Tickets::where('id', '=', $ticket_id)->first();
|
||||
$thread = Ticket_Thread::where('ticket_id', '=', $ticket_id)->first();
|
||||
return Redirect("thread/" . $ticket_id);
|
||||
|
||||
return Redirect('thread/'.$ticket_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Checked ticket
|
||||
* Get Checked ticket.
|
||||
*
|
||||
* @param type Tickets $ticket
|
||||
* @param type User $user
|
||||
*
|
||||
* @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'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Post Check ticket
|
||||
* Post Check ticket.
|
||||
*
|
||||
* @param type CheckTicket $request
|
||||
* @param type User $user
|
||||
* @param type Tickets $ticket
|
||||
* @param type Ticket_Thread $thread
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function PostCheckTicket() {
|
||||
|
||||
public function PostCheckTicket()
|
||||
{
|
||||
$Email = \Input::get('email');
|
||||
$Ticket_number = \Input::get('ticket_number');
|
||||
|
||||
@@ -230,7 +265,7 @@ class GuestController extends Controller {
|
||||
if ($user->role == 'user') {
|
||||
$username = $user->user_name;
|
||||
} else {
|
||||
$username = $user->first_name . " " . $user->last_name;
|
||||
$username = $user->first_name.' '.$user->last_name;
|
||||
}
|
||||
|
||||
if ($user->email != $Email) {
|
||||
@@ -252,36 +287,45 @@ class GuestController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* get ticket email
|
||||
* get ticket email.
|
||||
*
|
||||
* @param type $id
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function get_ticket_email($id) {
|
||||
public function get_ticket_email($id)
|
||||
{
|
||||
$id1 = \Crypt::decrypt($id);
|
||||
|
||||
return view('themes.default1.client.helpdesk.ckeckticket', compact('id'));
|
||||
}
|
||||
|
||||
/**
|
||||
* get ticket status
|
||||
* get ticket status.
|
||||
*
|
||||
* @param type Tickets $ticket
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function getTicketStat(Tickets $ticket) {
|
||||
public function getTicketStat(Tickets $ticket)
|
||||
{
|
||||
return view('themes.default1.client.helpdesk.ckeckticket', compact('ticket'));
|
||||
}
|
||||
|
||||
/**
|
||||
* get company
|
||||
* get company.
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function company() {
|
||||
public function company()
|
||||
{
|
||||
$company = Company::Where('id', '=', '1')->first();
|
||||
if ($company->company_name == null) {
|
||||
$company = "Support Center";
|
||||
$company = 'Support Center';
|
||||
} else {
|
||||
$company = $company->company_name;
|
||||
}
|
||||
|
||||
return $company;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -9,23 +9,21 @@ use App\Model\helpdesk\Settings\System;
|
||||
// classes
|
||||
use Config;
|
||||
use Redirect;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* OuthouseController
|
||||
* OuthouseController.
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class WelcomepageController extends Controller {
|
||||
|
||||
class WelcomepageController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function get(System $note) {
|
||||
public function get(System $note)
|
||||
{
|
||||
if (Config::get('database.install') == '%0%') {
|
||||
return Redirect::route('licence');
|
||||
}
|
||||
@@ -33,14 +31,16 @@ class WelcomepageController extends Controller {
|
||||
foreach ($notes as $note) {
|
||||
$content = $note->content;
|
||||
}
|
||||
|
||||
return view('themes.default1.client.guest-user.guest', compact('heading', 'content'));
|
||||
}
|
||||
|
||||
public function index() {
|
||||
public function index()
|
||||
{
|
||||
if (Config::get('database.install') == '%0%') {
|
||||
return Redirect::route('licence');
|
||||
}
|
||||
|
||||
return view('themes.default1.client.helpdesk.guest-user.index');
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,8 +5,8 @@ namespace App\Http\Controllers\Client\kb;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\kb\CommentRequest;
|
||||
use App\Http\Requests\kb\ContactRequest;
|
||||
use App\Http\Requests\kb\SearchRequest;
|
||||
use App\Http\Requests\kb\ProfilePassword;
|
||||
use App\Http\Requests\kb\SearchRequest;
|
||||
use App\Model\kb\Article;
|
||||
use App\Model\kb\Category;
|
||||
use App\Model\kb\Comment;
|
||||
@@ -15,18 +15,18 @@ use App\Model\kb\Faq;
|
||||
use App\Model\kb\Page;
|
||||
use App\Model\kb\Relationship;
|
||||
use App\Model\kb\Settings;
|
||||
use Config;
|
||||
use Auth;
|
||||
// use Creativeorange\Gravatar\Gravatar;
|
||||
use Config;
|
||||
use Hash;
|
||||
use Illuminate\Http\Request;
|
||||
use Mail;
|
||||
use Auth;
|
||||
use Redirect;
|
||||
use Hash;
|
||||
use Exception;
|
||||
|
||||
class UserController extends Controller {
|
||||
|
||||
public function __construct() {
|
||||
class UserController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
//$this->middleware('auth');
|
||||
//SettingsController::language();
|
||||
// $this->port();
|
||||
@@ -38,11 +38,11 @@ class UserController extends Controller {
|
||||
|
||||
/**
|
||||
* @param
|
||||
*
|
||||
* @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();
|
||||
$pagination = $settings->pagination;
|
||||
// $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 Integer $startPos Position int string to start excerpt from
|
||||
* @param Integer $maxLength Maximum length the excerpt may be
|
||||
* @return String excerpt
|
||||
* @param string $str String to get an excerpt from
|
||||
* @param int $startPos Position int string to start excerpt from
|
||||
* @param int $maxLength Maximum length the excerpt may be
|
||||
*
|
||||
* @return string excerpt
|
||||
*/
|
||||
static function getExcerpt($str, $startPos = 0, $maxLength = 50) {
|
||||
public static function getExcerpt($str, $startPos = 0, $maxLength = 50)
|
||||
{
|
||||
if (strlen($str) > $maxLength) {
|
||||
$excerpt = substr($str, $startPos, $maxLength - 3);
|
||||
$lastSpace = strrpos($excerpt, ' ');
|
||||
@@ -76,7 +78,8 @@ class UserController extends Controller {
|
||||
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();
|
||||
$pagination = $settings->pagination;
|
||||
$search = $request->input('s');
|
||||
@@ -84,14 +87,17 @@ class UserController extends Controller {
|
||||
$result->setPath('search');
|
||||
//dd($result);
|
||||
$categorys = $category->get();
|
||||
|
||||
return view('themes.default1.client.kb.article-list.search', compact('categorys', 'result'));
|
||||
}
|
||||
|
||||
/**
|
||||
* to show the seleted article
|
||||
* to show the seleted article.
|
||||
*
|
||||
* @return response
|
||||
*/
|
||||
public function show($slug, Article $article, Category $category) {
|
||||
public function show($slug, Article $article, Category $category)
|
||||
{
|
||||
//ArticleController::timezone();
|
||||
$tz = \App\Model\helpdesk\Settings\System::where('id', '1')->first()->time_zone;
|
||||
$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 */
|
||||
$catid = $category->where('slug', $slug)->first();
|
||||
$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'));
|
||||
}
|
||||
|
||||
public function home(Article $article, Category $category, Relationship $relation) {
|
||||
public function home(Article $article, Category $category, Relationship $relation)
|
||||
{
|
||||
if (Config::get('database.install') == '%0%') {
|
||||
return redirect('step1');
|
||||
} 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();
|
||||
$categorys = $category->get();
|
||||
|
||||
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
|
||||
*/
|
||||
public function contact(Category $category, Settings $settings) {
|
||||
public function contact(Category $category, Settings $settings)
|
||||
{
|
||||
$settings = $settings->whereId('1')->first();
|
||||
$categorys = $category->get();
|
||||
|
||||
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
|
||||
*/
|
||||
public function postContact(ContactRequest $request, Contact $contact) {
|
||||
public function postContact(ContactRequest $request, Contact $contact)
|
||||
{
|
||||
$this->port();
|
||||
$this->host();
|
||||
$this->encryption();
|
||||
@@ -167,7 +182,7 @@ class UserController extends Controller {
|
||||
$details = $request->input('message');
|
||||
//echo $message;
|
||||
//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');
|
||||
});
|
||||
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');
|
||||
}
|
||||
|
||||
/**
|
||||
* To insert the values to the comment table
|
||||
* To insert the values to the comment table.
|
||||
*
|
||||
* @param type Article $article
|
||||
* @param type Request $request
|
||||
* @param type Comment $comment
|
||||
* @param type Id $id
|
||||
*
|
||||
* @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();
|
||||
$id = $article->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();
|
||||
//$this->timezone($page->created_at);
|
||||
return view('themes.default1.client.kb.article-list.pages', compact('page'));
|
||||
}
|
||||
|
||||
static function port() {
|
||||
public static function port()
|
||||
{
|
||||
$setting = Settings::whereId('1')->first();
|
||||
Config::set('mail.port', $setting->port);
|
||||
}
|
||||
|
||||
static function host() {
|
||||
public static function host()
|
||||
{
|
||||
$setting = Settings::whereId('1')->first();
|
||||
Config::set('mail.host', $setting->host);
|
||||
}
|
||||
|
||||
static function encryption() {
|
||||
public static function encryption()
|
||||
{
|
||||
$setting = Settings::whereId('1')->first();
|
||||
Config::set(['mail.encryption' => $setting->encryption, 'mail.username' => $setting->email]);
|
||||
}
|
||||
|
||||
static function email() {
|
||||
public static function email()
|
||||
{
|
||||
$setting = Settings::whereId('1')->first();
|
||||
Config::set(['mail.from' => ['address' => $setting->email, 'name' => 'asd']]);
|
||||
//dd(Config::get('mail'));
|
||||
}
|
||||
|
||||
static function password() {
|
||||
public static function password()
|
||||
{
|
||||
$setting = Settings::whereId('1')->first();
|
||||
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->setPath('home');
|
||||
@@ -254,12 +280,15 @@ class UserController extends Controller {
|
||||
// //return substr($date, 0, -6);
|
||||
// }
|
||||
|
||||
public function clientProfile() {
|
||||
public function clientProfile()
|
||||
{
|
||||
$user = Auth::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->gender = $request->input('gender');
|
||||
$user->save();
|
||||
@@ -284,6 +313,7 @@ class UserController extends Controller {
|
||||
$user->profile_pic = $fileName;
|
||||
} else {
|
||||
$user->fill($request->except('profile_pic', 'gender'))->save();
|
||||
|
||||
return redirect('guest')->with('success', 'Profile Updated sucessfully');
|
||||
}
|
||||
if ($user->fill($request->except('profile_pic'))->save()) {
|
||||
@@ -291,16 +321,17 @@ class UserController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
public function postClientProfilePassword($id, ProfilePassword $request) {
|
||||
public function postClientProfilePassword($id, ProfilePassword $request)
|
||||
{
|
||||
$user = Auth::user();
|
||||
//echo $user->password;
|
||||
if (Hash::check($request->input('old_password'), $user->getAuthPassword())) {
|
||||
$user->password = Hash::make($request->input('new_password'));
|
||||
$user->save();
|
||||
|
||||
return redirect()->back()->with('success', 'Password Updated sucessfully');
|
||||
} else {
|
||||
return redirect()->back()->with('fails', 'Password was not Updated');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -2,21 +2,20 @@
|
||||
|
||||
namespace App\Http\Controllers\Common;
|
||||
|
||||
use App\Http\Requests;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Phpmailer\PHPMailerautoload;
|
||||
use Illuminate\Http\Request;
|
||||
use Auth;
|
||||
use App\Model\helpdesk\Agent\Department;
|
||||
use App\Model\helpdesk\Email\Emails;
|
||||
use App\Model\helpdesk\Settings\Company;
|
||||
use App\Model\helpdesk\Settings\Email;
|
||||
use App\User;
|
||||
use App\Model\helpdesk\Settings\Company;
|
||||
use App\Model\helpdesk\Agent\Department;
|
||||
use Auth;
|
||||
|
||||
class PhpMailController extends Controller {
|
||||
|
||||
public function fetch_smtp_details($id) {
|
||||
class PhpMailController extends Controller
|
||||
{
|
||||
public function fetch_smtp_details($id)
|
||||
{
|
||||
$emails = Emails::where('id', '=', $id)->first();
|
||||
|
||||
return $emails;
|
||||
}
|
||||
|
||||
@@ -25,7 +24,8 @@ class PhpMailController extends Controller {
|
||||
*
|
||||
* @return Mail
|
||||
*/
|
||||
public function sendmail($from, $to, $message, $template_variables) {
|
||||
public function sendmail($from, $to, $message, $template_variables)
|
||||
{
|
||||
// dd($from);
|
||||
$from_address = $this->fetch_smtp_details($from);
|
||||
|
||||
@@ -169,7 +169,7 @@ class PhpMailController extends Controller {
|
||||
|
||||
$system_from = $this->company();
|
||||
|
||||
$mail = new \PHPMailer;
|
||||
$mail = new \PHPMailer();
|
||||
|
||||
$status = \DB::table('settings_email')->first();
|
||||
|
||||
@@ -177,13 +177,13 @@ class PhpMailController extends Controller {
|
||||
|
||||
$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'));
|
||||
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);
|
||||
// $messagebody = str_replace($variables, $data, $contents);
|
||||
@@ -195,7 +195,6 @@ class PhpMailController extends Controller {
|
||||
$contents = $messagebody;
|
||||
}
|
||||
|
||||
|
||||
// dd($messagebody);
|
||||
//$mail->SMTPDebug = 3; // Enable verbose debug output
|
||||
|
||||
@@ -226,7 +225,7 @@ class PhpMailController extends Controller {
|
||||
$mail->addBCC($bc);
|
||||
|
||||
if ($attachment != null) {
|
||||
$size = sizeOf($message['attachments']);
|
||||
$size = count($message['attachments']);
|
||||
$attach = $message['attachments'];
|
||||
for ($i = 0; $i < $size; $i++) {
|
||||
$file_path = $attach[$i]->getRealPath();
|
||||
@@ -237,7 +236,7 @@ class PhpMailController extends Controller {
|
||||
|
||||
$mail->Subject = $subject;
|
||||
if ($template == 'ticket-reply-agent') {
|
||||
$line = "---Reply above this line--- <br/><br/>";
|
||||
$line = '---Reply above this line--- <br/><br/>';
|
||||
$mail->Body = $line.$messagebody;
|
||||
} else {
|
||||
$mail->Body = $messagebody;
|
||||
@@ -254,16 +253,19 @@ class PhpMailController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetching comapny name to send mail
|
||||
* Fetching comapny name to send mail.
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function company() {
|
||||
public function company()
|
||||
{
|
||||
$company = Company::Where('id', '=', '1')->first();
|
||||
if ($company->company_name == null) {
|
||||
$company = "Support Center";
|
||||
$company = 'Support Center';
|
||||
} else {
|
||||
$company = $company->company_name;
|
||||
}
|
||||
|
||||
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 Department $dept_id
|
||||
*
|
||||
* @return type integer
|
||||
*/
|
||||
public function mailfrom($reg, $dept_id) {
|
||||
public function mailfrom($reg, $dept_id)
|
||||
{
|
||||
$email = Email::where('id', '=', '1')->first();
|
||||
if ($reg == 1) {
|
||||
return $email->sys_email;
|
||||
@@ -329,5 +334,4 @@ class PhpMailController extends Controller {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,60 +5,65 @@ namespace App\Http\Controllers\Common;
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
// requests
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Requests\helpdesk\SmtpRequest;
|
||||
use App\Http\Requests;
|
||||
// models
|
||||
use App\Model\helpdesk\Theme\Widgets;
|
||||
use App\Http\Requests\helpdesk\SmtpRequest;
|
||||
use App\Model\helpdesk\Email\Smtp;
|
||||
use App\Model\helpdesk\Utility\Version_Check;
|
||||
// models
|
||||
use App\Model\helpdesk\Settings\Plugin;
|
||||
// classes
|
||||
use App\Model\helpdesk\Theme\Widgets;
|
||||
use App\Model\helpdesk\Utility\Version_Check;
|
||||
use Config;
|
||||
use Input;
|
||||
// classes
|
||||
use Crypt;
|
||||
use Illuminate\Support\Collection;
|
||||
use Exception;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Collection;
|
||||
use Input;
|
||||
|
||||
/**
|
||||
* ***************************
|
||||
* Settings Controllers
|
||||
* ***************************
|
||||
* Controller to keep smtp details and fetch where ever needed
|
||||
* @package default
|
||||
* Controller to keep smtp details and fetch where ever needed.
|
||||
*/
|
||||
class SettingsController extends Controller {
|
||||
|
||||
class SettingsController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return type void
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
// $this->smtp();
|
||||
$this->middleware('auth');
|
||||
$this->middleware('roles');
|
||||
SettingsController::driver();
|
||||
SettingsController::host();
|
||||
SettingsController::port();
|
||||
SettingsController::from();
|
||||
SettingsController::encryption();
|
||||
SettingsController::username();
|
||||
SettingsController::password();
|
||||
self::driver();
|
||||
self::host();
|
||||
self::port();
|
||||
self::from();
|
||||
self::encryption();
|
||||
self::username();
|
||||
self::password();
|
||||
}
|
||||
|
||||
/**
|
||||
* get the page to create the footer
|
||||
* get the page to create the footer.
|
||||
*
|
||||
* @return response
|
||||
*/
|
||||
public function widgets() {
|
||||
public function 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
|
||||
*/
|
||||
public function list_widget() {
|
||||
public function list_widget()
|
||||
{
|
||||
return \Datatable::collection(Widgets::where('id', '<', '7')->get())
|
||||
->searchColumns('name')
|
||||
->orderColumns('name', 'title', 'value')
|
||||
@@ -83,12 +88,12 @@ class SettingsController extends Controller {
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<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%">
|
||||
</div>
|
||||
<br/>
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
@@ -110,17 +115,21 @@ class SettingsController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Post footer
|
||||
* Post footer.
|
||||
*
|
||||
* @param type Footer $footer
|
||||
* @param type Request $request
|
||||
*
|
||||
* @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->title = $request->title;
|
||||
$widget->value = $request->content;
|
||||
try {
|
||||
$widget->save();
|
||||
|
||||
return redirect()->back()->with('success', $widget->name.' Saved Successfully');
|
||||
} catch (Exception $e) {
|
||||
return redirect()->back()->with('fails', $e->errorInfo[2]);
|
||||
@@ -128,18 +137,22 @@ class SettingsController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* get the page to create the footer
|
||||
* get the page to create the footer.
|
||||
*
|
||||
* @return response
|
||||
*/
|
||||
public function social_buttons() {
|
||||
public function social_buttons()
|
||||
{
|
||||
return view('themes.default1.admin.helpdesk.theme.social');
|
||||
}
|
||||
|
||||
/**
|
||||
* get the page to create the footer
|
||||
* get the page to create the footer.
|
||||
*
|
||||
* @return response
|
||||
*/
|
||||
public function list_social_buttons() {
|
||||
public function list_social_buttons()
|
||||
{
|
||||
return \Datatable::collection(Widgets::where('id', '>', '6')->get())
|
||||
->searchColumns('name')
|
||||
->orderColumns('name', 'value')
|
||||
@@ -162,7 +175,7 @@ class SettingsController extends Controller {
|
||||
<div class="modal-body">
|
||||
<br/>
|
||||
<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.'">
|
||||
</div>
|
||||
</div>
|
||||
@@ -179,17 +192,21 @@ class SettingsController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Post footer
|
||||
* Post footer.
|
||||
*
|
||||
* @param type Footer $footer
|
||||
* @param type Request $request
|
||||
*
|
||||
* @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->title = $request->title;
|
||||
$widget->value = $request->content;
|
||||
try {
|
||||
$widget->save();
|
||||
|
||||
return redirect()->back()->with('success', $widget->name.' Saved Successfully');
|
||||
} catch (Exception $e) {
|
||||
return redirect()->back()->with('fails', $e->errorInfo[2]);
|
||||
@@ -197,70 +214,84 @@ class SettingsController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Driver
|
||||
* Driver.
|
||||
*
|
||||
* @return type void
|
||||
*/
|
||||
static function driver() {
|
||||
$set = new Smtp;
|
||||
public static function driver()
|
||||
{
|
||||
$set = new Smtp();
|
||||
$settings = Smtp::where('id', '=', '1')->first();
|
||||
Config::set('mail.host', $settings->driver);
|
||||
}
|
||||
|
||||
/**
|
||||
* SMTP host
|
||||
* SMTP host.
|
||||
*
|
||||
* @return type void
|
||||
*/
|
||||
static function host() {
|
||||
$set = new Smtp;
|
||||
public static function host()
|
||||
{
|
||||
$set = new Smtp();
|
||||
$settings = Smtp::where('id', '=', '1')->first();
|
||||
Config::set('mail.host', $settings->host);
|
||||
}
|
||||
|
||||
/**
|
||||
* SMTP port
|
||||
* SMTP port.
|
||||
*
|
||||
* @return type void
|
||||
*/
|
||||
static function port() {
|
||||
$set = new Smtp;
|
||||
public static function port()
|
||||
{
|
||||
$set = new Smtp();
|
||||
$settings = Smtp::where('id', '=', '1')->first();
|
||||
Config::set('mail.port', intval($settings->port));
|
||||
}
|
||||
|
||||
/**
|
||||
* SMTP from
|
||||
* SMTP from.
|
||||
*
|
||||
* @return type void
|
||||
*/
|
||||
static function from() {
|
||||
$set = new Smtp;
|
||||
public static function from()
|
||||
{
|
||||
$set = new Smtp();
|
||||
$settings = Smtp::where('id', '=', '1')->first();
|
||||
Config::set('mail.from', ['address' => $settings->email, 'name' => $settings->company_name]);
|
||||
}
|
||||
|
||||
/**
|
||||
* SMTP encryption
|
||||
* SMTP encryption.
|
||||
*
|
||||
* @return type void
|
||||
*/
|
||||
static function encryption() {
|
||||
$set = new Smtp;
|
||||
public static function encryption()
|
||||
{
|
||||
$set = new Smtp();
|
||||
$settings = Smtp::where('id', '=', '1')->first();
|
||||
Config::set('mail.encryption', $settings->encryption);
|
||||
}
|
||||
|
||||
/**
|
||||
* SMTP username
|
||||
* SMTP username.
|
||||
*
|
||||
* @return type void
|
||||
*/
|
||||
static function username() {
|
||||
$set = new Smtp;
|
||||
public static function username()
|
||||
{
|
||||
$set = new Smtp();
|
||||
$settings = Smtp::where('id', '=', '1')->first();
|
||||
Config::set('mail.username', $settings->email);
|
||||
}
|
||||
|
||||
/**
|
||||
* SMTP password
|
||||
* SMTP password.
|
||||
*
|
||||
* @return type void
|
||||
*/
|
||||
static function password() {
|
||||
public static function password()
|
||||
{
|
||||
$settings = Smtp::first();
|
||||
if ($settings->password) {
|
||||
$pass = $settings->password;
|
||||
@@ -270,19 +301,24 @@ class SettingsController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* get SMTP
|
||||
* get SMTP.
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function getsmtp() {
|
||||
public function getsmtp()
|
||||
{
|
||||
$settings = Smtp::where('id', '=', '1')->first();
|
||||
|
||||
return view('themes.default1.admin.helpdesk.emails.smtp', compact('settings'));
|
||||
}
|
||||
|
||||
/**
|
||||
* POST SMTP
|
||||
* POST SMTP.
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function postsmtp(SmtpRequest $request) {
|
||||
public function postsmtp(SmtpRequest $request)
|
||||
{
|
||||
$data = Smtp::where('id', '=', 1)->first();
|
||||
$data->driver = $request->input('driver');
|
||||
$data->host = $request->input('host');
|
||||
@@ -293,6 +329,7 @@ class SettingsController extends Controller {
|
||||
$data->password = Crypt::encrypt($request->input('password'));
|
||||
try {
|
||||
$data->save();
|
||||
|
||||
return \Redirect::route('getsmtp')->with('success', 'success');
|
||||
} catch (Exception $e) {
|
||||
return \Redirect::route('getsmtp')->with('fails', $e->errorInfo[2]);
|
||||
@@ -300,10 +337,12 @@ class SettingsController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* SMTP
|
||||
* SMTP.
|
||||
*
|
||||
* @return type void
|
||||
*/
|
||||
static function smtp() {
|
||||
public static function smtp()
|
||||
{
|
||||
$settings = Smtp::where('id', '=', '1')->first();
|
||||
if ($settings->password) {
|
||||
$password = Crypt::decrypt($settings->password);
|
||||
@@ -318,22 +357,29 @@ class SettingsController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Settings
|
||||
* Settings.
|
||||
*
|
||||
* @param type Smtp $set
|
||||
*
|
||||
* @return type view\
|
||||
*/
|
||||
public function settings(Smtp $set) {
|
||||
public function settings(Smtp $set)
|
||||
{
|
||||
$settings = $set->where('id', '1')->first();
|
||||
|
||||
return view('themes.default1.admin.settings', compact('settings'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Post settings
|
||||
* Post settings.
|
||||
*
|
||||
* @param type Settings $set
|
||||
* @param type Request $request
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function PostSettings(Settings $set, Request $request) {
|
||||
public function PostSettings(Settings $set, Request $request)
|
||||
{
|
||||
$settings = $set->where('id', '1')->first();
|
||||
$pass = $request->input('password');
|
||||
$password = Crypt::encrypt($pass);
|
||||
@@ -353,6 +399,7 @@ class SettingsController extends Controller {
|
||||
}
|
||||
try {
|
||||
$settings->fill($request->except('logo', 'password'))->save();
|
||||
|
||||
return redirect()->back()->with('success', 'Settings updated Successfully');
|
||||
} catch (Exception $e) {
|
||||
return redirect()->back()->with('fails', $e->errorInfo[2]);
|
||||
@@ -360,25 +407,29 @@ class SettingsController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* version_check
|
||||
* version_check.
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function version_check() {
|
||||
public function version_check()
|
||||
{
|
||||
$response_url = \URL::route('post-version-check');
|
||||
echo "<form action='http://www.faveohelpdesk.com/bill/version' method='post' name='redirect'>";
|
||||
echo "<input type='hidden' name='_token' value='csrf_token()'/>";
|
||||
echo "<input type='hidden' name='title' value='helpdeskcommunityedition'/>";
|
||||
echo "<input type='hidden' name='id' value='19'/>";
|
||||
echo "<input type='hidden' name='response_url' value='".$response_url."' />";
|
||||
echo "</form>";
|
||||
echo '</form>';
|
||||
echo "<script language='javascript'>document.redirect.submit();</script>";
|
||||
}
|
||||
|
||||
/**
|
||||
* post_version_check
|
||||
* post_version_check.
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function post_version_check(Request $request) {
|
||||
public function post_version_check(Request $request)
|
||||
{
|
||||
$current_version = \Config::get('app.version');
|
||||
$new_version = $request->value;
|
||||
if ($current_version == $new_version) {
|
||||
@@ -397,15 +448,18 @@ class SettingsController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
public function getupdate() {
|
||||
public function getupdate()
|
||||
{
|
||||
return \View::make('themes.default1.admin.helpdesk.settings.checkupdate');
|
||||
}
|
||||
|
||||
public function Plugins() {
|
||||
public function Plugins()
|
||||
{
|
||||
return view('themes.default1.admin.helpdesk.settings.plugins');
|
||||
}
|
||||
|
||||
public function GetPlugin() {
|
||||
public function GetPlugin()
|
||||
{
|
||||
$plugins = $this->fetchConfig();
|
||||
|
||||
return \Datatable::collection(new Collection($plugins))
|
||||
@@ -413,14 +467,14 @@ class SettingsController extends Controller {
|
||||
->addColumn('name', function ($model) {
|
||||
if (array_has($model, 'path')) {
|
||||
if ($model['status'] == 0) {
|
||||
$activate = "<a href=" . url('plugin/status/' . $model['path']) . ">Activate</a>";
|
||||
$settings = " ";
|
||||
$activate = '<a href='.url('plugin/status/'.$model['path']).'>Activate</a>';
|
||||
$settings = ' ';
|
||||
} else {
|
||||
$settings = "<a href=" . url($model['settings']) . ">Settings</a> | ";
|
||||
$activate = "<a href=" . url('plugin/status/' . $model['path']) . ">Deactivate</a>";
|
||||
$settings = '<a href='.url($model['settings']).'>Settings</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-dialog'>
|
||||
<div class=modal-content>
|
||||
@@ -430,8 +484,8 @@ class SettingsController extends Controller {
|
||||
<div class=modal-body>
|
||||
<p>Are you Sure ?</p>
|
||||
<div class=modal-footer>
|
||||
<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>
|
||||
<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>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -439,10 +493,11 @@ class SettingsController extends Controller {
|
||||
</div>
|
||||
</div>
|
||||
</div>";
|
||||
$action = "<br><br>" . $delete . " | " . $settings . $activate;
|
||||
$action = '<br><br>'.$delete.' | '.$settings.$activate;
|
||||
} else {
|
||||
$action = '';
|
||||
}
|
||||
|
||||
return ucfirst($model['name']).$action;
|
||||
})
|
||||
->addColumn('description', function ($model) {
|
||||
@@ -452,7 +507,7 @@ class SettingsController extends Controller {
|
||||
return ucfirst($model['author']);
|
||||
})
|
||||
->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) {
|
||||
return $model['version'];
|
||||
@@ -461,28 +516,34 @@ class SettingsController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Reading the Filedirectory
|
||||
* Reading the Filedirectory.
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function ReadPlugins() {
|
||||
public function ReadPlugins()
|
||||
{
|
||||
$dir = app_path().'/Plugins';
|
||||
$plugins = array_diff(scandir($dir), array('.', '..'));
|
||||
$plugins = array_diff(scandir($dir), ['.', '..']);
|
||||
|
||||
return $plugins;
|
||||
}
|
||||
|
||||
/**
|
||||
* After plugin post
|
||||
* After plugin post.
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function PostPlugins(Request $request) {
|
||||
public function PostPlugins(Request $request)
|
||||
{
|
||||
$v = $this->validate($request, ['plugin' => 'required|mimes:application/zip,zip,Zip']);
|
||||
$plug = new Plugin();
|
||||
$file = $request->file('plugin');
|
||||
//dd($file);
|
||||
$destination = app_path().'/Plugins';
|
||||
$zipfile = $file->getRealPath();
|
||||
/**
|
||||
/*
|
||||
* get the file name and remove .zip
|
||||
*/
|
||||
$filename2 = $file->getClientOriginalName();
|
||||
@@ -490,7 +551,7 @@ class SettingsController extends Controller {
|
||||
$filename1 = ucfirst($file->getClientOriginalName());
|
||||
$filename = str_replace('.zip', '', $filename1);
|
||||
mkdir($destination.'/'.$filename);
|
||||
/**
|
||||
/*
|
||||
* extract the zip file using zipper
|
||||
*/
|
||||
\Zipper::make($zipfile)->folder($filename2)->extractTo($destination.'/'.$filename);
|
||||
@@ -498,18 +559,17 @@ class SettingsController extends Controller {
|
||||
$file = app_path().'/Plugins/'.$filename; // Plugin file path
|
||||
|
||||
if (file_exists($file)) {
|
||||
|
||||
$seviceporvider = $file.'/ServiceProvider.php';
|
||||
$config = $file.'/config.php';
|
||||
if (file_exists($seviceporvider) && file_exists($config)) {
|
||||
/**
|
||||
/*
|
||||
* move to faveo config
|
||||
*/
|
||||
$faveoconfig = config_path().'/plugins/'.$filename.'.php';
|
||||
if ($faveoconfig) {
|
||||
|
||||
//copy($config, $faveoconfig);
|
||||
/**
|
||||
/*
|
||||
* write provider list in app.php line 128
|
||||
*/
|
||||
$app = base_path().'/config/app.php';
|
||||
@@ -519,36 +579,43 @@ class SettingsController extends Controller {
|
||||
$lines[$line_i_am_looking_for] = $str;
|
||||
file_put_contents($app, implode("\n", $lines));
|
||||
$plug->create(['name' => $filename, 'path' => $filename, 'status' => 1]);
|
||||
|
||||
return redirect()->back()->with('success', 'Installed SuccessFully');
|
||||
} else {
|
||||
/**
|
||||
/*
|
||||
* delete if the plugin hasn't config.php and ServiceProvider.php
|
||||
*/
|
||||
$this->deleteDirectory($file);
|
||||
|
||||
return redirect()->back()->with('fails', 'Their is no '.$file);
|
||||
}
|
||||
} else {
|
||||
/**
|
||||
/*
|
||||
* delete if the plugin hasn't config.php and ServiceProvider.php
|
||||
*/
|
||||
$this->deleteDirectory($file);
|
||||
|
||||
return redirect()->back()->with('fails', 'Their is no <b>config.php or ServiceProvider.php</b> '.$file);
|
||||
}
|
||||
} else {
|
||||
/**
|
||||
/*
|
||||
* delete if the plugin Name is not equal to the folder name
|
||||
*/
|
||||
$this->deleteDirectory($file);
|
||||
|
||||
return redirect()->back()->with('fails', '<b>Plugin File Path is not exist</b> '.$file);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the directory
|
||||
* Delete the directory.
|
||||
*
|
||||
* @param type $dir
|
||||
* @return boolean
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function deleteDirectory($dir) {
|
||||
public function deleteDirectory($dir)
|
||||
{
|
||||
if (!file_exists($dir)) {
|
||||
return true;
|
||||
}
|
||||
@@ -563,17 +630,19 @@ class SettingsController extends Controller {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return rmdir($dir);
|
||||
}
|
||||
|
||||
public function ReadConfigs() {
|
||||
public function ReadConfigs()
|
||||
{
|
||||
$dir = app_path().'/Plugins/';
|
||||
$files = array_diff(scandir($dir), array('.', '..', 'ServiceProvider.php'));
|
||||
$plugins = array();
|
||||
$files = array_diff(scandir($dir), ['.', '..', 'ServiceProvider.php']);
|
||||
$plugins = [];
|
||||
if ($files) {
|
||||
foreach ($files as $key => $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;
|
||||
}
|
||||
foreach ($plugins as $plugin) {
|
||||
@@ -588,16 +657,18 @@ class SettingsController extends Controller {
|
||||
closedir($dh);
|
||||
}
|
||||
}
|
||||
|
||||
return $config;
|
||||
} else {
|
||||
return 'null';
|
||||
}
|
||||
}
|
||||
|
||||
public function fetchConfig() {
|
||||
public function fetchConfig()
|
||||
{
|
||||
$configs = $this->ReadConfigs();
|
||||
//dd($configs);
|
||||
$plug = new Plugin;
|
||||
$plug = new Plugin();
|
||||
$plug = $plug->select('path', 'status')->orderBy('name')->get()->toArray();
|
||||
//dd($plug[0]['path']);
|
||||
if ($configs !== 'null') {
|
||||
@@ -608,31 +679,35 @@ class SettingsController extends Controller {
|
||||
$fields[$key]['status'] = $plug[$key]['status'];
|
||||
}
|
||||
}
|
||||
|
||||
return $fields;
|
||||
} else {
|
||||
return array();
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
public function DeletePlugin($slug) {
|
||||
public function DeletePlugin($slug)
|
||||
{
|
||||
$dir = app_path().'/Plugins/'.$slug;
|
||||
$this->deleteDirectory($dir);
|
||||
/**
|
||||
/*
|
||||
* remove service provider from app.php
|
||||
*/
|
||||
$str = "'App\\Plugins\\$slug"."\\ServiceProvider',";
|
||||
$path_to_file = base_path().'/config/app.php';
|
||||
$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);
|
||||
$plugin = new Plugin();
|
||||
$plugin = $plugin->where('path', $slug)->first();
|
||||
$plugin->delete();
|
||||
|
||||
return redirect()->back()->with('success', 'Deleted Successfully');
|
||||
}
|
||||
|
||||
public function StatusPlugin($slug) {
|
||||
$plug = new Plugin;
|
||||
public function StatusPlugin($slug)
|
||||
{
|
||||
$plug = new Plugin();
|
||||
$plug = $plug->where('name', $slug)->first();
|
||||
$status = $plug->status;
|
||||
if ($status == 0) {
|
||||
@@ -647,18 +722,18 @@ class SettingsController extends Controller {
|
||||
}
|
||||
if ($status == 1) {
|
||||
$plug->status = 0;
|
||||
/**
|
||||
/*
|
||||
* remove service provider from app.php
|
||||
*/
|
||||
$str = "'App\\Plugins\\$slug"."\\ServiceProvider',";
|
||||
$path_to_file = base_path().'/config/app.php';
|
||||
|
||||
$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);
|
||||
}
|
||||
$plug->save();
|
||||
|
||||
return redirect()->back()->with('success', 'Status has changed');
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -4,11 +4,11 @@ namespace App\Http\Controllers;
|
||||
|
||||
// classes
|
||||
use Illuminate\Foundation\Bus\DispatchesCommands;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
|
||||
abstract class Controller extends BaseController {
|
||||
|
||||
abstract class Controller extends BaseController
|
||||
{
|
||||
use DispatchesCommands,
|
||||
ValidatesRequests;
|
||||
}
|
||||
|
@@ -6,20 +6,19 @@ namespace App\Http\Controllers\Error;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
/**
|
||||
* ErrorController
|
||||
* ErrorController.
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class ErrorController extends Controller {
|
||||
|
||||
class ErrorController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a Error Page of 404.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function error404() {
|
||||
public function error404()
|
||||
{
|
||||
return view('404');
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -2,10 +2,10 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Model\helpdesk\Manage\Sla_plan;
|
||||
use App\Model\helpdesk\Ticket\Tickets;
|
||||
|
||||
class HomeController extends Controller {
|
||||
class HomeController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Home Controller
|
||||
@@ -22,7 +22,8 @@ class HomeController extends Controller {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
// $this->middleware('auth');
|
||||
}
|
||||
|
||||
@@ -31,33 +32,38 @@ class HomeController extends Controller {
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function index() {
|
||||
public function index()
|
||||
{
|
||||
// ksjdckjdsnc
|
||||
return view('themes/default1/admin/dashboard');
|
||||
}
|
||||
|
||||
public function getsmtp() {
|
||||
public function getsmtp()
|
||||
{
|
||||
$smtp = \App\Model\helpdesk\Email\Smtp::where('id', '=', '1')->first();
|
||||
|
||||
return $smtp->host;
|
||||
}
|
||||
|
||||
Public function getdata() {
|
||||
public function getdata()
|
||||
{
|
||||
return \View::make('emails/notifications/agent');
|
||||
}
|
||||
|
||||
public function getreport() {
|
||||
public function getreport()
|
||||
{
|
||||
return \View::make('test');
|
||||
}
|
||||
|
||||
public function pushdata() {
|
||||
|
||||
$date2 = strtotime(Date('Y-m-d'));
|
||||
$date3 = Date('Y-m-d');
|
||||
public function pushdata()
|
||||
{
|
||||
$date2 = strtotime(date('Y-m-d'));
|
||||
$date3 = date('Y-m-d');
|
||||
$format = 'Y-m-d';
|
||||
$date1 = strtotime(Date($format, strtotime('-1 month' . $date3)));
|
||||
$date1 = strtotime(date($format, strtotime('-1 month'.$date3)));
|
||||
|
||||
$return = "";
|
||||
$last = "";
|
||||
$return = '';
|
||||
$last = '';
|
||||
for ($i = $date1; $i <= $date2; $i = $i + 86400) {
|
||||
$thisDate = date('Y-m-d', $i);
|
||||
|
||||
@@ -74,5 +80,4 @@ class HomeController extends Controller {
|
||||
|
||||
return '['.$last.']';
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -7,43 +7,40 @@ use App\Http\Controllers\Controller;
|
||||
// requests
|
||||
use App\Http\Requests\helpdesk\InstallerRequest;
|
||||
// models
|
||||
use App\User;
|
||||
use App\Model\helpdesk\Settings\System;
|
||||
use App\Model\helpdesk\Form\Form_details;
|
||||
use App\Model\helpdesk\Utility\Date_time_format;
|
||||
use App\Model\helpdesk\Utility\Timezones;
|
||||
use App\User;
|
||||
// classes
|
||||
use App;
|
||||
use Artisan;
|
||||
use Config;
|
||||
use Exception;
|
||||
use File;
|
||||
use Hash;
|
||||
use Input;
|
||||
use Redirect;
|
||||
use Session;
|
||||
use View;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* |=======================================================================
|
||||
* |Class: InstallController
|
||||
* |=======================================================================
|
||||
* |=======================================================================.
|
||||
*
|
||||
* Class to perform the first install operation without this the database
|
||||
* settings could not be started
|
||||
*
|
||||
* @package Faveo HELPDESK
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*
|
||||
*/
|
||||
class InstallController extends Controller {
|
||||
|
||||
class InstallController extends Controller
|
||||
{
|
||||
/**
|
||||
* Get Licence (step 1)
|
||||
* Get Licence (step 1).
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function licence() {
|
||||
public function licence()
|
||||
{
|
||||
// checking if the installation is running for the first time or not
|
||||
if (Config::get('database.install') == '%0%') {
|
||||
return view('themes/default1/installer/helpdesk/view1');
|
||||
@@ -54,14 +51,17 @@ class InstallController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Post Licencecheck
|
||||
* Post Licencecheck.
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function licencecheck() {
|
||||
public function licencecheck()
|
||||
{
|
||||
// checking if the user have accepted the licence agreement
|
||||
$accept = (Input::has('accept1')) ? true : false;
|
||||
if ($accept == 'accept') {
|
||||
Session::put('step1', 'step1');
|
||||
|
||||
return Redirect::route('prerequisites');
|
||||
} else {
|
||||
return Redirect::route('licence')->with('fails', 'Failed! first accept the licence agreeement');
|
||||
@@ -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
|
||||
* without which the project cannot be executed properly
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function prerequisites() {
|
||||
public function prerequisites()
|
||||
{
|
||||
// checking if the installation is running for the first time or not
|
||||
if (Config::get('database.install') == '%0%') {
|
||||
if (Session::get('step1') == 'step1') {
|
||||
@@ -91,20 +93,25 @@ class InstallController extends Controller {
|
||||
|
||||
/**
|
||||
* Post Prerequisitescheck
|
||||
* checking prerequisites
|
||||
* checking prerequisites.
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function prerequisitescheck() {
|
||||
public function prerequisitescheck()
|
||||
{
|
||||
Session::put('step2', 'step2');
|
||||
|
||||
return Redirect::route('configuration');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Localization (step 3)
|
||||
* Requesting user recomended settings for installation
|
||||
* Requesting user recomended settings for installation.
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function localization() {
|
||||
public function localization()
|
||||
{
|
||||
// checking if the installation is running for the first time or not
|
||||
if (Config::get('database.install') == '%0%') {
|
||||
if (Session::get('step2') == 'step2') {
|
||||
@@ -119,11 +126,12 @@ class InstallController extends Controller {
|
||||
|
||||
/**
|
||||
* Post localizationcheck
|
||||
* checking prerequisites
|
||||
* checking prerequisites.
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function localizationcheck() {
|
||||
|
||||
public function localizationcheck()
|
||||
{
|
||||
Session::put('step3', 'step3');
|
||||
|
||||
Session::put('language', Input::get('language'));
|
||||
@@ -136,10 +144,12 @@ class InstallController extends Controller {
|
||||
|
||||
/**
|
||||
* Get Configuration (step 4)
|
||||
* checking prerequisites
|
||||
* checking prerequisites.
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function configuration() {
|
||||
public function configuration()
|
||||
{
|
||||
// checking if the installation is running for the first time or not
|
||||
if (Config::get('database.install') == '%0%') {
|
||||
if (Session::get('step2') == 'step2') {
|
||||
@@ -154,11 +164,12 @@ class InstallController extends Controller {
|
||||
|
||||
/**
|
||||
* Post configurationcheck
|
||||
* checking prerequisites
|
||||
* checking prerequisites.
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function configurationcheck() {
|
||||
|
||||
public function configurationcheck()
|
||||
{
|
||||
Session::put('step4', 'step4');
|
||||
// dd(Input::get('default'));
|
||||
// dd(Input::get('host'));
|
||||
@@ -178,10 +189,12 @@ class InstallController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* postconnection
|
||||
* postconnection.
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function postconnection() {
|
||||
public function postconnection()
|
||||
{
|
||||
error_reporting(E_ALL & ~E_NOTICE);
|
||||
$default = Input::get('default');
|
||||
$host = Input::get('host');
|
||||
@@ -203,7 +216,7 @@ class InstallController extends Controller {
|
||||
$config .= "{$key}={$val}\n";
|
||||
}
|
||||
// Write environment file
|
||||
$fp = fopen(base_path() . "/.env", 'w');
|
||||
$fp = fopen(base_path().'/.env', 'w');
|
||||
fwrite($fp, $config);
|
||||
fclose($fp);
|
||||
|
||||
@@ -212,10 +225,12 @@ class InstallController extends Controller {
|
||||
|
||||
/**
|
||||
* Get database
|
||||
* checking prerequisites
|
||||
* checking prerequisites.
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function database() {
|
||||
public function database()
|
||||
{
|
||||
// checking if the installation is running for the first time or not
|
||||
if (Config::get('database.install') == '%0%') {
|
||||
if (Session::get('step4') == 'step4') {
|
||||
@@ -230,10 +245,12 @@ class InstallController extends Controller {
|
||||
|
||||
/**
|
||||
* Get account
|
||||
* checking prerequisites
|
||||
* checking prerequisites.
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function account() {
|
||||
public function account()
|
||||
{
|
||||
// checking if the installation is running for the first time or not
|
||||
if (Config::get('database.install') == '%0%') {
|
||||
if (Session::get('step4') == 'step4') {
|
||||
@@ -241,6 +258,7 @@ class InstallController extends Controller {
|
||||
Session::forget('step1');
|
||||
Session::forget('step2');
|
||||
Session::forget('step3');
|
||||
|
||||
return View::make('themes/default1/installer/helpdesk/view5');
|
||||
} else {
|
||||
return Redirect::route('configuration');
|
||||
@@ -252,15 +270,18 @@ class InstallController extends Controller {
|
||||
|
||||
/**
|
||||
* Post accountcheck
|
||||
* checking prerequisites
|
||||
* checking prerequisites.
|
||||
*
|
||||
* @param type InstallerRequest $request
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function accountcheck(InstallerRequest $request) {
|
||||
public function accountcheck(InstallerRequest $request)
|
||||
{
|
||||
|
||||
// migrate database
|
||||
Artisan::call('migrate', array('--force' => true));
|
||||
Artisan::call('db:seed', array('--force' => true));
|
||||
Artisan::call('migrate', ['--force' => true]);
|
||||
Artisan::call('db:seed', ['--force' => true]);
|
||||
|
||||
// create user
|
||||
$firstname = $request->input('firstname');
|
||||
@@ -274,7 +295,6 @@ class InstallController extends Controller {
|
||||
$date = $request->input('date');
|
||||
$datetime = $request->input('datetime');
|
||||
|
||||
|
||||
//\Cache::forever('language', $language);
|
||||
|
||||
//\App::setLocale($language);
|
||||
@@ -296,16 +316,15 @@ class InstallController extends Controller {
|
||||
}
|
||||
|
||||
// Creating minum settings for system
|
||||
$system = new System;
|
||||
$system = new System();
|
||||
$system->status = 1;
|
||||
$system->department = 1;
|
||||
$system->date_time_format = $date_time_format->id;
|
||||
$system->time_zone = $timezones->id;
|
||||
$system->save();
|
||||
|
||||
|
||||
// creating an user
|
||||
$user = User::create(array(
|
||||
$user = User::create([
|
||||
'first_name' => $firstname,
|
||||
'last_name' => $lastname,
|
||||
'email' => $email,
|
||||
@@ -315,20 +334,23 @@ class InstallController extends Controller {
|
||||
'primary_dpt' => 1,
|
||||
'active' => 1,
|
||||
'role' => 'admin',
|
||||
));
|
||||
]);
|
||||
// checking if the user have been created
|
||||
if ($user) {
|
||||
Session::put('step6', 'step6');
|
||||
|
||||
return Redirect::route('final');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get finalize
|
||||
* checking prerequisites
|
||||
* checking prerequisites.
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function finalize() {
|
||||
public function finalize()
|
||||
{
|
||||
// checking if the installation have been completed or not
|
||||
if (Session::get('step6') == 'step6') {
|
||||
$value = '1';
|
||||
@@ -354,6 +376,7 @@ class InstallController extends Controller {
|
||||
Session::forget('step4');
|
||||
Session::forget('step5');
|
||||
Session::forget('step6');
|
||||
|
||||
return View::make('themes/default1/installer/helpdesk/view6');
|
||||
} catch (Exception $e) {
|
||||
return Redirect::route('npl');
|
||||
@@ -365,15 +388,16 @@ class InstallController extends Controller {
|
||||
|
||||
/**
|
||||
* Post finalcheck
|
||||
* checking prerequisites
|
||||
* checking prerequisites.
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function finalcheck() {
|
||||
public function finalcheck()
|
||||
{
|
||||
try {
|
||||
return redirect('/auth/login');
|
||||
} catch (Exception $e) {
|
||||
return redirect('/auth/login');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,12 +5,10 @@ namespace App\Http;
|
||||
use Illuminate\Foundation\Http\Kernel as HttpKernel;
|
||||
|
||||
/**
|
||||
* Kernel
|
||||
*
|
||||
* @package HttpKernel
|
||||
* Kernel.
|
||||
*/
|
||||
class Kernel extends HttpKernel {
|
||||
|
||||
class Kernel extends HttpKernel
|
||||
{
|
||||
/**
|
||||
* The application's global HTTP middleware stack.
|
||||
*
|
||||
@@ -40,7 +38,6 @@ class Kernel extends HttpKernel {
|
||||
'role.user' => 'App\Http\Middleware\CheckRoleUser',
|
||||
'api' => 'App\Http\Middleware\ApiKey',
|
||||
'jwt.auth' => \Tymon\JWTAuth\Middleware\GetUserFromToken::class,
|
||||
'jwt.refresh' => \Tymon\JWTAuth\Middleware\RefreshToken::class
|
||||
'jwt.refresh' => \Tymon\JWTAuth\Middleware\RefreshToken::class,
|
||||
];
|
||||
|
||||
}
|
||||
|
@@ -2,14 +2,15 @@
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use App\Model\helpdesk\Settings\System;
|
||||
use Closure;
|
||||
|
||||
class ApiKey {
|
||||
|
||||
class ApiKey
|
||||
{
|
||||
public $setting;
|
||||
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
$setting = new System();
|
||||
$this->setting = $setting;
|
||||
}
|
||||
@@ -19,9 +20,11 @@ class ApiKey {
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next) {
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
$set = $this->setting->where('id', '1')->first();
|
||||
if ($set->api_enable == 1) {
|
||||
$key = $set->api_key;
|
||||
@@ -29,12 +32,13 @@ class ApiKey {
|
||||
return $next($request);
|
||||
} else {
|
||||
$result = 'wrong api key';
|
||||
|
||||
return response()->json(compact('result'));
|
||||
}
|
||||
} else {
|
||||
$result = 'please enable api';
|
||||
|
||||
return response()->json(compact('result'));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -6,13 +6,12 @@ use Closure;
|
||||
use Illuminate\Contracts\Auth\Guard;
|
||||
|
||||
/**
|
||||
* Authenticate
|
||||
* Authenticate.
|
||||
*
|
||||
* @package Middleware
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class Authenticate {
|
||||
|
||||
class Authenticate
|
||||
{
|
||||
/**
|
||||
* The Guard implementation.
|
||||
*
|
||||
@@ -24,9 +23,11 @@ class Authenticate {
|
||||
* Create a new filter instance.
|
||||
*
|
||||
* @param Guard $auth
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Guard $auth) {
|
||||
public function __construct(Guard $auth)
|
||||
{
|
||||
$this->auth = $auth;
|
||||
}
|
||||
|
||||
@@ -35,9 +36,11 @@ class Authenticate {
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next) {
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
if ($this->auth->guest()) {
|
||||
if ($request->ajax()) {
|
||||
return response('Unauthorized.', 401);
|
||||
@@ -48,5 +51,4 @@ class Authenticate {
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,26 +5,26 @@ namespace App\Http\Middleware;
|
||||
use Closure;
|
||||
|
||||
/**
|
||||
* CheckRole
|
||||
* CheckRole.
|
||||
*
|
||||
* @package Middleware
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class CheckRole {
|
||||
|
||||
class CheckRole
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next) {
|
||||
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
if ($request->user()->role == 'admin') {
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
return redirect('guest')->with('fails', 'You are not Autherised');
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,25 +5,26 @@ namespace App\Http\Middleware;
|
||||
use Closure;
|
||||
|
||||
/**
|
||||
* CheckRoleAgent
|
||||
* CheckRoleAgent.
|
||||
*
|
||||
* @package default
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class CheckRoleAgent {
|
||||
|
||||
class CheckRoleAgent
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next) {
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
if ($request->user()->role == 'agent' || $request->user()->role == 'admin') {
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
return redirect('dashboard')->with('fails', 'You are not Autherised');
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,25 +5,26 @@ namespace App\Http\Middleware;
|
||||
use Closure;
|
||||
|
||||
/**
|
||||
* CheckRoleUser
|
||||
* CheckRoleUser.
|
||||
*
|
||||
* @package Middleware
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class CheckRoleUser {
|
||||
|
||||
class CheckRoleUser
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next) {
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
if ($request->user()->role == 'user') {
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
return redirect('guest')->with('fails', 'You are not Autherised');
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,22 +5,19 @@ namespace App\Http\Middleware;
|
||||
use Cache;
|
||||
use Closure;
|
||||
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\Config;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
|
||||
class LanguageMiddleware implements Middleware {
|
||||
|
||||
public function handle($request, Closure $next) {
|
||||
if (Cache::has('language') AND array_key_exists(Cache::get('language'), Config::get('languages'))) {
|
||||
class LanguageMiddleware implements Middleware
|
||||
{
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
if (Cache::has('language') and array_key_exists(Cache::get('language'), Config::get('languages'))) {
|
||||
App::setLocale(Cache::get('language'));
|
||||
} else { // This is optional as Laravel will automatically set the fallback language if there is none specified
|
||||
App::setLocale(Config::get('app.fallback_locale'));
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -6,8 +6,8 @@ use Closure;
|
||||
use Illuminate\Contracts\Auth\Guard;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
|
||||
class RedirectIfAuthenticated {
|
||||
|
||||
class RedirectIfAuthenticated
|
||||
{
|
||||
/**
|
||||
* The Guard implementation.
|
||||
*
|
||||
@@ -19,9 +19,11 @@ class RedirectIfAuthenticated {
|
||||
* Create a new filter instance.
|
||||
*
|
||||
* @param Guard $auth
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Guard $auth) {
|
||||
public function __construct(Guard $auth)
|
||||
{
|
||||
$this->auth = $auth;
|
||||
}
|
||||
|
||||
@@ -30,14 +32,15 @@ class RedirectIfAuthenticated {
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next) {
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
if ($this->auth->check()) {
|
||||
return new RedirectResponse(url('dashboard'));
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,17 +5,18 @@ namespace App\Http\Middleware;
|
||||
use Closure;
|
||||
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as BaseVerifier;
|
||||
|
||||
class VerifyCsrfToken extends BaseVerifier {
|
||||
|
||||
class VerifyCsrfToken extends BaseVerifier
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next) {
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
return parent::handle($request, $next);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -4,6 +4,7 @@ namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
abstract class Request extends FormRequest {
|
||||
abstract class Request extends FormRequest
|
||||
{
|
||||
//
|
||||
}
|
||||
|
@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
* AgentRequest
|
||||
* AgentRequest.
|
||||
*
|
||||
* @package Request
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class AgentRequest extends Request {
|
||||
|
||||
class AgentRequest extends Request
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize() {
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,8 @@ class AgentRequest extends Request {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules() {
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'user_name' => 'required|unique:users',
|
||||
'first_name' => 'required',
|
||||
@@ -42,5 +43,4 @@ class AgentRequest extends Request {
|
||||
'team_id' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
* AgentUpdate
|
||||
* AgentUpdate.
|
||||
*
|
||||
* @package Request
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class AgentUpdate extends Request {
|
||||
|
||||
class AgentUpdate extends Request
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize() {
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,8 @@ class AgentUpdate extends Request {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules() {
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'first_name' => 'required',
|
||||
'last_name' => 'required',
|
||||
@@ -41,5 +42,4 @@ class AgentUpdate extends Request {
|
||||
'team_id' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -4,14 +4,15 @@ namespace App\Http\Requests\helpdesk;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
class ArticleRequest extends Request {
|
||||
|
||||
class ArticleRequest extends Request
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize() {
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -20,11 +21,11 @@ class ArticleRequest extends Request {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules() {
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'name' => 'required',
|
||||
'description' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
* BanRequest
|
||||
* BanRequest.
|
||||
*
|
||||
* @package Request
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class BanRequest extends Request {
|
||||
|
||||
class BanRequest extends Request
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize() {
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -26,11 +26,11 @@ class BanRequest extends Request {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules() {
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'email' => 'required|email',
|
||||
'ban' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
* BanlistRequest
|
||||
* BanlistRequest.
|
||||
*
|
||||
* @package Request
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class BanlistRequest extends Request {
|
||||
|
||||
class BanlistRequest extends Request
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize() {
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -26,11 +26,11 @@ class BanlistRequest extends Request {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules() {
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'email' => 'email',
|
||||
'ban' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
* AgentRequest
|
||||
* AgentRequest.
|
||||
*
|
||||
* @package Request
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class CannedRequest extends Request {
|
||||
|
||||
class CannedRequest extends Request
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize() {
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -26,11 +26,11 @@ class CannedRequest extends Request {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules() {
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'title' => 'required',
|
||||
'message' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
* AgentRequest
|
||||
* AgentRequest.
|
||||
*
|
||||
* @package Request
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class CannedUpdateRequest extends Request {
|
||||
|
||||
class CannedUpdateRequest extends Request
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize() {
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -26,11 +26,11 @@ class CannedUpdateRequest extends Request {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules() {
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'title' => 'required',
|
||||
'message' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
* CheckTicket
|
||||
* CheckTicket.
|
||||
*
|
||||
* @package Request
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class CheckTicket extends Request {
|
||||
|
||||
class CheckTicket extends Request
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize() {
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -26,11 +26,11 @@ class CheckTicket extends Request {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules() {
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'email' => 'required|email',
|
||||
'ticket_number' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
* CompanyRequest
|
||||
* CompanyRequest.
|
||||
*
|
||||
* @package Request
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class ClientRequest extends Request {
|
||||
|
||||
class ClientRequest extends Request
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize() {
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,8 @@ class ClientRequest extends Request {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules() {
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'Name' => 'required',
|
||||
'Email' => 'required',
|
||||
@@ -34,5 +35,4 @@ class ClientRequest extends Request {
|
||||
'Details' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -4,14 +4,15 @@ namespace App\Http\Requests\helpdesk;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
class CommentRequest extends Request {
|
||||
|
||||
class CommentRequest extends Request
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize() {
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -20,7 +21,8 @@ class CommentRequest extends Request {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules() {
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'name' => 'required|max:10',
|
||||
'email' => 'required|email',
|
||||
@@ -28,5 +30,4 @@ class CommentRequest extends Request {
|
||||
'comment' => 'required|max:60',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
* CompanyRequest
|
||||
* CompanyRequest.
|
||||
*
|
||||
* @package Request
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class CompanyRequest extends Request {
|
||||
|
||||
class CompanyRequest extends Request
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize() {
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,8 @@ class CompanyRequest extends Request {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules() {
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'company_name' => 'required',
|
||||
'website' => 'url',
|
||||
@@ -34,5 +35,4 @@ class CompanyRequest extends Request {
|
||||
'logo' => 'image',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -4,14 +4,15 @@ namespace App\Http\Requests\helpdesk;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
class ContactRequest extends Request {
|
||||
|
||||
class ContactRequest extends Request
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize() {
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -20,7 +21,8 @@ class ContactRequest extends Request {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules() {
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'name' => 'required',
|
||||
'email' => 'required|email',
|
||||
@@ -28,5 +30,4 @@ class ContactRequest extends Request {
|
||||
'message' => 'required|max:50',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
* CreateTicketRequest
|
||||
* CreateTicketRequest.
|
||||
*
|
||||
* @package Request
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class CreateTicketRequest extends Request {
|
||||
|
||||
class CreateTicketRequest extends Request
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize() {
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,8 @@ class CreateTicketRequest extends Request {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules() {
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
|
||||
'email' => 'required|email',
|
||||
@@ -39,5 +40,4 @@ class CreateTicketRequest extends Request {
|
||||
'priority' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
* DepartmentRequest
|
||||
* DepartmentRequest.
|
||||
*
|
||||
* @package Request
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class DepartmentRequest extends Request {
|
||||
|
||||
class DepartmentRequest extends Request
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize() {
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,8 @@ class DepartmentRequest extends Request {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules() {
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'name' => 'required|unique:department',
|
||||
// 'outgoing_email' => 'required',
|
||||
@@ -34,5 +35,4 @@ class DepartmentRequest extends Request {
|
||||
// 'group_id' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
* DepartmentUpdate
|
||||
* DepartmentUpdate.
|
||||
*
|
||||
* @package Request
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class DepartmentUpdate extends Request {
|
||||
|
||||
class DepartmentUpdate extends Request
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize() {
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,8 @@ class DepartmentUpdate extends Request {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules() {
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
|
||||
// 'outgoing_email' => 'required',
|
||||
@@ -34,5 +35,4 @@ class DepartmentUpdate extends Request {
|
||||
// 'group_id' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
* DiagnoRequest
|
||||
* DiagnoRequest.
|
||||
*
|
||||
* @package Request
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class DiagnoRequest extends Request {
|
||||
|
||||
class DiagnoRequest extends Request
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize() {
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,8 @@ class DiagnoRequest extends Request {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules() {
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'from' => 'required|email',
|
||||
'to' => 'required|email',
|
||||
@@ -34,5 +35,4 @@ class DiagnoRequest extends Request {
|
||||
'message' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
* EmailRequest
|
||||
* EmailRequest.
|
||||
*
|
||||
* @package Request
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class EmailRequest extends Request {
|
||||
|
||||
class EmailRequest extends Request
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize() {
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -26,9 +26,9 @@ class EmailRequest extends Request {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules() {
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
* EmailsEditRequest
|
||||
* EmailsEditRequest.
|
||||
*
|
||||
* @package Request
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class EmailsEditRequest extends Request {
|
||||
|
||||
class EmailsEditRequest extends Request
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize() {
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,8 @@ class EmailsEditRequest extends Request {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules() {
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'email_address' => 'email',
|
||||
'email_name' => 'required',
|
||||
@@ -44,5 +45,4 @@ class EmailsEditRequest extends Request {
|
||||
'mailbox_protocol' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
* EmailsRequest
|
||||
* EmailsRequest.
|
||||
*
|
||||
* @package Request
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class EmailsRequest extends Request {
|
||||
|
||||
class EmailsRequest extends Request
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize() {
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,8 @@ class EmailsRequest extends Request {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules() {
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'email_address' => 'required|email|unique:emails',
|
||||
'email_name' => 'required',
|
||||
@@ -43,5 +44,4 @@ class EmailsRequest extends Request {
|
||||
'mailbox_protocol' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
* FormRequest
|
||||
* FormRequest.
|
||||
*
|
||||
* @package Request
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class FormRequest extends Request {
|
||||
|
||||
class FormRequest extends Request
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize() {
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,8 @@ class FormRequest extends Request {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules() {
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
|
||||
'title' => 'required',
|
||||
@@ -35,5 +36,4 @@ class FormRequest extends Request {
|
||||
'visibility' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
* GroupRequest
|
||||
* GroupRequest.
|
||||
*
|
||||
* @package Request
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class GroupRequest extends Request {
|
||||
|
||||
class GroupRequest extends Request
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize() {
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -26,10 +26,10 @@ class GroupRequest extends Request {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules() {
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'name' => 'required|unique:groups',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
* HelptopicRequest
|
||||
* HelptopicRequest.
|
||||
*
|
||||
* @package Request
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class HelptopicRequest extends Request {
|
||||
|
||||
class HelptopicRequest extends Request
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize() {
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,8 @@ class HelptopicRequest extends Request {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules() {
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'topic' => 'required|unique:help_topic',
|
||||
// 'parent_topic' => 'required',
|
||||
@@ -37,5 +38,4 @@ class HelptopicRequest extends Request {
|
||||
// 'auto_assign' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
* HelptopicUpdate
|
||||
* HelptopicUpdate.
|
||||
*
|
||||
* @package Request
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class HelptopicUpdate extends Request {
|
||||
|
||||
class HelptopicUpdate extends Request
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize() {
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,8 @@ class HelptopicUpdate extends Request {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules() {
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
// 'parent_topic' => 'required',
|
||||
// 'custom_form' => 'required',
|
||||
@@ -36,5 +37,4 @@ class HelptopicUpdate extends Request {
|
||||
// 'auto_assign' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
* InstallerRequest
|
||||
* InstallerRequest.
|
||||
*
|
||||
* @package Request
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class InstallerRequest extends Request {
|
||||
|
||||
class InstallerRequest extends Request
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize() {
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,8 @@ class InstallerRequest extends Request {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules() {
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'firstname' => 'required|max:20',
|
||||
'Lastname' => 'required|max:20',
|
||||
@@ -36,5 +37,4 @@ class InstallerRequest extends Request {
|
||||
'confirmpassword' => 'required|same:password',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,19 +5,19 @@ namespace App\Http\Requests\helpdesk;
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
* LoginRequest
|
||||
* LoginRequest.
|
||||
*
|
||||
* @package Request
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class LoginRequest extends Request {
|
||||
|
||||
class LoginRequest extends Request
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize() {
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -26,11 +26,11 @@ class LoginRequest extends Request {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules() {
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'email' => 'required',
|
||||
'password' => 'required|min:6',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -4,14 +4,15 @@ namespace App\Http\Requests\helpdesk;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
class MessageRequest extends Request {
|
||||
|
||||
class MessageRequest extends Request
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize() {
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -20,13 +21,12 @@ class MessageRequest extends Request {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules() {
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
|
||||
|
||||
'message_title' => 'required',
|
||||
'message' => 'required'
|
||||
'message' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user