Applied fixes from StyleCI
This commit is contained in:

committed by
StyleCI Bot

parent
09bf25b5e2
commit
e2390f67d4
@@ -2,13 +2,13 @@
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use App\Http\Controllers\Agent\helpdesk\NotificationController;
|
||||
use App\Http\Controllers\Common\PhpMailController;
|
||||
use Exception;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class SendReport extends Command {
|
||||
|
||||
class SendReport extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
@@ -30,7 +30,8 @@ class SendReport extends Command {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
$mail = new PhpMailController();
|
||||
$report = new NotificationController($mail);
|
||||
$this->report = $report;
|
||||
@@ -42,15 +43,15 @@ class SendReport extends Command {
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle() {
|
||||
public function handle()
|
||||
{
|
||||
try {
|
||||
$this->report->send_notification();
|
||||
\Log::info("Report has send");
|
||||
$this->info("Report has send");
|
||||
\Log::info('Report has send');
|
||||
$this->info('Report has send');
|
||||
} catch (Exception $ex) {
|
||||
dd($ex);
|
||||
$this->error($ex->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
// controller
|
||||
use Bugsnag;
|
||||
//use Illuminate\Validation\ValidationException;
|
||||
@@ -11,6 +13,7 @@ use Illuminate\Auth\Access\AuthorizationException;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
use Illuminate\Foundation\Validation\ValidationException;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
class Handler extends ExceptionHandler
|
||||
{
|
||||
/**
|
||||
@@ -27,6 +30,7 @@ class Handler extends ExceptionHandler
|
||||
ModelNotFoundException::class,
|
||||
\Symfony\Component\HttpKernel\Exception\HttpException::class,
|
||||
];
|
||||
|
||||
/**
|
||||
* Report or log an exception.
|
||||
*
|
||||
@@ -48,8 +52,10 @@ class Handler extends ExceptionHandler
|
||||
$version = \Config::get('app.version');
|
||||
Bugsnag::setAppVersion($version);
|
||||
}
|
||||
|
||||
return parent::report($e);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render an exception into an HTTP response.
|
||||
*
|
||||
@@ -71,6 +77,7 @@ class Handler extends ExceptionHandler
|
||||
return $this->common($request, $e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to render 500 error page.
|
||||
*
|
||||
@@ -84,9 +91,11 @@ class Handler extends ExceptionHandler
|
||||
if (config('app.debug') == true) {
|
||||
return parent::render($request, $e);
|
||||
}
|
||||
|
||||
return response()->view('errors.500');
|
||||
//return redirect()->route('error500', []);
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to render 404 error page.
|
||||
*
|
||||
@@ -97,21 +106,23 @@ class Handler extends ExceptionHandler
|
||||
*/
|
||||
public function render404($request, $e)
|
||||
{
|
||||
|
||||
$seg = $request->segments();
|
||||
if (in_array('api', $seg)) {
|
||||
return response()->json(['status' => '404']);
|
||||
}
|
||||
if (config('app.debug') == true) {
|
||||
if($e->getStatusCode() == '404') {
|
||||
if ($e->getStatusCode() == '404') {
|
||||
return redirect()->route('error404', []);
|
||||
}
|
||||
|
||||
return parent::render($request, $e);
|
||||
}
|
||||
|
||||
return redirect()->route('error404', []);
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to render database connection failed
|
||||
* Function to render database connection failed.
|
||||
*
|
||||
* @param type $request
|
||||
* @param type $e
|
||||
@@ -127,8 +138,10 @@ class Handler extends ExceptionHandler
|
||||
if (config('app.debug') == true) {
|
||||
return parent::render($request, $e);
|
||||
}
|
||||
|
||||
return redirect()->route('error404', []);
|
||||
}
|
||||
|
||||
/**
|
||||
* Common finction to render both types of codes.
|
||||
*
|
||||
@@ -145,7 +158,7 @@ class Handler extends ExceptionHandler
|
||||
case $e instanceof NotFoundHttpException:
|
||||
return $this->render404($request, $e);
|
||||
case $e instanceof PDOException:
|
||||
if(strpos('1045', $e->getMessage()) == true) {
|
||||
if (strpos('1045', $e->getMessage()) == true) {
|
||||
return $this->renderDB($request, $e);
|
||||
} else {
|
||||
return $this->render500($request, $e);
|
||||
@@ -159,6 +172,7 @@ class Handler extends ExceptionHandler
|
||||
default:
|
||||
return $this->render500($request, $e);
|
||||
}
|
||||
|
||||
return parent::render($request, $e);
|
||||
}
|
||||
}
|
@@ -3,8 +3,8 @@
|
||||
namespace App\Http\Controllers\Admin\helpdesk;
|
||||
|
||||
// controller
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Controllers\Common\PhpMailController;
|
||||
use App\Http\Controllers\Controller;
|
||||
// request
|
||||
use App\Http\Requests\helpdesk\AgentRequest;
|
||||
use App\Http\Requests\helpdesk\AgentUpdate;
|
||||
@@ -139,7 +139,7 @@ class AgentController extends Controller
|
||||
// fetch user credentails to send mail
|
||||
$name = $user->first_name;
|
||||
$email = $user->email;
|
||||
if($request->input('send_email')) {
|
||||
if ($request->input('send_email')) {
|
||||
try {
|
||||
// send mail on registration
|
||||
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $name, 'email' => $email], $message = ['subject' => null, 'scenario' => 'registration-notification'], $template_variables = ['user' => $name, 'email_address' => $email, 'user_password' => $password]);
|
||||
|
@@ -29,14 +29,15 @@ use Lang;
|
||||
*
|
||||
* @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');
|
||||
}
|
||||
@@ -48,9 +49,11 @@ class DepartmentController extends Controller {
|
||||
*
|
||||
* @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');
|
||||
@@ -70,7 +73,8 @@ class DepartmentController extends Controller {
|
||||
*
|
||||
* @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', 'agent2')->get();
|
||||
@@ -93,7 +97,8 @@ class DepartmentController extends Controller {
|
||||
*
|
||||
* @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', 'sla'))->save();
|
||||
if ($request->sla) {
|
||||
@@ -116,6 +121,7 @@ class DepartmentController extends Controller {
|
||||
->where('id', 1)
|
||||
->update(['department' => $department->id]);
|
||||
}
|
||||
|
||||
return redirect('departments')->with('success', Lang::get('lang.department_created_sucessfully'));
|
||||
} else {
|
||||
return redirect('departments')->with('fails', Lang::get('lang.failed_to_create_department'));
|
||||
@@ -140,7 +146,8 @@ class DepartmentController extends Controller {
|
||||
*
|
||||
* @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 {
|
||||
$sys_department = \DB::table('settings_system')
|
||||
->select('department')
|
||||
@@ -170,7 +177,8 @@ class DepartmentController extends Controller {
|
||||
*
|
||||
* @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);
|
||||
@@ -218,7 +226,8 @@ class DepartmentController extends Controller {
|
||||
*
|
||||
* @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();
|
||||
@@ -232,7 +241,7 @@ class DepartmentController extends Controller {
|
||||
} else {
|
||||
$text_tickets = 'Ticket';
|
||||
}
|
||||
$ticket = '<li>' . $tickets . ' ' . $text_tickets . Lang::get('lang.have_been_moved_to_default_department') . '</li>';
|
||||
$ticket = '<li>'.$tickets.' '.$text_tickets.Lang::get('lang.have_been_moved_to_default_department').'</li>';
|
||||
} else {
|
||||
$ticket = '';
|
||||
}
|
||||
@@ -243,7 +252,7 @@ class DepartmentController extends Controller {
|
||||
} else {
|
||||
$text_user = 'User';
|
||||
}
|
||||
$user = '<li>' . $users . ' ' . $text_user . Lang::get('lang.have_been_moved_to_default_department') . '</li>';
|
||||
$user = '<li>'.$users.' '.$text_user.Lang::get('lang.have_been_moved_to_default_department').'</li>';
|
||||
} else {
|
||||
$user = '';
|
||||
}
|
||||
@@ -254,28 +263,27 @@ class DepartmentController extends Controller {
|
||||
} else {
|
||||
$text_emails = 'Email';
|
||||
}
|
||||
$email = '<li>' . $emails . ' System ' . $text_emails . Lang::get('lang.have_been_moved_to_default_department') . ' </li>';
|
||||
$email = '<li>'.$emails.' System '.$text_emails.Lang::get('lang.have_been_moved_to_default_department').' </li>';
|
||||
} else {
|
||||
$email = '';
|
||||
}
|
||||
$helptopic = DB::table('help_topic')->where('department', '=', $id)->update(['department' => null], ['status' => '1']);
|
||||
if ($helptopic > 0) {
|
||||
$helptopic = '<li>' . Lang::get('lang.the_associated_helptopic_has_been_deactivated') . '</li>';
|
||||
$helptopic = '<li>'.Lang::get('lang.the_associated_helptopic_has_been_deactivated').'</li>';
|
||||
} else {
|
||||
$helptopic = '';
|
||||
}
|
||||
$message = $ticket . $user . $email . $helptopic;
|
||||
$message = $ticket.$user.$email.$helptopic;
|
||||
/* Becouse of foreign key we delete group_assign_department first */
|
||||
$group_assign_department = $group_assign_department->where('department_id', $id);
|
||||
$group_assign_department->delete();
|
||||
$departments = $department->whereId($id)->first();
|
||||
/* Check the function is Success or Fail */
|
||||
if ($departments->delete() == true) {
|
||||
return redirect('departments')->with('success', Lang::get('lang.department_deleted_sucessfully') . $message);
|
||||
return redirect('departments')->with('success', Lang::get('lang.department_deleted_sucessfully').$message);
|
||||
} else {
|
||||
return redirect('departments')->with('fails', Lang::get('lang.department_can_not_delete'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\helpdesk;
|
||||
|
||||
// Controller
|
||||
use App\Http\Controllers\Controller;
|
||||
// Model
|
||||
@@ -12,6 +14,7 @@ use Illuminate\Http\Request;
|
||||
use Input;
|
||||
use Lang;
|
||||
use Redirect;
|
||||
|
||||
/**
|
||||
* FormController
|
||||
* This controller is used to CRUD Custom Forms.
|
||||
@@ -22,12 +25,14 @@ class FormController extends Controller
|
||||
{
|
||||
private $fields;
|
||||
private $forms;
|
||||
|
||||
public function __construct(Fields $fields, Forms $forms)
|
||||
{
|
||||
$this->fields = $fields;
|
||||
$this->forms = $forms;
|
||||
$this->middleware('auth');
|
||||
}
|
||||
|
||||
/**
|
||||
* home.
|
||||
*
|
||||
@@ -37,6 +42,7 @@ class FormController extends Controller
|
||||
{
|
||||
return view('forms.home');
|
||||
}
|
||||
|
||||
/**
|
||||
* list of forms.
|
||||
*
|
||||
@@ -52,6 +58,7 @@ class FormController extends Controller
|
||||
return redirect()->back()->with('fails', $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* create a new form.
|
||||
*
|
||||
@@ -65,6 +72,7 @@ class FormController extends Controller
|
||||
return redirect()->back()->with('fails', $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show a new form.
|
||||
*
|
||||
@@ -80,6 +88,7 @@ class FormController extends Controller
|
||||
return redirect()->back()->with('fails', $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a new form.
|
||||
*
|
||||
@@ -115,8 +124,10 @@ class FormController extends Controller
|
||||
}
|
||||
}
|
||||
Fields::insert($fields);
|
||||
|
||||
return Redirect::back()->with('success', Lang::get('lang.successfully_created_form'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete Form.
|
||||
*
|
||||
@@ -140,6 +151,7 @@ class FormController extends Controller
|
||||
}
|
||||
$forms = $forms->where('id', $id)->first();
|
||||
$forms->delete();
|
||||
|
||||
return redirect()->back()->with('success', Lang::get('lang.form_deleted_successfully'));
|
||||
}
|
||||
}
|
@@ -103,7 +103,6 @@ class LanguageController extends Controller
|
||||
} else {
|
||||
return Config::get('languages.'.$model);
|
||||
}
|
||||
|
||||
})
|
||||
->addColumn('id', function ($model) {
|
||||
return $model;
|
||||
@@ -249,6 +248,7 @@ class LanguageController extends Controller
|
||||
}
|
||||
} else {
|
||||
Session::flash('fails', Lang::get('lang.lang-fallback-lang'));
|
||||
|
||||
return redirect('languages');
|
||||
}
|
||||
} else {
|
||||
@@ -257,5 +257,4 @@ class LanguageController extends Controller
|
||||
return redirect('languages');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -19,6 +19,7 @@ use App\Model\helpdesk\Manage\Sla_plan;
|
||||
use App\Model\helpdesk\Notification\UserNotification;
|
||||
use App\Model\helpdesk\Ratings\Rating;
|
||||
use App\Model\helpdesk\Settings\Alert;
|
||||
use App\Model\helpdesk\Settings\CommonSettings;
|
||||
use App\Model\helpdesk\Settings\Company;
|
||||
use App\Model\helpdesk\Settings\Email;
|
||||
use App\Model\helpdesk\Settings\Responder;
|
||||
@@ -30,7 +31,6 @@ use App\Model\helpdesk\Utility\Date_time_format;
|
||||
use App\Model\helpdesk\Utility\Time_format;
|
||||
use App\Model\helpdesk\Utility\Timezones;
|
||||
use App\Model\helpdesk\Workflow\WorkflowClose;
|
||||
use App\Model\helpdesk\Settings\CommonSettings;
|
||||
use DateTime;
|
||||
// classes
|
||||
use DB;
|
||||
@@ -184,7 +184,7 @@ class SettingsController extends Controller
|
||||
/* Check whether function success or not */
|
||||
$systems->fill($request->input())->save();
|
||||
$rtl = CommonSettings::where('option_name', '=', 'enable_rtl')->first();
|
||||
if($request->enable_rtl != null) {
|
||||
if ($request->enable_rtl != null) {
|
||||
$rtl->option_value = 1;
|
||||
} else {
|
||||
$rtl->option_value = 0;
|
||||
@@ -192,7 +192,7 @@ class SettingsController extends Controller
|
||||
$rtl->save();
|
||||
|
||||
$usts = CommonSettings::where('option_name', '=', 'user_set_ticket_status')->first();
|
||||
if ($usts->status != $request->user_set_ticket_status){
|
||||
if ($usts->status != $request->user_set_ticket_status) {
|
||||
$usts->status = $request->user_set_ticket_status;
|
||||
$usts->save();
|
||||
}
|
||||
|
@@ -12,8 +12,8 @@ use App\Http\Requests\helpdesk\TemplateUdate;
|
||||
// models
|
||||
use App\Model\helpdesk\Email\Emails;
|
||||
use App\Model\helpdesk\Email\Template;
|
||||
use App\Model\helpdesk\Utility\Languages;
|
||||
use App\Model\helpdesk\Settings\CommonSettings;
|
||||
use App\Model\helpdesk\Utility\Languages;
|
||||
// classes
|
||||
use Exception;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -329,13 +329,13 @@ class TemplateController extends Controller
|
||||
$mail->AddAddress($address);
|
||||
$mail->Subject = $request->subject; // subject of the email
|
||||
$body = $request->message; // body of the email
|
||||
$mail->CharSet = "utf8";
|
||||
$mail->CharSet = 'utf8';
|
||||
// $mail->MsgHTML($body);
|
||||
// $body = $request->message;
|
||||
$rtl = CommonSettings::where('option_name', '=', 'enable_rtl')->first();
|
||||
if($rtl->option_value == 1) {
|
||||
if ($rtl->option_value == 1) {
|
||||
$mail->ContentType = 'text/html';
|
||||
$body = '<html dir="rtl" xml:lang="ar" lang="ar"><head></head><body dir="rtl">' . $body . '</body></html>';
|
||||
$body = '<html dir="rtl" xml:lang="ar" lang="ar"><head></head><body dir="rtl">'.$body.'</body></html>';
|
||||
} else {
|
||||
}
|
||||
if (!$mail->Send()) {
|
||||
@@ -364,13 +364,13 @@ class TemplateController extends Controller
|
||||
$mail->setFrom($email_details->email_address, $email_details->email_name);
|
||||
$mail->addAddress($request->to, ''); // Add a recipient
|
||||
$mail->isHTML(true); // Set email format to HTML
|
||||
$mail->CharSet = "utf8";
|
||||
$mail->CharSet = 'utf8';
|
||||
$mail->Subject = $request->subject;
|
||||
$body = $request->message;
|
||||
$rtl = CommonSettings::where('option_name', '=', 'enable_rtl')->first();
|
||||
if($rtl->option_value == 1) {
|
||||
if ($rtl->option_value == 1) {
|
||||
$mail->ContentType = 'text/html';
|
||||
$body = '<html dir="rtl" xml:lang="ar" lang="ar"><head></head><body dir="rtl">' . $body . '</body></html>';
|
||||
$body = '<html dir="rtl" xml:lang="ar" lang="ar"><head></head><body dir="rtl">'.$body.'</body></html>';
|
||||
} else {
|
||||
}
|
||||
$mail->Body = $body;
|
||||
@@ -380,6 +380,7 @@ class TemplateController extends Controller
|
||||
$return = Lang::get('lang.message_has_been_sent');
|
||||
}
|
||||
}
|
||||
|
||||
return redirect()->back()->with('success', $return);
|
||||
} catch (Exception $e) {
|
||||
return redirect()->back()->with('fails', $e->getMessage());
|
||||
|
@@ -27,15 +27,16 @@ use PhpImap\Mailbox as ImapMailbox;
|
||||
*
|
||||
* @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(TicketWorkflowController $TicketWorkflowController) {
|
||||
public function __construct(TicketWorkflowController $TicketWorkflowController)
|
||||
{
|
||||
$this->middleware('board');
|
||||
$this->TicketWorkflowController = $TicketWorkflowController;
|
||||
}
|
||||
@@ -45,7 +46,8 @@ class MailController extends Controller {
|
||||
*
|
||||
* @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) {
|
||||
@@ -80,7 +82,7 @@ class MailController extends Controller {
|
||||
$protocol = $fetching_encryption2;
|
||||
} else {
|
||||
if ($e_mail->fetching_protocol) {
|
||||
$fetching_protocol = '/' . $e_mail->fetching_protocol;
|
||||
$fetching_protocol = '/'.$e_mail->fetching_protocol;
|
||||
} else {
|
||||
$fetching_protocol = '';
|
||||
}
|
||||
@@ -89,20 +91,20 @@ class MailController extends Controller {
|
||||
} else {
|
||||
$fetching_encryption = '';
|
||||
}
|
||||
$protocol = $fetching_protocol . $fetching_encryption;
|
||||
$protocol = $fetching_protocol.$fetching_encryption;
|
||||
}
|
||||
$imap_config = '{' . $host . ':' . $port . $protocol . '}INBOX';
|
||||
$imap_config = '{'.$host.':'.$port.$protocol.'}INBOX';
|
||||
$password = Crypt::decrypt($e_mail->password);
|
||||
try {
|
||||
$mailbox = new ImapMailbox($imap_config, $e_mail->email_address, $password, __DIR__);
|
||||
} catch (\PhpImap\Exception $e) {
|
||||
echo "Connection error";
|
||||
echo 'Connection error';
|
||||
}
|
||||
$mails = [];
|
||||
try {
|
||||
$mailsIds = $mailbox->searchMailBox('SINCE ' . date('d-M-Y', strtotime('-1 day')));
|
||||
$mailsIds = $mailbox->searchMailBox('SINCE '.date('d-M-Y', strtotime('-1 day')));
|
||||
} catch (\PhpImap\Exception $e) {
|
||||
echo "Connection error";
|
||||
echo 'Connection error';
|
||||
}
|
||||
if (!$mailsIds) {
|
||||
die('Mailbox is empty');
|
||||
@@ -119,7 +121,7 @@ class MailController extends Controller {
|
||||
try {
|
||||
$mail = $mailbox->getMail($mailId);
|
||||
} catch (\PhpImap\Exception $e) {
|
||||
echo "Connection error";
|
||||
echo 'Connection error';
|
||||
}
|
||||
if ($settings_email->first()->email_collaborator == 1) {
|
||||
$collaborator = $mail->cc;
|
||||
@@ -137,11 +139,11 @@ class MailController extends Controller {
|
||||
if ($body == null) {
|
||||
$attach = $mail->getAttachments();
|
||||
if (is_array($attach)) {
|
||||
if (key_exists('html-body', $attach)) {
|
||||
if (array_key_exists('html-body', $attach)) {
|
||||
$path = $attach['html-body']->filePath;
|
||||
}
|
||||
if ($path == null) {
|
||||
if (key_exists('text-body', $attach)) {
|
||||
if (array_key_exists('text-body', $attach)) {
|
||||
$path = $attach['text-body']->filePath;
|
||||
}
|
||||
}
|
||||
@@ -151,7 +153,7 @@ class MailController extends Controller {
|
||||
if ($body) {
|
||||
$body = self::trimTableTag($body);
|
||||
} else {
|
||||
$body = "";
|
||||
$body = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -162,7 +164,7 @@ 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 = $date_time[1].'-'.$date_time[2].'-'.$date_time[3].' '.$date_time[4];
|
||||
$date = date('Y-m-d H:i:s', strtotime($date));
|
||||
if (isset($mail->subject)) {
|
||||
$subject = $mail->subject;
|
||||
@@ -193,10 +195,10 @@ class MailController extends Controller {
|
||||
$dir_img_paths = __DIR__;
|
||||
$dir_img_path = explode('/code', $dir_img_paths);
|
||||
|
||||
$filepath = explode('..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'public', $attachment->filePath);
|
||||
$filepath = explode('..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'public', $attachment->filePath);
|
||||
|
||||
if ($filepath[1]) {
|
||||
$path = public_path() . $filepath[1];
|
||||
$path = public_path().$filepath[1];
|
||||
|
||||
$filesize = filesize($path);
|
||||
$file_data = file_get_contents($path);
|
||||
@@ -205,7 +207,7 @@ 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) {
|
||||
@@ -251,7 +253,8 @@ class MailController extends Controller {
|
||||
*
|
||||
* @return type string
|
||||
*/
|
||||
public function separate_reply($body) {
|
||||
public function separate_reply($body)
|
||||
{
|
||||
$body2 = explode('---Reply above this line---', $body);
|
||||
$body3 = $body2[0];
|
||||
|
||||
@@ -265,7 +268,8 @@ class MailController extends Controller {
|
||||
*
|
||||
* @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) {
|
||||
@@ -280,7 +284,8 @@ class MailController extends Controller {
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function fetch_attachments() {
|
||||
public function fetch_attachments()
|
||||
{
|
||||
$uploads = Upload::all();
|
||||
foreach ($uploads as $attachment) {
|
||||
$image = @imagecreatefromstring($attachment->file);
|
||||
@@ -288,8 +293,8 @@ class MailController extends Controller {
|
||||
imagejpeg($image, null, 80);
|
||||
$data = ob_get_contents();
|
||||
ob_end_clean();
|
||||
$var = '<a href="" target="_blank"><img src="data:image/jpg;base64,' . base64_encode($data) . '"/></a>';
|
||||
echo '<br/><span class="mailbox-attachment-icon has-img">' . $var . '</span>';
|
||||
$var = '<a href="" target="_blank"><img src="data:image/jpg;base64,'.base64_encode($data).'"/></a>';
|
||||
echo '<br/><span class="mailbox-attachment-icon has-img">'.$var.'</span>';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -300,17 +305,19 @@ class MailController extends Controller {
|
||||
*
|
||||
* @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 . '');
|
||||
header('Content-Disposition: inline; filename=' . $attachment->name . '');
|
||||
header('Content-type: application/'.$attachment->type.'');
|
||||
header('Content-Disposition: inline; filename='.$attachment->name.'');
|
||||
header('Content-Transfer-Encoding: binary');
|
||||
echo $attachment->file;
|
||||
}
|
||||
}
|
||||
|
||||
public static function trimTableTag($html) {
|
||||
public static function trimTableTag($html)
|
||||
{
|
||||
if (strpos('<table>', $html) != false) {
|
||||
$first_pos = strpos($html, '<table');
|
||||
$fist_string = substr_replace($html, '', 0, $first_pos);
|
||||
@@ -326,13 +333,15 @@ class MailController extends Controller {
|
||||
return $html;
|
||||
}
|
||||
|
||||
public static function trim3D($html) {
|
||||
public static function trim3D($html)
|
||||
{
|
||||
$body = str_replace('=3D', '', $html);
|
||||
|
||||
return $body;
|
||||
}
|
||||
|
||||
public static function trimInjections($html, $tags = ['<script>', '</script>', '<style>', '</style>', '<?php', '?>']) {
|
||||
public static function trimInjections($html, $tags = ['<script>', '</script>', '<style>', '</style>', '<?php', '?>'])
|
||||
{
|
||||
$replace = [];
|
||||
foreach ($tags as $key => $tag) {
|
||||
$replace[$key] = htmlspecialchars($tag);
|
||||
@@ -341,5 +350,4 @@ class MailController extends Controller {
|
||||
|
||||
return $body;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -22,16 +22,18 @@ use View;
|
||||
*
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class NotificationController extends Controller {
|
||||
|
||||
public function __construct(PhpMailController $PhpMailController) {
|
||||
class NotificationController extends Controller
|
||||
{
|
||||
public function __construct(PhpMailController $PhpMailController)
|
||||
{
|
||||
$this->PhpMailController = $PhpMailController;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
@@ -40,7 +42,6 @@ class NotificationController extends Controller {
|
||||
$notification = Log_notification::where('log', '=', 'NOT-1')->orderBy('id', 'DESC')->first();
|
||||
$date = explode(' ', $notification->created_at);
|
||||
if (date('Y-m-d') == $date[0]) {
|
||||
|
||||
} else {
|
||||
// creating a daily notification log
|
||||
Log_notification::create(['log' => 'NOT-1']);
|
||||
@@ -64,24 +65,25 @@ class NotificationController extends Controller {
|
||||
*
|
||||
* @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;
|
||||
$view = View::make('emails.notifications.admin', ['company' => $company, 'name' => $user_name]);
|
||||
$contents = $view->render();
|
||||
$from = $this->PhpMailController->mailfrom('1', '0');
|
||||
$to = [
|
||||
'name' => $user_name,
|
||||
'email' => $email
|
||||
'email' => $email,
|
||||
];
|
||||
$message = [
|
||||
'subject' => 'Daily Report',
|
||||
'scenario' => null,
|
||||
'body' => $contents
|
||||
'body' => $contents,
|
||||
];
|
||||
$this->dispatch((new \App\Jobs\SendEmail($from, $to, $message))->onQueue('emails'));
|
||||
//$this->PhpMailController->sendEmail($from,$to,$message);
|
||||
@@ -93,7 +95,8 @@ class NotificationController extends Controller {
|
||||
*
|
||||
* @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) {
|
||||
@@ -103,7 +106,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;
|
||||
$view = View::make('emails.notifications.manager', ['company' => $company, 'name' => $user_name]);
|
||||
$contents = $view->render();
|
||||
$this->PhpMailController->sendEmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $user_name, 'email' => $email], $message = ['subject' => 'Daily Report', 'scenario' => null, 'body' => $contents]);
|
||||
@@ -117,7 +120,8 @@ class NotificationController extends Controller {
|
||||
*
|
||||
* @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) {
|
||||
@@ -127,7 +131,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;
|
||||
$view = View::make('emails.notifications.lead', ['company' => $company, 'name' => $user_name, 'team_id' => $team->id]);
|
||||
$contents = $view->render();
|
||||
$this->PhpMailController->sendEmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $user_name, 'email' => $email], $message = ['subject' => 'Daily Report', 'scenario' => null, 'body' => $contents]);
|
||||
@@ -141,13 +145,14 @@ class NotificationController extends Controller {
|
||||
*
|
||||
* @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;
|
||||
$view = View::make('emails.notifications.agent', ['company' => $company, 'name' => $user_name, 'user_id' => $user->id]);
|
||||
$contents = $view->render();
|
||||
$this->PhpMailController->sendEmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $user_name, 'email' => $email], $message = ['subject' => 'Daily Report', 'scenario' => null, 'body' => $contents]);
|
||||
@@ -159,7 +164,8 @@ class NotificationController extends Controller {
|
||||
*
|
||||
* @return type variable
|
||||
*/
|
||||
public function company() {
|
||||
public function company()
|
||||
{
|
||||
// fetching comapny model
|
||||
$company = Company::Where('id', '=', '1')->first();
|
||||
// fetching company name
|
||||
@@ -171,5 +177,4 @@ class NotificationController extends Controller {
|
||||
|
||||
return $company;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -3,7 +3,6 @@
|
||||
namespace App\Http\Controllers\Agent\helpdesk;
|
||||
|
||||
// controllers
|
||||
use App\Http\Controllers\Common\SettingsController;
|
||||
use App\Http\Controllers\Controller;
|
||||
// requests
|
||||
// models
|
||||
@@ -51,8 +50,10 @@ class Ticket2Controller extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* this function returns the list of open tickets of a particular department
|
||||
* this function returns the list of open tickets of a particular department.
|
||||
*
|
||||
* @param type $id
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function getOpenTickets($id)
|
||||
@@ -63,6 +64,7 @@ class Ticket2Controller extends Controller
|
||||
$dept = Department::where('id', '=', Auth::user()->primary_dpt)->first();
|
||||
$tickets = Tickets::where('status', '=', 1)->where('isanswered', '=', 0)->where('dept_id', '=', $dept->id)->get();
|
||||
}
|
||||
|
||||
return Ttable::getTable($tickets);
|
||||
}
|
||||
|
||||
@@ -86,8 +88,10 @@ class Ticket2Controller extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* this function returns the list of close tickets of a particular department
|
||||
* this function returns the list of close tickets of a particular department.
|
||||
*
|
||||
* @param type $id
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function getCloseTickets($id)
|
||||
@@ -98,12 +102,15 @@ class Ticket2Controller extends Controller
|
||||
$dept = Department::where('id', '=', Auth::user()->primary_dpt)->first();
|
||||
$tickets = Tickets::where('status', '=', '2')->where('status', '=', '3')->where('dept_id', '=', $dept->id)->get();
|
||||
}
|
||||
|
||||
return Ttable::getTable($tickets);
|
||||
}
|
||||
|
||||
/**
|
||||
* this function returns the list of close tickets of a particular department
|
||||
* this function returns the list of close tickets of a particular department.
|
||||
*
|
||||
* @param type $id
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function deptinprogress($id)
|
||||
@@ -136,5 +143,4 @@ class Ticket2Controller extends Controller
|
||||
|
||||
return Ttable::getTable($tickets);
|
||||
}
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@@ -350,6 +350,7 @@ class TicketWorkflowController extends Controller
|
||||
$ticket_settings_details = $this->changeStatus($workflow_action, $ticket_settings_details);
|
||||
}
|
||||
}
|
||||
|
||||
return $ticket_settings_details;
|
||||
}
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
namespace App\Http\Controllers\Agent\helpdesk;
|
||||
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Controllers\Common\PhpMailController;
|
||||
use App\Http\Controllers\Controller;
|
||||
// requests
|
||||
/* Include Sys_user Model */
|
||||
use App\Http\Requests\helpdesk\ProfilePassword;
|
||||
@@ -79,7 +79,7 @@ class UserController extends Controller
|
||||
public function user_list()
|
||||
{
|
||||
// displaying list of users with chumper datatables
|
||||
return \Datatable::collection(User::where('role',"=","user")->get())
|
||||
return \Datatable::collection(User::where('role', '=', 'user')->get())
|
||||
/* searchable column username and email */
|
||||
->searchColumns('user_name', 'email', 'phone')
|
||||
/* order column username and email */
|
||||
@@ -207,7 +207,7 @@ class UserController extends Controller
|
||||
// fetch user credentails to send mail
|
||||
$name = $user->first_name;
|
||||
$email = $user->email;
|
||||
if($request->input('send_email')) {
|
||||
if ($request->input('send_email')) {
|
||||
try {
|
||||
// send mail on registration
|
||||
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $name, 'email' => $email], $message = ['subject' => null, 'scenario' => 'registration-notification'], $template_variables = ['user' => $name, 'email_address' => $email, 'user_password' => $password]);
|
||||
@@ -283,7 +283,7 @@ class UserController extends Controller
|
||||
*/
|
||||
public function update($id, Sys_userUpdate $request)
|
||||
{
|
||||
// dd($request);
|
||||
// dd($request);
|
||||
$user = new User();
|
||||
/* select the field where id = $id(request Id) */
|
||||
$users = $user->whereId($id)->first();
|
||||
@@ -511,7 +511,6 @@ class UserController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generate a random string for password.
|
||||
*
|
||||
@@ -534,5 +533,4 @@ class UserController extends Controller
|
||||
// return random string
|
||||
return $randomString;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -65,7 +65,7 @@ class ArticleController extends Controller
|
||||
$article = new Article();
|
||||
$articles = $article
|
||||
->select('id', 'name', 'description', 'publish_time', 'slug')
|
||||
->orderBy('publish_time','desc')
|
||||
->orderBy('publish_time', 'desc')
|
||||
->get();
|
||||
// returns chumper datatable
|
||||
return Datatable::Collection($articles)
|
||||
|
@@ -77,6 +77,7 @@ class CategoryController extends Controller
|
||||
/* add column name */
|
||||
->addColumn('name', function ($model) {
|
||||
$string = strip_tags($model->name);
|
||||
|
||||
return str_limit($string, 20);
|
||||
})
|
||||
/* add column Created */
|
||||
@@ -120,7 +121,7 @@ class CategoryController extends Controller
|
||||
public function create(Category $category)
|
||||
{
|
||||
/* Get the all attributes in the category model */
|
||||
$category = $category->lists('name','id')->toArray();
|
||||
$category = $category->lists('name', 'id')->toArray();
|
||||
/* get the view page to create new category with all attributes
|
||||
of category model */
|
||||
try {
|
||||
@@ -147,6 +148,7 @@ class CategoryController extends Controller
|
||||
// send success message to index page
|
||||
try {
|
||||
$category->fill($request->input())->save();
|
||||
|
||||
return Redirect::back()->with('success', Lang::get('lang.category_inserted_successfully'));
|
||||
} catch (Exception $e) {
|
||||
return Redirect::back()->with('fails', Lang::get('lang.category_not_inserted').'<li>'.$e->getMessage().'</li>');
|
||||
@@ -165,9 +167,9 @@ class CategoryController extends Controller
|
||||
{
|
||||
/* get the atributes of the category model whose id == $id */
|
||||
$category = Category::whereId($id)->first();
|
||||
$categories = Category::lists('name','id')->toArray();
|
||||
$categories = Category::lists('name', 'id')->toArray();
|
||||
/* get the Edit page the selected category via id */
|
||||
return view('themes.default1.agent.kb.category.edit', compact('category','categories'));
|
||||
return view('themes.default1.agent.kb.category.edit', compact('category', 'categories'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -191,6 +193,7 @@ class CategoryController extends Controller
|
||||
try {
|
||||
$category->slug = $slug;
|
||||
$category->fill($request->input())->save();
|
||||
|
||||
return redirect('category')->with('success', Lang::get('lang.category_updated_successfully'));
|
||||
} catch (Exception $e) {
|
||||
//redirect to index with fails message
|
||||
|
@@ -33,8 +33,8 @@ use Illuminate\Support\Collection;
|
||||
*
|
||||
* @version v1
|
||||
*/
|
||||
class ApiController extends Controller {
|
||||
|
||||
class ApiController extends Controller
|
||||
{
|
||||
public $user;
|
||||
public $request;
|
||||
public $ticket;
|
||||
@@ -54,7 +54,8 @@ class ApiController extends Controller {
|
||||
/**
|
||||
* @param Request $request
|
||||
*/
|
||||
public function __construct(Request $request) {
|
||||
public function __construct(Request $request)
|
||||
{
|
||||
$this->request = $request;
|
||||
|
||||
$this->middleware('jwt.auth');
|
||||
@@ -63,9 +64,7 @@ class ApiController extends Controller {
|
||||
$user = \JWTAuth::parseToken()->authenticate();
|
||||
$this->user = $user;
|
||||
} catch (\Tymon\JWTAuth\Exceptions\TokenExpiredException $e) {
|
||||
|
||||
} catch (\Tymon\JWTAuth\Exceptions\JWTException $e) {
|
||||
|
||||
}
|
||||
|
||||
$ticket = new TicketController();
|
||||
@@ -120,7 +119,8 @@ class ApiController extends Controller {
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function createTicket() {
|
||||
public function createTicket()
|
||||
{
|
||||
try {
|
||||
$v = \Validator::make($this->request->all(), [
|
||||
'user_id' => 'required|exists:users,id',
|
||||
@@ -189,7 +189,8 @@ class ApiController extends Controller {
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function ticketReply() {
|
||||
public function ticketReply()
|
||||
{
|
||||
//dd($this->request->all());
|
||||
try {
|
||||
$v = \Validator::make($this->request->all(), [
|
||||
@@ -223,7 +224,8 @@ class ApiController extends Controller {
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function editTicket() {
|
||||
public function editTicket()
|
||||
{
|
||||
try {
|
||||
$v = \Validator::make($this->request->all(), [
|
||||
'ticket_id' => 'required|exists:tickets,id',
|
||||
@@ -260,7 +262,8 @@ class ApiController extends Controller {
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function deleteTicket() {
|
||||
public function deleteTicket()
|
||||
{
|
||||
try {
|
||||
$v = \Validator::make($this->request->all(), [
|
||||
'ticket_id' => 'required|exists:tickets,id',
|
||||
@@ -293,7 +296,8 @@ class ApiController extends Controller {
|
||||
*
|
||||
* @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'));
|
||||
@@ -337,7 +341,8 @@ class ApiController extends Controller {
|
||||
*
|
||||
* @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();
|
||||
@@ -355,7 +360,7 @@ class ApiController extends Controller {
|
||||
$join->on('tickets.id', '=', 'ticket_thread.ticket_id')
|
||||
->whereNotNull('title');
|
||||
})
|
||||
->select(\DB::raw('max(ticket_thread.updated_at) as updated_at'),'user_name', 'first_name', 'last_name', 'email', 'profile_pic', 'ticket_number', 'tickets.id', 'title', 'tickets.created_at', 'department.name as department_name', 'ticket_priority.priority as priotity_name', 'sla_plan.name as sla_plan_name', 'help_topic.topic as help_topic_name', 'ticket_status.name as ticket_status_name')
|
||||
->select(\DB::raw('max(ticket_thread.updated_at) as updated_at'), 'user_name', 'first_name', 'last_name', 'email', 'profile_pic', 'ticket_number', 'tickets.id', 'title', 'tickets.created_at', 'department.name as department_name', 'ticket_priority.priority as priotity_name', 'sla_plan.name as sla_plan_name', 'help_topic.topic as help_topic_name', 'ticket_status.name as ticket_status_name')
|
||||
->orderBy('updated_at', 'desc')
|
||||
->groupby('tickets.id')
|
||||
->distinct()
|
||||
@@ -381,14 +386,15 @@ class ApiController extends Controller {
|
||||
*
|
||||
* @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'));
|
||||
|
||||
$result = $this->user->join('tickets', function ($join) {
|
||||
$join->on('users.id', '=', 'tickets.user_id')
|
||||
->where('status','=',3)->orWhere('status','=',2);
|
||||
->where('status', '=', 3)->orWhere('status', '=', 2);
|
||||
})
|
||||
->join('department', 'department.id', '=', 'tickets.dept_id')
|
||||
->join('ticket_priority', 'ticket_priority.priority_id', '=', 'tickets.priority_id')
|
||||
@@ -399,7 +405,7 @@ class ApiController extends Controller {
|
||||
$join->on('tickets.id', '=', 'ticket_thread.ticket_id')
|
||||
->whereNotNull('title');
|
||||
})
|
||||
->select(\DB::raw('max(ticket_thread.updated_at) as updated_at'),'user_name', 'first_name', 'last_name', 'email', 'profile_pic', 'ticket_number', 'tickets.id', 'title', 'tickets.created_at', 'department.name as department_name', 'ticket_priority.priority as priotity_name', 'sla_plan.name as sla_plan_name', 'help_topic.topic as help_topic_name', 'ticket_status.name as ticket_status_name')
|
||||
->select(\DB::raw('max(ticket_thread.updated_at) as updated_at'), 'user_name', 'first_name', 'last_name', 'email', 'profile_pic', 'ticket_number', 'tickets.id', 'title', 'tickets.created_at', 'department.name as department_name', 'ticket_priority.priority as priotity_name', 'sla_plan.name as sla_plan_name', 'help_topic.topic as help_topic_name', 'ticket_status.name as ticket_status_name')
|
||||
->orderBy('updated_at', 'desc')
|
||||
->groupby('tickets.id')
|
||||
->distinct()
|
||||
@@ -425,7 +431,8 @@ class ApiController extends Controller {
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function getAgents() {
|
||||
public function getAgents()
|
||||
{
|
||||
try {
|
||||
$result = $this->faveoUser->where('role', 'agent')->orWhere('role', 'admin')->where('active', 1)->get();
|
||||
|
||||
@@ -448,7 +455,8 @@ class ApiController extends Controller {
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function getTeams() {
|
||||
public function getTeams()
|
||||
{
|
||||
try {
|
||||
$result = $this->team->get();
|
||||
|
||||
@@ -471,7 +479,8 @@ class ApiController extends Controller {
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function assignTicket() {
|
||||
public function assignTicket()
|
||||
{
|
||||
try {
|
||||
$v = \Validator::make($this->request->all(), [
|
||||
'ticket_id' => 'required',
|
||||
@@ -509,7 +518,8 @@ class ApiController extends Controller {
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function getCustomers() {
|
||||
public function getCustomers()
|
||||
{
|
||||
try {
|
||||
$v = \Validator::make($this->request->all(), [
|
||||
'search' => 'required',
|
||||
@@ -520,7 +530,7 @@ class ApiController extends Controller {
|
||||
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();
|
||||
$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'))
|
||||
->header('X-Header-One', 'Header Value');
|
||||
@@ -543,7 +553,8 @@ class ApiController extends Controller {
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function getCustomersWith() {
|
||||
public function getCustomersWith()
|
||||
{
|
||||
try {
|
||||
$users = $this->user
|
||||
->leftJoin('user_assign_organization', 'user_assign_organization.user_id', '=', 'users.id')
|
||||
@@ -574,7 +585,8 @@ class ApiController extends Controller {
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function getCustomer() {
|
||||
public function getCustomer()
|
||||
{
|
||||
try {
|
||||
$v = \Validator::make($this->request->all(), [
|
||||
'user_id' => 'required',
|
||||
@@ -606,7 +618,8 @@ class ApiController extends Controller {
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function searchTicket() {
|
||||
public function searchTicket()
|
||||
{
|
||||
try {
|
||||
$v = \Validator::make($this->request->all(), [
|
||||
'search' => 'required',
|
||||
@@ -617,7 +630,7 @@ class ApiController extends Controller {
|
||||
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();
|
||||
$result = $this->thread->select('ticket_id')->where('title', 'like', '%'.$search.'%')->orWhere('body', 'like', '%'.$search.'%')->get();
|
||||
|
||||
return response()->json(compact('result'));
|
||||
} catch (Exception $e) {
|
||||
@@ -638,7 +651,8 @@ class ApiController extends Controller {
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function ticketThreads() {
|
||||
public function ticketThreads()
|
||||
{
|
||||
try {
|
||||
$v = \Validator::make($this->request->all(), [
|
||||
'id' => 'required',
|
||||
@@ -675,7 +689,8 @@ class ApiController extends Controller {
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function checkUrl() {
|
||||
public function checkUrl()
|
||||
{
|
||||
//dd($this->request);
|
||||
try {
|
||||
$v = \Validator::make($this->request->all(), [
|
||||
@@ -692,7 +707,7 @@ class ApiController extends Controller {
|
||||
$url = str_finish($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'));
|
||||
@@ -712,7 +727,8 @@ class ApiController extends Controller {
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function urlResult() {
|
||||
public function urlResult()
|
||||
{
|
||||
return 'success';
|
||||
}
|
||||
|
||||
@@ -723,7 +739,8 @@ class ApiController extends Controller {
|
||||
*
|
||||
* @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);
|
||||
@@ -732,7 +749,7 @@ class ApiController extends Controller {
|
||||
$response = curl_exec($curl);
|
||||
|
||||
if (curl_errno($curl)) {
|
||||
echo 'error:' . curl_error($curl);
|
||||
echo 'error:'.curl_error($curl);
|
||||
}
|
||||
|
||||
return $response;
|
||||
@@ -747,7 +764,8 @@ class ApiController extends Controller {
|
||||
*
|
||||
* @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);
|
||||
@@ -757,7 +775,7 @@ class ApiController extends Controller {
|
||||
$response = curl_exec($curl);
|
||||
|
||||
if (curl_errno($curl)) {
|
||||
echo 'error:' . curl_error($curl);
|
||||
echo 'error:'.curl_error($curl);
|
||||
}
|
||||
|
||||
return $response;
|
||||
@@ -769,7 +787,8 @@ class ApiController extends Controller {
|
||||
*
|
||||
* @return type | json
|
||||
*/
|
||||
public function generateApiKey() {
|
||||
public function generateApiKey()
|
||||
{
|
||||
try {
|
||||
$set = $this->setting->where('id', '1')->first();
|
||||
//dd($set);
|
||||
@@ -803,7 +822,8 @@ class ApiController extends Controller {
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function getHelpTopic() {
|
||||
public function getHelpTopic()
|
||||
{
|
||||
try {
|
||||
$result = $this->helptopic->get();
|
||||
|
||||
@@ -826,7 +846,8 @@ class ApiController extends Controller {
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function getSlaPlan() {
|
||||
public function getSlaPlan()
|
||||
{
|
||||
try {
|
||||
$result = $this->slaPlan->get();
|
||||
|
||||
@@ -849,7 +870,8 @@ class ApiController extends Controller {
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function getPriority() {
|
||||
public function getPriority()
|
||||
{
|
||||
try {
|
||||
$result = $this->priority->get();
|
||||
|
||||
@@ -872,7 +894,8 @@ class ApiController extends Controller {
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function getDepartment() {
|
||||
public function getDepartment()
|
||||
{
|
||||
try {
|
||||
$result = $this->department->get();
|
||||
|
||||
@@ -895,7 +918,8 @@ class ApiController extends Controller {
|
||||
*
|
||||
* @return type json
|
||||
*/
|
||||
public function getTickets() {
|
||||
public function getTickets()
|
||||
{
|
||||
try {
|
||||
$tickets = $this->model->orderBy('created_at', 'desc')->paginate(10);
|
||||
$tickets->toJson();
|
||||
@@ -919,9 +943,9 @@ class ApiController extends Controller {
|
||||
*
|
||||
* @return type json
|
||||
*/
|
||||
public function inbox() {
|
||||
public function inbox()
|
||||
{
|
||||
try {
|
||||
|
||||
$inbox = $this->user->join('tickets', function ($join) {
|
||||
$join->on('users.id', '=', 'tickets.user_id')
|
||||
->where('status', '=', 1);
|
||||
@@ -935,7 +959,7 @@ class ApiController extends Controller {
|
||||
$join->on('tickets.id', '=', 'ticket_thread.ticket_id')
|
||||
->whereNotNull('ticket_thread.title');
|
||||
})
|
||||
->select(\DB::raw('max(ticket_thread.updated_at) as updated_at'),'user_name', 'first_name', 'last_name', 'email', 'profile_pic', 'ticket_number', 'tickets.id', 'ticket_thread.title', 'tickets.created_at', 'department.name as department_name', 'ticket_priority.priority as priotity_name', 'sla_plan.name as sla_plan_name', 'help_topic.topic as help_topic_name', 'ticket_status.name as ticket_status_name')
|
||||
->select(\DB::raw('max(ticket_thread.updated_at) as updated_at'), 'user_name', 'first_name', 'last_name', 'email', 'profile_pic', 'ticket_number', 'tickets.id', 'ticket_thread.title', 'tickets.created_at', 'department.name as department_name', 'ticket_priority.priority as priotity_name', 'sla_plan.name as sla_plan_name', 'help_topic.topic as help_topic_name', 'ticket_status.name as ticket_status_name')
|
||||
->orderBy('updated_at', 'desc')
|
||||
->groupby('tickets.id')
|
||||
->distinct()
|
||||
@@ -961,7 +985,8 @@ class ApiController extends Controller {
|
||||
*
|
||||
* @return type json
|
||||
*/
|
||||
public function internalNote() {
|
||||
public function internalNote()
|
||||
{
|
||||
try {
|
||||
$v = \Validator::make($this->request->all(), [
|
||||
'userid' => 'required|exists:users,id',
|
||||
@@ -993,7 +1018,8 @@ class ApiController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
public function getTrash() {
|
||||
public function getTrash()
|
||||
{
|
||||
try {
|
||||
$trash = $this->user->join('tickets', function ($join) {
|
||||
$join->on('users.id', '=', 'tickets.user_id')
|
||||
@@ -1008,7 +1034,7 @@ class ApiController extends Controller {
|
||||
$join->on('tickets.id', '=', 'ticket_thread.ticket_id')
|
||||
->whereNotNull('title');
|
||||
})
|
||||
->select(\DB::raw('max(ticket_thread.updated_at) as updated_at'),'user_name', 'first_name', 'last_name', 'email', 'profile_pic', 'ticket_number', 'tickets.id', 'title', 'tickets.created_at', 'department.name as department_name', 'ticket_priority.priority as priotity_name', 'sla_plan.name as sla_plan_name', 'help_topic.topic as help_topic_name', 'ticket_status.name as ticket_status_name')
|
||||
->select(\DB::raw('max(ticket_thread.updated_at) as updated_at'), 'user_name', 'first_name', 'last_name', 'email', 'profile_pic', 'ticket_number', 'tickets.id', 'title', 'tickets.created_at', 'department.name as department_name', 'ticket_priority.priority as priotity_name', 'sla_plan.name as sla_plan_name', 'help_topic.topic as help_topic_name', 'ticket_status.name as ticket_status_name')
|
||||
->orderBy('updated_at', 'desc')
|
||||
->groupby('tickets.id')
|
||||
->distinct()
|
||||
@@ -1029,7 +1055,8 @@ class ApiController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
public function getMyTicketsAgent() {
|
||||
public function getMyTicketsAgent()
|
||||
{
|
||||
try {
|
||||
$v = \Validator::make($this->request->all(), [
|
||||
'user_id' => 'required|exists:users,id',
|
||||
@@ -1059,8 +1086,8 @@ class ApiController extends Controller {
|
||||
$join->on('tickets.id', '=', 'ticket_thread.ticket_id')
|
||||
->whereNotNull('title');
|
||||
})
|
||||
->where('users.id',$id)
|
||||
->select(\DB::raw('max(ticket_thread.updated_at) as updated_at'),'user_name', 'first_name', 'last_name', 'email', 'profile_pic', 'ticket_number', 'tickets.id', 'title', 'tickets.created_at', 'department.name as department_name', 'ticket_priority.priority as priotity_name', 'sla_plan.name as sla_plan_name', 'help_topic.topic as help_topic_name', 'ticket_status.name as ticket_status_name')
|
||||
->where('users.id', $id)
|
||||
->select(\DB::raw('max(ticket_thread.updated_at) as updated_at'), 'user_name', 'first_name', 'last_name', 'email', 'profile_pic', 'ticket_number', 'tickets.id', 'title', 'tickets.created_at', 'department.name as department_name', 'ticket_priority.priority as priotity_name', 'sla_plan.name as sla_plan_name', 'help_topic.topic as help_topic_name', 'ticket_status.name as ticket_status_name')
|
||||
->orderBy('updated_at', 'desc')
|
||||
->groupby('tickets.id')
|
||||
->distinct()
|
||||
@@ -1081,7 +1108,8 @@ class ApiController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
public function getMyTicketsUser() {
|
||||
public function getMyTicketsUser()
|
||||
{
|
||||
try {
|
||||
$v = \Validator::make($this->request->all(), [
|
||||
'user_id' => 'required|exists:users,id',
|
||||
@@ -1132,7 +1160,8 @@ class ApiController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
public function getTicketById() {
|
||||
public function getTicketById()
|
||||
{
|
||||
try {
|
||||
$v = \Validator::make($this->request->all(), [
|
||||
'id' => 'required|exists:tickets,id',
|
||||
@@ -1144,7 +1173,7 @@ class ApiController extends Controller {
|
||||
}
|
||||
$id = $this->request->input('id');
|
||||
if (!$this->model->where('id', $id)->first()) {
|
||||
$error = 'There is no Ticket as ticket id: ' . $id;
|
||||
$error = 'There is no Ticket as ticket id: '.$id;
|
||||
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
@@ -1155,7 +1184,7 @@ class ApiController extends Controller {
|
||||
$response = $this->differenciateHelpTopic($query);
|
||||
//$select = 'users.email','users.user_name','users.first_name','users.last_name','tickets.id','ticket_number','num_sequence','user_id','priority_id','sla','max_open_ticket','captcha','status','lock_by','lock_at','source','isoverdue','reopened','isanswered','is_deleted', 'closed','is_transfer','transfer_at','reopened_at','duedate','closed_at','last_message_at','last_response_at';
|
||||
|
||||
$result = $response->addSelect('users.email','users.user_name','users.first_name','users.last_name','tickets.id','ticket_number','user_id','priority_id','sla','status','lock_by','lock_at','source','isoverdue','reopened','isanswered','is_deleted', 'closed','reopened_at','duedate','closed_at','last_message_at','last_response_at','tickets.created_at','tickets.updated_at')->first();
|
||||
$result = $response->addSelect('users.email', 'users.user_name', 'users.first_name', 'users.last_name', 'tickets.id', 'ticket_number', 'user_id', 'priority_id', 'sla', 'status', 'lock_by', 'lock_at', 'source', 'isoverdue', 'reopened', 'isanswered', 'is_deleted', 'closed', 'reopened_at', 'duedate', 'closed_at', 'last_message_at', 'last_response_at', 'tickets.created_at', 'tickets.updated_at')->first();
|
||||
|
||||
return response()->json(compact('result'));
|
||||
} catch (\Exception $e) {
|
||||
@@ -1171,7 +1200,8 @@ class ApiController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
public function createPagination($array, $perPage) {
|
||||
public function createPagination($array, $perPage)
|
||||
{
|
||||
try {
|
||||
//Get current page form url e.g. &page=6
|
||||
$currentPage = LengthAwarePaginator::resolveCurrentPage();
|
||||
@@ -1199,7 +1229,8 @@ class ApiController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
public function collaboratorSearch() {
|
||||
public function collaboratorSearch()
|
||||
{
|
||||
$this->validate($this->request, ['term' => 'required']);
|
||||
try {
|
||||
$emails = $this->ticket->autosearch();
|
||||
@@ -1209,7 +1240,7 @@ class ApiController extends Controller {
|
||||
foreach ($emails as $key => $email) {
|
||||
$user_model = $user->where('email', $email)->first();
|
||||
//return $user_model;
|
||||
$users[$key]['name'] = $user_model->first_name . ' ' . $user_model->last_name;
|
||||
$users[$key]['name'] = $user_model->first_name.' '.$user_model->last_name;
|
||||
$users[$key]['email'] = $email;
|
||||
$users[$key]['avatar'] = $this->avatarUrl($email);
|
||||
}
|
||||
@@ -1226,12 +1257,13 @@ class ApiController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
public function avatarUrl($email) {
|
||||
public function avatarUrl($email)
|
||||
{
|
||||
try {
|
||||
$user = new User();
|
||||
$user = $user->where('email', $email)->first();
|
||||
if ($user->profile_pic) {
|
||||
$url = url('uploads/profilepic/' . $user->profile_pic);
|
||||
$url = url('uploads/profilepic/'.$user->profile_pic);
|
||||
} else {
|
||||
$url = \Gravatar::src($email);
|
||||
}
|
||||
@@ -1243,7 +1275,8 @@ class ApiController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
public function addCollaboratorForTicket() {
|
||||
public function addCollaboratorForTicket()
|
||||
{
|
||||
try {
|
||||
$v = \Validator::make(\Input::get(), [
|
||||
'email' => 'required|email|unique:users',
|
||||
@@ -1273,7 +1306,8 @@ class ApiController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
public function getCollaboratorForTicket() {
|
||||
public function getCollaboratorForTicket()
|
||||
{
|
||||
try {
|
||||
$v = \Validator::make(\Input::get(), [
|
||||
'ticket_id' => 'required',
|
||||
@@ -1302,7 +1336,8 @@ class ApiController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
public function deleteCollaborator() {
|
||||
public function deleteCollaborator()
|
||||
{
|
||||
try {
|
||||
$v = \Validator::make(\Input::get(), [
|
||||
'ticketid' => 'required',
|
||||
@@ -1326,7 +1361,8 @@ class ApiController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
public function dependency() {
|
||||
public function dependency()
|
||||
{
|
||||
try {
|
||||
$department = $this->department->select('name', 'id')->get()->toArray();
|
||||
$sla = $this->slaPlan->select('name', 'id')->get()->toArray();
|
||||
@@ -1337,7 +1373,7 @@ class ApiController extends Controller {
|
||||
$status = \DB::table('ticket_status')->select('name', 'id')->get();
|
||||
$source = \DB::table('ticket_source')->select('name', 'id')->get();
|
||||
$result = ['departments' => $department, 'sla' => $sla, 'staffs' => $staff, 'teams' => $team,
|
||||
'priorities' => $priority, 'helptopics' => $helptopic, 'status' => $status, 'sources' => $source,];
|
||||
'priorities' => $priority, 'helptopics' => $helptopic, 'status' => $status, 'sources' => $source, ];
|
||||
|
||||
return response()->json(compact('result'));
|
||||
} catch (\Exception $e) {
|
||||
@@ -1349,32 +1385,35 @@ class ApiController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
public function differenciateHelpTopic($query){
|
||||
public function differenciateHelpTopic($query)
|
||||
{
|
||||
$ticket = $query->first();
|
||||
$check = 'department';
|
||||
if($ticket){
|
||||
if($ticket->dept_id && $ticket->help_topic_id){
|
||||
if ($ticket) {
|
||||
if ($ticket->dept_id && $ticket->help_topic_id) {
|
||||
return $this->getSystem($check, $query);
|
||||
}
|
||||
if(!$ticket->dept_id && $ticket->help_topic_id){
|
||||
if (!$ticket->dept_id && $ticket->help_topic_id) {
|
||||
return $query->select('tickets.help_topic_id');
|
||||
}
|
||||
if($ticket->dept_id && !$ticket->help_topic_id){
|
||||
if ($ticket->dept_id && !$ticket->help_topic_id) {
|
||||
return $query->select('tickets.dept_id');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getSystem($check,$query){
|
||||
switch ($check){
|
||||
public function getSystem($check, $query)
|
||||
{
|
||||
switch ($check) {
|
||||
case 'department':
|
||||
return $query->select('tickets.dept_id');
|
||||
case 'helpTopic':
|
||||
return $query->select('tickets.help_topic_id');
|
||||
default :
|
||||
default:
|
||||
return $query->select('tickets.dept_id');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a user with username and password.
|
||||
*
|
||||
@@ -1399,8 +1438,8 @@ class ApiController extends Controller {
|
||||
$username = $request->input('email');
|
||||
$password = \Hash::make($request->input('password'));
|
||||
$role = $request->input('role');
|
||||
if($auth->role=='agent'){
|
||||
$role = "user";
|
||||
if ($auth->role == 'agent') {
|
||||
$role = 'user';
|
||||
}
|
||||
$user = new User();
|
||||
$user->password = $password;
|
||||
@@ -1408,6 +1447,7 @@ class ApiController extends Controller {
|
||||
$user->email = $email;
|
||||
$user->role = $role;
|
||||
$user->save();
|
||||
|
||||
return response()->json(compact('user'));
|
||||
} catch (\Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
@@ -1415,6 +1455,4 @@ class ApiController extends Controller {
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -5,33 +5,31 @@ namespace App\Http\Controllers\Api\v1;
|
||||
// Controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
// Requests
|
||||
use Illuminate\Http\Request;
|
||||
// Models
|
||||
use App\User;
|
||||
use App\Model\helpdesk\Ticket\Tickets;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Thread;
|
||||
// Models
|
||||
use App\Model\helpdesk\Ticket\Tickets;
|
||||
use App\User;
|
||||
use FCM;
|
||||
// classes
|
||||
use LaravelFCM\Message\PayloadNotificationBuilder;
|
||||
use LaravelFCM\Message\Topics;
|
||||
use Illuminate\Http\Request;
|
||||
use LaravelFCM\Message\OptionsBuilder;
|
||||
use LaravelFCM\Message\PayloadDataBuilder;
|
||||
use LaravelFCM\Message\PayloadNotificationBuilder;
|
||||
use LaravelFCM\Response\DownstreamResponse;
|
||||
use FCM;
|
||||
use FCMGroup;
|
||||
|
||||
/**
|
||||
* **********************************************
|
||||
* PushNotificationController
|
||||
* **********************************************
|
||||
* This controller is used to send notification to FCM cloud which later will
|
||||
* foreward notification to Mobile Application
|
||||
* foreward notification to Mobile Application.
|
||||
*
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class PushNotificationController extends Controller {
|
||||
|
||||
public function Response($token, $body, $ticket_id = null) {
|
||||
|
||||
class PushNotificationController extends Controller
|
||||
{
|
||||
public function Response($token, $body, $ticket_id = null)
|
||||
{
|
||||
$optionBuiler = new OptionsBuilder();
|
||||
$optionBuiler->setTimeToLive(60 * 60);
|
||||
|
||||
@@ -41,8 +39,8 @@ class PushNotificationController extends Controller {
|
||||
->setIcon('ic_stat_f1')
|
||||
->setClickAction('OPEN_ACTIVITY_1');
|
||||
|
||||
if($ticket_id != null) {
|
||||
$ticket_data = Tickets::where('id', '=', $ticket_id )->first();
|
||||
if ($ticket_id != null) {
|
||||
$ticket_data = Tickets::where('id', '=', $ticket_id)->first();
|
||||
$thread_data = Ticket_Thread::where('ticket_id', '=', $ticket_id)->first();
|
||||
$dataBuilder = new PayloadDataBuilder();
|
||||
$dataBuilder->addData(['ticket_id' => $ticket_id]);
|
||||
@@ -76,18 +74,21 @@ class PushNotificationController extends Controller {
|
||||
|
||||
/**
|
||||
* function to get the fcm token from the api under a user.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function fcmToken(Request $request, User $user) {
|
||||
public function fcmToken(Request $request, User $user)
|
||||
{
|
||||
// get the requested details
|
||||
$user_id = $request->input('user_id');
|
||||
$fcm_token = $request->input('fcm_token');
|
||||
// check for all the valid details
|
||||
if($user_id != null && $user_id != "" && $fcm_token != null && $fcm_token != "") {
|
||||
if ($user_id != null && $user_id != '' && $fcm_token != null && $fcm_token != '') {
|
||||
// search the user_id in database
|
||||
$user = $user->where('id', '=', $user_id)->first();
|
||||
if($user != null) {
|
||||
if ($user != null) {
|
||||
$user->fcm_token = $fcm_token;
|
||||
$user->save();
|
||||
// success response for success case
|
||||
@@ -101,5 +102,4 @@ class PushNotificationController extends Controller {
|
||||
return ['response' => 'fail', 'reason' => 'Invalid Credentials'];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -50,7 +50,7 @@ class TokenAuthController extends Controller
|
||||
//$credentials = $request->only('email', 'password');
|
||||
|
||||
try {
|
||||
if (!$token = JWTAuth::attempt([$field => $usernameinput, 'password' => $password,'active'=>1])) {
|
||||
if (!$token = JWTAuth::attempt([$field => $usernameinput, 'password' => $password, 'active' => 1])) {
|
||||
return response()->json(['error' => 'invalid_credentials', 'status_code' => 401]);
|
||||
}
|
||||
} catch (JWTException $e) {
|
||||
|
@@ -4,7 +4,6 @@ namespace App\Http\Controllers\Auth;
|
||||
|
||||
// controllers
|
||||
use App\Http\Controllers\Common\PhpMailController;
|
||||
use App\Http\Controllers\Common\SettingsController;
|
||||
use App\Http\Controllers\Controller;
|
||||
// requests
|
||||
use App\Http\Requests\helpdesk\LoginRequest;
|
||||
@@ -229,7 +228,7 @@ class AuthController extends Controller
|
||||
$field = filter_var($usernameinput, FILTER_VALIDATE_EMAIL) ? 'email' : 'user_name';
|
||||
// If attempts > 3 and time < 10 minutes
|
||||
if ($loginAttempts > $security->backlist_threshold && (time() - $loginAttemptTime <= ($security->lockout_period * 60))) {
|
||||
//
|
||||
//
|
||||
return redirect()->back()->withErrors('email', 'incorrect email')->with('error', $security->lockout_message);
|
||||
}
|
||||
// If time > 10 minutes, reset attempts counter and time in session
|
||||
@@ -278,15 +277,15 @@ class AuthController extends Controller
|
||||
if ($data) {
|
||||
$attempts = $data->Attempts + 1;
|
||||
if ($attempts == $apt) {
|
||||
// $result = DB::select('UPDATE login_attempts SET Attempts='.$attempts.", LastLogin=NOW() WHERE IP = '$value' OR User = '$field'");
|
||||
$result = DB::table('login_attempts')->where('IP', '=', $value)->orWhere('User', '=', $field)->update(['Attempts' => $attempts, 'LastLogin' => Date('Y-m-d H:i:s')]);
|
||||
// $result = DB::select('UPDATE login_attempts SET Attempts='.$attempts.", LastLogin=NOW() WHERE IP = '$value' OR User = '$field'");
|
||||
$result = DB::table('login_attempts')->where('IP', '=', $value)->orWhere('User', '=', $field)->update(['Attempts' => $attempts, 'LastLogin' => date('Y-m-d H:i:s')]);
|
||||
} else {
|
||||
$result = DB::table('login_attempts')->where('IP', '=', $value)->orWhere('User', '=', $field)->update(['Attempts' => $attempts]);
|
||||
// $result = DB::select("UPDATE login_attempts SET Attempts=".$attempts." WHERE IP = '$value' OR User = '$field'");
|
||||
}
|
||||
} else {
|
||||
// $result = DB::select("INSERT INTO login_attempts (Attempts,User,IP,LastLogin) values (1,'$field','$value', NOW())");
|
||||
$result = DB::table('login_attempts')->update(['Attempts' => 1, 'User' => $field, 'IP' => $value, 'LastLogin' => Date('Y-m-d H:i:s')]);
|
||||
// $result = DB::select("INSERT INTO login_attempts (Attempts,User,IP,LastLogin) values (1,'$field','$value', NOW())");
|
||||
$result = DB::table('login_attempts')->update(['Attempts' => 1, 'User' => $field, 'IP' => $value, 'LastLogin' => date('Y-m-d H:i:s')]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -329,6 +328,7 @@ class AuthController extends Controller
|
||||
return 1;
|
||||
} else {
|
||||
$this->clearLoginAttempts($value, $field);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@@ -4,7 +4,6 @@ namespace App\Http\Controllers\Auth;
|
||||
|
||||
// controllers
|
||||
use App\Http\Controllers\Common\PhpMailController;
|
||||
use App\Http\Controllers\Common\SettingsController;
|
||||
use App\Http\Controllers\Controller;
|
||||
// request
|
||||
use App\User;
|
||||
@@ -53,7 +52,7 @@ class PasswordController extends Controller
|
||||
{
|
||||
$date = date('Y-m-d H:i:s');
|
||||
$this->validate($request, ['email' => 'required|email']);
|
||||
\Event::fire('reset.password',array());
|
||||
\Event::fire('reset.password', []);
|
||||
$user = User::where('email', '=', $request->only('email'))->first();
|
||||
if (isset($user)) {
|
||||
$user1 = $user->email;
|
||||
|
@@ -33,15 +33,16 @@ use Redirect;
|
||||
*
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class FormController extends Controller {
|
||||
|
||||
class FormController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* Constructor to check.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(TicketWorkflowController $TicketWorkflowController) {
|
||||
public function __construct(TicketWorkflowController $TicketWorkflowController)
|
||||
{
|
||||
$this->middleware('board');
|
||||
// creating a TicketController instance
|
||||
$this->TicketWorkflowController = $TicketWorkflowController;
|
||||
@@ -54,7 +55,8 @@ class FormController extends Controller {
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function getForm(Help_topic $topic, CountryCode $code) {
|
||||
public function getForm(Help_topic $topic, CountryCode $code)
|
||||
{
|
||||
if (\Config::get('database.install') == '%0%') {
|
||||
return \Redirect::route('licence');
|
||||
}
|
||||
@@ -66,8 +68,9 @@ class FormController extends Controller {
|
||||
if ($phonecode->phonecode) {
|
||||
$phonecode = $phonecode->phonecode;
|
||||
} else {
|
||||
$phonecode = "";
|
||||
$phonecode = '';
|
||||
}
|
||||
|
||||
return view('themes.default1.client.helpdesk.form', compact('topics', 'codes'))->with('phonecode', $phonecode);
|
||||
} else {
|
||||
return \Redirect::route('home');
|
||||
@@ -82,43 +85,43 @@ class FormController extends Controller {
|
||||
*
|
||||
* @return type string
|
||||
*/
|
||||
public function postForm($id, Help_topic $topic) {
|
||||
public function postForm($id, Help_topic $topic)
|
||||
{
|
||||
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) {
|
||||
foreach ($values as $form_data) {
|
||||
if ($form_data->type == "select") {
|
||||
if ($form_data->type == 'select') {
|
||||
$form_fields = explode(',', $form_data->value);
|
||||
$var = "";
|
||||
$var = '';
|
||||
foreach ($form_fields as $form_field) {
|
||||
$var .= '<option value="' . $form_field . '">' . $form_field . '</option>';
|
||||
$var .= '<option value="'.$form_field.'">'.$form_field.'</option>';
|
||||
}
|
||||
echo '<br/><label>' . ucfirst($form_data->label) . '</label><select class="form-control" name="' . $form_data->name . '">' . $var . '</select>';
|
||||
} elseif ($form_data->type == "radio") {
|
||||
echo '<br/><label>'.ucfirst($form_data->label).'</label><select class="form-control" name="'.$form_data->name.'">'.$var.'</select>';
|
||||
} elseif ($form_data->type == 'radio') {
|
||||
$type2 = $form_data->value;
|
||||
$vals = explode(',', $type2);
|
||||
echo '<br/><label>' . ucfirst($form_data->label) . '</label><br/>';
|
||||
echo '<br/><label>'.ucfirst($form_data->label).'</label><br/>';
|
||||
foreach ($vals as $val) {
|
||||
echo '<input type="' . $form_data->type . '" name="' . $form_data->name . '"> ' . $val . ' ';
|
||||
echo '<input type="'.$form_data->type.'" name="'.$form_data->name.'"> '.$val.' ';
|
||||
}
|
||||
echo "<br/>";
|
||||
} elseif ($form_data->type == "textarea") {
|
||||
echo '<br/>';
|
||||
} elseif ($form_data->type == 'textarea') {
|
||||
$type3 = $form_data->value;
|
||||
echo '<br/><label>' . $form_data->label . '</label></br><textarea id="unique-textarea" name="' . $form_data->name . '" class="form-control" style="height:15%;"></textarea>';
|
||||
} elseif ($form_data->type == "checkbox") {
|
||||
echo '<br/><label>'.$form_data->label.'</label></br><textarea id="unique-textarea" name="'.$form_data->name.'" class="form-control" style="height:15%;"></textarea>';
|
||||
} elseif ($form_data->type == 'checkbox') {
|
||||
$type4 = $form_data->value;
|
||||
$checks = explode(',', $type4);
|
||||
echo '<br/><label>' . ucfirst($form_data->label) . '</label><br/>';
|
||||
echo '<br/><label>'.ucfirst($form_data->label).'</label><br/>';
|
||||
foreach ($checks as $check) {
|
||||
echo '<input type="' . $form_data->type . '" name="' . $form_data->name . '">  ' . $check;
|
||||
echo '<input type="'.$form_data->type.'" name="'.$form_data->name.'">  '.$check;
|
||||
}
|
||||
} else {
|
||||
echo '<br/><label>' . ucfirst($form_data->label) . '</label><input type="' . $form_data->type . '" class="form-control" name="' . $form_data->name . '" />';
|
||||
echo '<br/><label>'.ucfirst($form_data->label).'</label><input type="'.$form_data->type.'" class="form-control" name="'.$form_data->name.'" />';
|
||||
}
|
||||
}
|
||||
echo '<br/><br/>';
|
||||
@@ -134,7 +137,8 @@ class FormController extends Controller {
|
||||
* @param type Request $request
|
||||
* @param type User $user
|
||||
*/
|
||||
public function postedForm(User $user, ClientRequest $request, Ticket $ticket_settings, Ticket_source $ticket_source, Ticket_attachments $ta, CountryCode $code) {
|
||||
public function postedForm(User $user, ClientRequest $request, Ticket $ticket_settings, Ticket_source $ticket_source, Ticket_attachments $ta, CountryCode $code)
|
||||
{
|
||||
$form_extras = $request->except('Name', 'Phone', 'Email', 'Subject', 'Details', 'helptopic', '_wysihtml5_mode', '_token');
|
||||
|
||||
$name = $request->input('Name');
|
||||
@@ -146,12 +150,12 @@ class FormController extends Controller {
|
||||
$mobile_number = $request->input('Mobile');
|
||||
$status = $ticket_settings->first()->status;
|
||||
$helptopic = $request->input('helptopic');
|
||||
$helpTopicObj = Help_topic::where('id','=', $helptopic);
|
||||
if($helpTopicObj->exists() && ($helpTopicObj->value('status')==1)){
|
||||
$helpTopicObj = Help_topic::where('id', '=', $helptopic);
|
||||
if ($helpTopicObj->exists() && ($helpTopicObj->value('status') == 1)) {
|
||||
$department = $helpTopicObj->value('department');
|
||||
}else{
|
||||
} else {
|
||||
$defaultHelpTopicID = Ticket::where('id', '=', '1')->first()->help_topic;
|
||||
$department = Help_topic::where('id','=', $defaultHelpTopicID)->value('department');
|
||||
$department = Help_topic::where('id', '=', $defaultHelpTopicID)->value('department');
|
||||
}
|
||||
$sla = $ticket_settings->first()->sla;
|
||||
$priority = $ticket_settings->first()->priority;
|
||||
@@ -203,7 +207,7 @@ class FormController extends Controller {
|
||||
}
|
||||
}
|
||||
// dd($result);
|
||||
return Redirect::back()->with('success', Lang::get('lang.Ticket-has-been-created-successfully-your-ticket-number-is') . ' ' . $result[0] . '. ' . Lang::get('lang.Please-save-this-for-future-reference'));
|
||||
return Redirect::back()->with('success', Lang::get('lang.Ticket-has-been-created-successfully-your-ticket-number-is').' '.$result[0].'. '.Lang::get('lang.Please-save-this-for-future-reference'));
|
||||
}
|
||||
// dd($result);
|
||||
}
|
||||
@@ -215,13 +219,14 @@ class FormController extends Controller {
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function post_ticket_reply($id, Request $request) {
|
||||
public function post_ticket_reply($id, Request $request)
|
||||
{
|
||||
try {
|
||||
if ($comment != null) {
|
||||
$tickets = Tickets::where('id', '=', $id)->first();
|
||||
$thread = Ticket_Thread::where('ticket_id', '=', $tickets->id)->first();
|
||||
|
||||
$subject = $thread->title . '[#' . $tickets->ticket_number . ']';
|
||||
$subject = $thread->title.'[#'.$tickets->ticket_number.']';
|
||||
$body = $request->input('comment');
|
||||
|
||||
$user_cred = User::where('id', '=', $tickets->user_id)->first();
|
||||
@@ -255,13 +260,14 @@ class FormController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
public function getCustomForm(Request $request) {
|
||||
$html = "";
|
||||
public function getCustomForm(Request $request)
|
||||
{
|
||||
$html = '';
|
||||
$helptopic_id = $request->input('helptopic');
|
||||
$helptopics = new Help_topic();
|
||||
$helptopic = $helptopics->find($helptopic_id);
|
||||
if (!$helptopic) {
|
||||
throw new Exception("We can not find your request");
|
||||
throw new Exception('We can not find your request');
|
||||
}
|
||||
$custom_form = $helptopic->custom_form;
|
||||
if ($custom_form) {
|
||||
@@ -270,7 +276,7 @@ class FormController extends Controller {
|
||||
$form_controller = new \App\Http\Controllers\Admin\helpdesk\FormController($fields, $forms);
|
||||
$html = $form_controller->renderForm($custom_form);
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
}
|
@@ -11,12 +11,12 @@ use App\Http\Requests\helpdesk\ProfileRequest;
|
||||
use App\Http\Requests\helpdesk\TicketRequest;
|
||||
use App\Model\helpdesk\Manage\Help_topic;
|
||||
// models
|
||||
use App\Model\helpdesk\Settings\CommonSettings;
|
||||
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\Model\helpdesk\Utility\CountryCode;
|
||||
use App\Model\helpdesk\Settings\CommonSettings;
|
||||
use App\User;
|
||||
use Auth;
|
||||
// classes
|
||||
@@ -323,6 +323,7 @@ class GuestController extends Controller
|
||||
$common_setting = $common_settings->select('status')
|
||||
->where('option_name', '=', 'user_set_ticket_status')
|
||||
->first();
|
||||
|
||||
return view('themes.default1.client.helpdesk.ckeckticket', compact('id', 'common_setting'));
|
||||
}
|
||||
|
||||
|
@@ -24,9 +24,10 @@ use Lang;
|
||||
use Mail;
|
||||
use Redirect;
|
||||
|
||||
class UserController extends Controller {
|
||||
|
||||
public function __construct() {
|
||||
class UserController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('board');
|
||||
}
|
||||
|
||||
@@ -35,18 +36,20 @@ class UserController extends Controller {
|
||||
*
|
||||
* @return response
|
||||
*/
|
||||
public function getArticle(Article $article, Category $category, Settings $settings) {
|
||||
public function getArticle(Article $article, Category $category, Settings $settings)
|
||||
{
|
||||
$setting = $settings->first();
|
||||
$pagination = $setting->pagination;
|
||||
if (!Auth::check() || \Auth::user()->role == 'user') {
|
||||
$article = $article->where('status', '1');
|
||||
}
|
||||
$article = $article->where('type', '1');
|
||||
$article = $article->orderBy('publish_time','desc');
|
||||
$article = $article->orderBy('publish_time', 'desc');
|
||||
$article = $article->paginate($pagination);
|
||||
|
||||
$article->setPath('article-list');
|
||||
$categorys = $category->get();
|
||||
|
||||
return view('themes.default1.client.kb.article-list.articles', compact('time', 'categorys', 'article'));
|
||||
}
|
||||
|
||||
@@ -59,7 +62,8 @@ class UserController extends Controller {
|
||||
*
|
||||
* @return string excerpt
|
||||
*/
|
||||
public 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, ' ');
|
||||
@@ -82,13 +86,14 @@ class UserController extends Controller {
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
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');
|
||||
$result = $article->where('name', 'LIKE', '%' . $search . '%')
|
||||
->orWhere('slug', 'LIKE', '%' . $search . '%')
|
||||
->orWhere('description', 'LIKE', '%' . $search . '%')
|
||||
$result = $article->where('name', 'LIKE', '%'.$search.'%')
|
||||
->orWhere('slug', 'LIKE', '%'.$search.'%')
|
||||
->orWhere('description', 'LIKE', '%'.$search.'%')
|
||||
->paginate($pagination);
|
||||
$result->setPath('search');
|
||||
$categorys = $category->get();
|
||||
@@ -101,7 +106,8 @@ class UserController extends Controller {
|
||||
*
|
||||
* @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;
|
||||
@@ -109,7 +115,7 @@ class UserController extends Controller {
|
||||
$date = \Carbon\Carbon::now()->toDateTimeString();
|
||||
$arti = $article->where('slug', $slug);
|
||||
|
||||
if (!Auth::check()|| \Auth::user()->role == 'user') {
|
||||
if (!Auth::check() || \Auth::user()->role == 'user') {
|
||||
$arti = $arti->where('status', '1');
|
||||
$arti = $arti->where('publish_time', '<', $date);
|
||||
}
|
||||
@@ -125,7 +131,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();
|
||||
if (!$catid) {
|
||||
@@ -141,7 +148,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 {
|
||||
@@ -153,7 +161,8 @@ 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();
|
||||
|
||||
@@ -165,7 +174,8 @@ class UserController extends Controller {
|
||||
*
|
||||
* @return response
|
||||
*/
|
||||
public function contact(Category $category, Settings $settings) {
|
||||
public function contact(Category $category, Settings $settings)
|
||||
{
|
||||
$settings = $settings->whereId('1')->first();
|
||||
$categorys = $category->get();
|
||||
|
||||
@@ -177,7 +187,8 @@ class UserController extends Controller {
|
||||
*
|
||||
* @return response
|
||||
*/
|
||||
public function postContact(ContactRequest $request, Contact $contact) {
|
||||
public function postContact(ContactRequest $request, Contact $contact)
|
||||
{
|
||||
$this->port();
|
||||
$this->host();
|
||||
$this->encryption();
|
||||
@@ -204,7 +215,8 @@ class UserController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
public function contactDetails() {
|
||||
public function contactDetails()
|
||||
{
|
||||
return view('themes.default1.client.kb.article-list.contact-details');
|
||||
}
|
||||
|
||||
@@ -218,9 +230,10 @@ class UserController extends Controller {
|
||||
*
|
||||
* @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();
|
||||
if(!$article){
|
||||
if (!$article) {
|
||||
return Redirect::back()->with('fails', Lang::get('lang.sorry_not_processed'));
|
||||
}
|
||||
$id = $article->id;
|
||||
@@ -232,42 +245,49 @@ class UserController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
public function getPage($name, Page $page) {
|
||||
public function getPage($name, Page $page)
|
||||
{
|
||||
$page = $page->where('slug', $name)->first();
|
||||
if($page){
|
||||
if ($page) {
|
||||
return view('themes.default1.client.kb.article-list.pages', compact('page'));
|
||||
}else{
|
||||
} else {
|
||||
return Redirect::back()->with('fails', Lang::get('lang.sorry_not_processed'));
|
||||
}
|
||||
}
|
||||
|
||||
public static function port() {
|
||||
public static function port()
|
||||
{
|
||||
$setting = Settings::whereId('1')->first();
|
||||
Config::set('mail.port', $setting->port);
|
||||
}
|
||||
|
||||
public static function host() {
|
||||
public static function host()
|
||||
{
|
||||
$setting = Settings::whereId('1')->first();
|
||||
Config::set('mail.host', $setting->host);
|
||||
}
|
||||
|
||||
public static function encryption() {
|
||||
public static function encryption()
|
||||
{
|
||||
$setting = Settings::whereId('1')->first();
|
||||
Config::set(['mail.encryption' => $setting->encryption, 'mail.username' => $setting->email]);
|
||||
}
|
||||
|
||||
public 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'));
|
||||
}
|
||||
|
||||
public 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');
|
||||
@@ -289,13 +309,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();
|
||||
@@ -314,7 +336,7 @@ class UserController extends Controller {
|
||||
//$extension = Input::file('profile_pic')->getClientOriginalExtension();
|
||||
$name = Input::file('profile_pic')->getClientOriginalName();
|
||||
$destinationPath = 'lb-faveo/dist/img';
|
||||
$fileName = rand(0000, 9999) . '.' . $name;
|
||||
$fileName = rand(0000, 9999).'.'.$name;
|
||||
//echo $fileName;
|
||||
Input::file('profile_pic')->move($destinationPath, $fileName);
|
||||
$user->profile_pic = $fileName;
|
||||
@@ -328,7 +350,8 @@ 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())) {
|
||||
@@ -340,5 +363,4 @@ class UserController extends Controller {
|
||||
return redirect()->back()->with('fails', Lang::get('lang.password_was_not_updated'));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -4,9 +4,10 @@ namespace App\Http\Controllers\Common;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
class FileuploadController extends Controller {
|
||||
|
||||
public function __construct() {
|
||||
class FileuploadController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
// checking authentication
|
||||
$this->middleware('auth');
|
||||
// checking if role is agent
|
||||
@@ -15,7 +16,8 @@ class FileuploadController extends Controller {
|
||||
|
||||
// Returns a file size limit in bytes based on the PHP upload_max_filesize
|
||||
// and post_max_size
|
||||
function file_upload_max_size() {
|
||||
public function file_upload_max_size()
|
||||
{
|
||||
static $max_size = -1;
|
||||
|
||||
if ($max_size < 0) {
|
||||
@@ -31,11 +33,13 @@ class FileuploadController extends Controller {
|
||||
$max_size_in_actual = ini_get('upload_max_filesize');
|
||||
}
|
||||
}
|
||||
|
||||
return ['0' => $max_size_in_bytes, '1' => $max_size_in_actual];
|
||||
// return $max_size_in_bytes;
|
||||
}
|
||||
|
||||
function parse_size($size) {
|
||||
public function parse_size($size)
|
||||
{
|
||||
$unit = preg_replace('/[^bkmgtpezy]/i', '', $size); // Remove the non-unit characters from the size.
|
||||
$size = preg_replace('/[^0-9\.]/', '', $size); // Remove the non-numeric characters from the size.
|
||||
if ($unit) {
|
||||
@@ -45,5 +49,4 @@ class FileuploadController extends Controller {
|
||||
return round($size);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -2,15 +2,16 @@
|
||||
|
||||
namespace App\Http\Controllers\Common;
|
||||
|
||||
use App\Http\Controllers\Api\v1\PushNotificationController;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Model\helpdesk\Notification\Notification;
|
||||
use App\Model\helpdesk\Notification\NotificationType;
|
||||
use App\Model\helpdesk\Notification\UserNotification;
|
||||
use App\Model\helpdesk\Ticket\Tickets;
|
||||
use App\User;
|
||||
use App\Http\Controllers\Api\v1\PushNotificationController;
|
||||
use App\Model\helpdesk\Notification\NotificationType;
|
||||
|
||||
class NotificationController extends Controller {
|
||||
class NotificationController extends Controller
|
||||
{
|
||||
/**
|
||||
*********************************************
|
||||
* Class Notification Controller
|
||||
@@ -19,17 +20,17 @@ class NotificationController extends Controller {
|
||||
* under the folling occurrence
|
||||
* 1. Ticket Creation
|
||||
* 2. Ticket Reply
|
||||
* 3. User Creation
|
||||
* 3. User Creation.
|
||||
*
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
|
||||
public $user;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* Constructor.
|
||||
*/
|
||||
public function __construct(PushNotificationController $PushNotificationController) {
|
||||
public function __construct(PushNotificationController $PushNotificationController)
|
||||
{
|
||||
$this->PushNotificationController = $PushNotificationController;
|
||||
$user = new User();
|
||||
$this->user = $user;
|
||||
@@ -41,12 +42,14 @@ class NotificationController extends Controller {
|
||||
|
||||
/**
|
||||
* This function is used to create in app notifications.
|
||||
*
|
||||
* @param type $model_id
|
||||
* @param type $userid_created
|
||||
* @param type $type_id
|
||||
* @param type $forwhome
|
||||
*/
|
||||
public function create($model_id, $userid_created, $type_id, $forwhome = []) {
|
||||
public function create($model_id, $userid_created, $type_id, $forwhome = [])
|
||||
{
|
||||
try {
|
||||
if (empty($forwhome)) {
|
||||
$ticket = Tickets::where('id', '=', $model_id)->first();
|
||||
@@ -67,48 +70,62 @@ class NotificationController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is to mark all ticket to read status
|
||||
* This function is to mark all ticket to read status.
|
||||
*
|
||||
* @param type $id
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function markAllRead($id) {
|
||||
public function markAllRead($id)
|
||||
{
|
||||
$markasread = UserNotification::where('user_id', '=', \Auth::user()->id)->where('is_read', '=', '0')->get();
|
||||
foreach ($markasread as $mark) {
|
||||
$mark->is_read = '1';
|
||||
$mark->save();
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function to mark read
|
||||
* This function to mark read.
|
||||
*
|
||||
* @param type $id
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function markRead($id) {
|
||||
public function markRead($id)
|
||||
{
|
||||
$markasread = UserNotification::where('notification_id', '=', $id)->where('user_id', '=', \Auth::user()->id)->where('is_read', '=', '0')->get();
|
||||
foreach ($markasread as $mark) {
|
||||
$mark->is_read = '1';
|
||||
$mark->save();
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* function to show all the notifications
|
||||
* function to show all the notifications.
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function show() {
|
||||
public function show()
|
||||
{
|
||||
$notifications = $this->getNotifications();
|
||||
|
||||
return view('notifications-all', compact('notifications'));
|
||||
}
|
||||
|
||||
/**
|
||||
* function to delete notifications
|
||||
* function to delete notifications.
|
||||
*
|
||||
* @param type $id
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function delete($id) {
|
||||
public function delete($id)
|
||||
{
|
||||
$markasread = UserNotification::where('notification_id', '=', $id)->where('user_id', '=', \Auth::user()->id)->get();
|
||||
foreach ($markasread as $mark) {
|
||||
$mark->delete();
|
||||
@@ -119,14 +136,16 @@ class NotificationController extends Controller {
|
||||
|
||||
/**
|
||||
* get the page to list the notifications.
|
||||
*
|
||||
* @return response
|
||||
*/
|
||||
public static function getNotifications() {
|
||||
public static function getNotifications()
|
||||
{
|
||||
$notifications = UserNotification::join('notifications', 'user_notification.notification_id', '=', 'notifications.id')
|
||||
->join('notification_types', 'notifications.type_id', '=', 'notification_types.id')
|
||||
->where('user_notification.user_id', '=', \Auth::user()->id)
|
||||
->paginate(10);
|
||||
|
||||
return $notifications;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -6,16 +6,18 @@ use App\Http\Controllers\Controller;
|
||||
use App\Model\Common\TemplateType;
|
||||
use App\Model\helpdesk\Agent\Department;
|
||||
use App\Model\helpdesk\Email\Emails;
|
||||
use App\Model\helpdesk\Settings\CommonSettings;
|
||||
use App\Model\helpdesk\Settings\Company;
|
||||
use App\Model\helpdesk\Settings\Email;
|
||||
use App\Model\helpdesk\Settings\CommonSettings;
|
||||
use App\User;
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -24,8 +26,9 @@ class PhpMailController extends Controller {
|
||||
*
|
||||
* @return Mail
|
||||
*/
|
||||
public function sendmail($from, $to, $message, $template_variables) {
|
||||
// try {
|
||||
public function sendmail($from, $to, $message, $template_variables)
|
||||
{
|
||||
// try {
|
||||
// dd($from);
|
||||
$from_address = $this->fetch_smtp_details($from);
|
||||
if ($from_address == null) {
|
||||
@@ -195,7 +198,7 @@ class PhpMailController extends Controller {
|
||||
if ($template_data->subject) {
|
||||
$subject = $template_data->subject;
|
||||
if ($ticket_number != null) {
|
||||
$subject = $subject . ' [#' . $ticket_number . ']';
|
||||
$subject = $subject.' [#'.$ticket_number.']';
|
||||
}
|
||||
} else {
|
||||
$subject = $message['subject'];
|
||||
@@ -262,18 +265,18 @@ class PhpMailController extends Controller {
|
||||
$mail->addAttachment($file_path, $file_name);
|
||||
}
|
||||
}
|
||||
$mail->CharSet = "utf8";
|
||||
$mail->CharSet = 'utf8';
|
||||
$mail->Subject = $subject;
|
||||
if ($template == 'ticket-reply-agent') {
|
||||
$line = '---Reply above this line--- <br/><br/>';
|
||||
$body = $line . $messagebody;
|
||||
$body = $line.$messagebody;
|
||||
} else {
|
||||
$body = $messagebody;
|
||||
}
|
||||
$rtl = CommonSettings::where('option_name', '=', 'enable_rtl')->first();
|
||||
if($rtl->option_value == 1) {
|
||||
if ($rtl->option_value == 1) {
|
||||
$mail->ContentType = 'text/html';
|
||||
$body = '<html dir="rtl" xml:lang="ar" lang="ar"><head></head><body dir="rtl">' . $body . '</body></html>';
|
||||
$body = '<html dir="rtl" xml:lang="ar" lang="ar"><head></head><body dir="rtl">'.$body.'</body></html>';
|
||||
} else {
|
||||
}
|
||||
$mail->Body = nl2br($body);
|
||||
@@ -291,7 +294,8 @@ class PhpMailController extends Controller {
|
||||
*
|
||||
* @return MailNotification
|
||||
*/
|
||||
public function sendEmail($from, $to, $message) {
|
||||
public function sendEmail($from, $to, $message)
|
||||
{
|
||||
try {
|
||||
$from_address = $this->fetch_smtp_details($from);
|
||||
if ($from_address == null) {
|
||||
@@ -403,7 +407,7 @@ class PhpMailController extends Controller {
|
||||
$mail->addAttachment($file_path, $file_name);
|
||||
}
|
||||
}
|
||||
$mail->CharSet = "utf8";
|
||||
$mail->CharSet = 'utf8';
|
||||
$mail->Subject = $subject;
|
||||
$mail->Body = $content;
|
||||
if (!$mail->send()) {
|
||||
@@ -411,7 +415,7 @@ class PhpMailController extends Controller {
|
||||
}
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
if($e instanceof ErrorException) {
|
||||
if ($e instanceof ErrorException) {
|
||||
return \Lang::get('lang.outgoing_email_failed');
|
||||
}
|
||||
}
|
||||
@@ -422,7 +426,8 @@ class PhpMailController extends Controller {
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function company() {
|
||||
public function company()
|
||||
{
|
||||
$company = Company::Where('id', '=', '1')->first();
|
||||
if ($company->company_name == null) {
|
||||
$company = 'Support Center';
|
||||
@@ -441,7 +446,8 @@ class PhpMailController extends Controller {
|
||||
*
|
||||
* @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;
|
||||
@@ -454,5 +460,4 @@ class PhpMailController extends Controller {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -5,39 +5,35 @@ namespace App\Http\Controllers\Common;
|
||||
// Controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
// Requests
|
||||
use Illuminate\Http\Request;
|
||||
// Models
|
||||
use App\User;
|
||||
// classes
|
||||
use LaravelFCM\Message\PayloadNotificationBuilder;
|
||||
use LaravelFCM\Message\Topics;
|
||||
use LaravelFCM\Message\OptionsBuilder;
|
||||
use LaravelFCM\Message\PayloadDataBuilder;
|
||||
use LaravelFCM\Response\DownstreamResponse;
|
||||
// Models
|
||||
use FCM;
|
||||
use FCMGroup;
|
||||
|
||||
// classes
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
/**
|
||||
* **********************************************
|
||||
* PushNotificationController
|
||||
* **********************************************
|
||||
* This controller is used to send notification to FCM cloud which later will
|
||||
* foreward notification to Mobile Application
|
||||
* foreward notification to Mobile Application.
|
||||
*
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class PushNotificationController extends Controller {
|
||||
|
||||
public function response($token, User $user) {
|
||||
class PushNotificationController extends Controller
|
||||
{
|
||||
public function response($token, User $user)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* function to get the fcm token from the api under a user.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function fcmToken(Request $request, User $user) {
|
||||
public function fcmToken(Request $request, User $user)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -11,7 +11,6 @@ use App\Model\helpdesk\Email\Smtp;
|
||||
// models
|
||||
use App\Model\helpdesk\Settings\Plugin;
|
||||
use App\Model\helpdesk\Theme\Widgets;
|
||||
use App\Model\helpdesk\Utility\Version_Check;
|
||||
use Config;
|
||||
// classes
|
||||
use Crypt;
|
||||
@@ -27,14 +26,15 @@ use Lang;
|
||||
* ***************************
|
||||
* 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->middleware('auth');
|
||||
$this->middleware('roles');
|
||||
}
|
||||
@@ -44,7 +44,8 @@ class SettingsController extends Controller {
|
||||
*
|
||||
* @return response
|
||||
*/
|
||||
public function widgets() {
|
||||
public function widgets()
|
||||
{
|
||||
return view('themes.default1.admin.helpdesk.theme.widgets');
|
||||
}
|
||||
|
||||
@@ -53,7 +54,8 @@ class SettingsController extends Controller {
|
||||
*
|
||||
* @return response
|
||||
*/
|
||||
public function list_widget() {
|
||||
public function list_widget()
|
||||
{
|
||||
return \Datatable::collection(Widgets::where('id', '<', '7')->get())
|
||||
->searchColumns('name')
|
||||
->orderColumns('name', 'title', 'value')
|
||||
@@ -67,33 +69,33 @@ class SettingsController extends Controller {
|
||||
return $model->value;
|
||||
})
|
||||
->addColumn('Actions', function ($model) {
|
||||
return '<span data-toggle="modal" data-target="#edit_widget' . $model->id . '"><a class="btn btn-warning btn-xs">' . \Lang::get('lang.edit') . '</a></span>
|
||||
<div class="modal fade" id="edit_widget' . $model->id . '">
|
||||
return '<span data-toggle="modal" data-target="#edit_widget'.$model->id.'"><a class="btn btn-warning btn-xs">'.\Lang::get('lang.edit').'</a></span>
|
||||
<div class="modal fade" id="edit_widget'.$model->id.'">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<form action="' . url('edit-widget/' . $model->id) . '" method="POST">
|
||||
<form action="'.url('edit-widget/'.$model->id).'" method="POST">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title">' . strtoupper($model->name) . ' </h4>
|
||||
<h4 class="modal-title">'.strtoupper($model->name).' </h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group" style="width:100%">
|
||||
<label>' . \Lang::get('lang.title') . '</label><br/>
|
||||
<input type="text" name="title" value="' . $model->title . '" class="form-control" style="width:100%">
|
||||
<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/>
|
||||
<textarea name="content" class="form-control" style="width:100%" id="Content' . $model->id . '">' . $model->value . '</textarea>
|
||||
<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>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">' . \Lang::get('lang.close') . '</button>
|
||||
<input type="submit" class="btn btn-primary" value="' . \Lang::get('lang.update') . '">
|
||||
<button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">'.\Lang::get('lang.close').'</button>
|
||||
<input type="submit" class="btn btn-primary" value="'.\Lang::get('lang.update').'">
|
||||
</div>
|
||||
<script>
|
||||
$(function () {
|
||||
$("#Content' . $model->id . '").wysihtml5();
|
||||
$("#Content'.$model->id.'").wysihtml5();
|
||||
});
|
||||
</script>
|
||||
</form>
|
||||
@@ -112,13 +114,15 @@ class SettingsController extends Controller {
|
||||
*
|
||||
* @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 . Lang::get('lang.saved_successfully'));
|
||||
|
||||
return redirect()->back()->with('success', $widget->name.Lang::get('lang.saved_successfully'));
|
||||
} catch (Exception $e) {
|
||||
return redirect()->back()->with('fails', $e->getMessage());
|
||||
}
|
||||
@@ -129,7 +133,8 @@ class SettingsController extends Controller {
|
||||
*
|
||||
* @return response
|
||||
*/
|
||||
public function social_buttons() {
|
||||
public function social_buttons()
|
||||
{
|
||||
return view('themes.default1.admin.helpdesk.theme.social');
|
||||
}
|
||||
|
||||
@@ -138,7 +143,8 @@ class SettingsController extends Controller {
|
||||
*
|
||||
* @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')
|
||||
@@ -149,25 +155,25 @@ class SettingsController extends Controller {
|
||||
return $model->value;
|
||||
})
|
||||
->addColumn('Actions', function ($model) {
|
||||
return '<span data-toggle="modal" data-target="#edit_widget' . $model->id . '"><a class="btn btn-warning btn-xs">' . \Lang::get('lang.edit') . '</a></span>
|
||||
<div class="modal fade" id="edit_widget' . $model->id . '">
|
||||
return '<span data-toggle="modal" data-target="#edit_widget'.$model->id.'"><a class="btn btn-warning btn-xs">'.\Lang::get('lang.edit').'</a></span>
|
||||
<div class="modal fade" id="edit_widget'.$model->id.'">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<form action="' . url('edit-widget/' . $model->id) . '" method="POST">
|
||||
<form action="'.url('edit-widget/'.$model->id).'" method="POST">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title">' . strtoupper($model->name) . ' </h4>
|
||||
<h4 class="modal-title">'.strtoupper($model->name).' </h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<br/>
|
||||
<div class="form-group" style="width:100%">
|
||||
<label>' . \Lang::get('lang.link') . '</label><br/>
|
||||
<input type="url" name="content" class="form-control" style="width:100%" value="' . $model->value . '">
|
||||
<label>'.\Lang::get('lang.link').'</label><br/>
|
||||
<input type="url" name="content" class="form-control" style="width:100%" value="'.$model->value.'">
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">' . \Lang::get('lang.close') . '</button>
|
||||
<input type="submit" class="btn btn-primary" value="' . \Lang::get('lang.update') . '">
|
||||
<button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">'.\Lang::get('lang.close').'</button>
|
||||
<input type="submit" class="btn btn-primary" value="'.\Lang::get('lang.update').'">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@@ -185,14 +191,15 @@ class SettingsController extends Controller {
|
||||
*
|
||||
* @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');
|
||||
return redirect()->back()->with('success', $widget->name.' Saved Successfully');
|
||||
} catch (Exception $e) {
|
||||
return redirect()->back()->with('fails', $e->errorInfo[2]);
|
||||
}
|
||||
@@ -203,8 +210,10 @@ class SettingsController extends Controller {
|
||||
*
|
||||
* @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'));
|
||||
}
|
||||
|
||||
@@ -213,7 +222,8 @@ class SettingsController extends Controller {
|
||||
*
|
||||
* @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');
|
||||
@@ -224,6 +234,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]);
|
||||
@@ -238,7 +249,8 @@ class SettingsController extends Controller {
|
||||
*
|
||||
* @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);
|
||||
@@ -251,7 +263,7 @@ class SettingsController extends Controller {
|
||||
if (Input::file('logo')) {
|
||||
$name = Input::file('logo')->getClientOriginalName();
|
||||
$destinationPath = 'dist/logo';
|
||||
$fileName = rand(0000, 9999) . '.' . $name;
|
||||
$fileName = rand(0000, 9999).'.'.$name;
|
||||
Input::file('logo')->move($destinationPath, $fileName);
|
||||
$settings->logo = $fileName;
|
||||
$settings->save();
|
||||
@@ -265,11 +277,13 @@ class SettingsController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
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))
|
||||
@@ -277,15 +291,15 @@ 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>';
|
||||
$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>"
|
||||
. "<div class='modal fade' id=del" . $model['path'] . ">
|
||||
$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>
|
||||
<div class=modal-header>
|
||||
@@ -294,8 +308,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>
|
||||
|
||||
|
||||
@@ -303,12 +317,12 @@ 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;
|
||||
return ucfirst($model['name']).$action;
|
||||
})
|
||||
->addColumn('description', function ($model) {
|
||||
return ucfirst($model['description']);
|
||||
@@ -317,7 +331,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'];
|
||||
@@ -330,8 +344,9 @@ class SettingsController extends Controller {
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function ReadPlugins() {
|
||||
$dir = app_path() . DIRECTORY_SEPARATOR . 'Plugins';
|
||||
public function ReadPlugins()
|
||||
{
|
||||
$dir = app_path().DIRECTORY_SEPARATOR.'Plugins';
|
||||
$plugins = array_diff(scandir($dir), ['.', '..']);
|
||||
|
||||
return $plugins;
|
||||
@@ -344,15 +359,16 @@ class SettingsController extends Controller {
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function PostPlugins(Request $request) {
|
||||
public function PostPlugins(Request $request)
|
||||
{
|
||||
$this->validate($request, ['plugin' => 'required|mimes:application/zip,zip,Zip']);
|
||||
try {
|
||||
if (!extension_loaded('zip')){
|
||||
if (!extension_loaded('zip')) {
|
||||
throw new Exception('Please enable zip extension in your php');
|
||||
}
|
||||
$plug = new Plugin();
|
||||
$file = $request->file('plugin');
|
||||
$destination = app_path() . DIRECTORY_SEPARATOR . 'Plugins';
|
||||
$destination = app_path().DIRECTORY_SEPARATOR.'Plugins';
|
||||
$zipfile = $file->getRealPath();
|
||||
/*
|
||||
* get the file name and remove .zip
|
||||
@@ -365,31 +381,31 @@ class SettingsController extends Controller {
|
||||
if (in_array($filename, $dir_check)) {
|
||||
return redirect()->back()->with('fails', Lang::get('lang.plugin-exists'));
|
||||
}
|
||||
mkdir($destination . DIRECTORY_SEPARATOR . $filename);
|
||||
mkdir($destination.DIRECTORY_SEPARATOR.$filename);
|
||||
/*
|
||||
* extract the zip file using zipper
|
||||
*/
|
||||
\Zipper::make($zipfile)->folder($filename2)->extractTo($destination . DIRECTORY_SEPARATOR . $filename);
|
||||
\Zipper::make($zipfile)->folder($filename2)->extractTo($destination.DIRECTORY_SEPARATOR.$filename);
|
||||
|
||||
$file = app_path() . DIRECTORY_SEPARATOR . 'Plugins' . DIRECTORY_SEPARATOR . $filename; // Plugin file path
|
||||
$file = app_path().DIRECTORY_SEPARATOR.'Plugins'.DIRECTORY_SEPARATOR.$filename; // Plugin file path
|
||||
|
||||
if (file_exists($file)) {
|
||||
$seviceporvider = $file . DIRECTORY_SEPARATOR . 'ServiceProvider.php';
|
||||
$config = $file . DIRECTORY_SEPARATOR . 'config.php';
|
||||
$seviceporvider = $file.DIRECTORY_SEPARATOR.'ServiceProvider.php';
|
||||
$config = $file.DIRECTORY_SEPARATOR.'config.php';
|
||||
if (file_exists($seviceporvider) && file_exists($config)) {
|
||||
/*
|
||||
* move to faveo config
|
||||
*/
|
||||
$faveoconfig = config_path() . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . $filename . '.php';
|
||||
$faveoconfig = config_path().DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.$filename.'.php';
|
||||
if ($faveoconfig) {
|
||||
|
||||
//copy($config, $faveoconfig);
|
||||
/*
|
||||
* write provider list in app.php line 128
|
||||
*/
|
||||
$app = base_path() . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'app.php';
|
||||
$app = base_path().DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'app.php';
|
||||
chmod($app, 0644);
|
||||
$str = "\n\n\t\t\t'App\\Plugins\\$filename" . "\\ServiceProvider',";
|
||||
$str = "\n\n\t\t\t'App\\Plugins\\$filename"."\\ServiceProvider',";
|
||||
$line_i_am_looking_for = 144;
|
||||
$lines = file($app, FILE_IGNORE_NEW_LINES);
|
||||
$lines[$line_i_am_looking_for] = $str;
|
||||
@@ -403,7 +419,7 @@ class SettingsController extends Controller {
|
||||
*/
|
||||
$this->deleteDirectory($file);
|
||||
|
||||
return redirect()->back()->with('fails', Lang::get('no-plugin-file') . $file);
|
||||
return redirect()->back()->with('fails', Lang::get('no-plugin-file').$file);
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
@@ -411,7 +427,7 @@ class SettingsController extends Controller {
|
||||
*/
|
||||
$this->deleteDirectory($file);
|
||||
|
||||
return redirect()->back()->with('fails', Lang::get('plugin-config-missing') . $file);
|
||||
return redirect()->back()->with('fails', Lang::get('plugin-config-missing').$file);
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
@@ -419,7 +435,7 @@ class SettingsController extends Controller {
|
||||
*/
|
||||
$this->deleteDirectory($file);
|
||||
|
||||
return redirect()->back()->with('fails', '<b>' . Lang::get('lang.plugin-path-missing') . '</b> ' . $file);
|
||||
return redirect()->back()->with('fails', '<b>'.Lang::get('lang.plugin-path-missing').'</b> '.$file);
|
||||
}
|
||||
} catch (Exception $ex) {
|
||||
return redirect()->back()->with('fails', $ex->getMessage());
|
||||
@@ -433,7 +449,8 @@ class SettingsController extends Controller {
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function deleteDirectory($dir) {
|
||||
public function deleteDirectory($dir)
|
||||
{
|
||||
if (!file_exists($dir)) {
|
||||
return true;
|
||||
}
|
||||
@@ -444,8 +461,8 @@ class SettingsController extends Controller {
|
||||
if ($item == '.' || $item == '..') {
|
||||
continue;
|
||||
}
|
||||
chmod($dir . DIRECTORY_SEPARATOR . $item, 0777);
|
||||
if (!$this->deleteDirectory($dir . DIRECTORY_SEPARATOR . $item)) {
|
||||
chmod($dir.DIRECTORY_SEPARATOR.$item, 0777);
|
||||
if (!$this->deleteDirectory($dir.DIRECTORY_SEPARATOR.$item)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -454,8 +471,9 @@ class SettingsController extends Controller {
|
||||
return rmdir($dir);
|
||||
}
|
||||
|
||||
public function ReadConfigs() {
|
||||
$dir = app_path() . DIRECTORY_SEPARATOR . 'Plugins' . DIRECTORY_SEPARATOR;
|
||||
public function ReadConfigs()
|
||||
{
|
||||
$dir = app_path().DIRECTORY_SEPARATOR.'Plugins'.DIRECTORY_SEPARATOR;
|
||||
$directories = scandir($dir);
|
||||
$files = [];
|
||||
foreach ($directories as $key => $file) {
|
||||
@@ -463,7 +481,7 @@ class SettingsController extends Controller {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (is_dir($dir . DIRECTORY_SEPARATOR . $file)) {
|
||||
if (is_dir($dir.DIRECTORY_SEPARATOR.$file)) {
|
||||
$files[$key] = $file;
|
||||
}
|
||||
}
|
||||
@@ -472,7 +490,7 @@ class SettingsController extends Controller {
|
||||
$plugins = [];
|
||||
if (count($files) > 0) {
|
||||
foreach ($files as $key => $file) {
|
||||
$plugin = $dir . $file;
|
||||
$plugin = $dir.$file;
|
||||
$plugins[$key] = array_diff(scandir($plugin), ['.', '..', 'ServiceProvider.php']);
|
||||
$plugins[$key]['file'] = $plugin;
|
||||
}
|
||||
@@ -482,7 +500,7 @@ class SettingsController extends Controller {
|
||||
if ($dh = opendir($dir)) {
|
||||
while (($file = readdir($dh)) !== false) {
|
||||
if ($file == 'config.php') {
|
||||
$config[] = $dir . DIRECTORY_SEPARATOR . $file;
|
||||
$config[] = $dir.DIRECTORY_SEPARATOR.$file;
|
||||
}
|
||||
}
|
||||
closedir($dh);
|
||||
@@ -495,7 +513,8 @@ class SettingsController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
public function fetchConfig() {
|
||||
public function fetchConfig()
|
||||
{
|
||||
$configs = $this->ReadConfigs();
|
||||
//dd($configs);
|
||||
$plugs = new Plugin();
|
||||
@@ -531,14 +550,15 @@ class SettingsController extends Controller {
|
||||
return $attributes;
|
||||
}
|
||||
|
||||
public function DeletePlugin($slug) {
|
||||
$dir = app_path() . DIRECTORY_SEPARATOR . 'Plugins' . DIRECTORY_SEPARATOR . $slug;
|
||||
public function DeletePlugin($slug)
|
||||
{
|
||||
$dir = app_path().DIRECTORY_SEPARATOR.'Plugins'.DIRECTORY_SEPARATOR.$slug;
|
||||
$this->deleteDirectory($dir);
|
||||
/*
|
||||
* remove service provider from app.php
|
||||
*/
|
||||
$str = "'App\\Plugins\\$slug" . "\\ServiceProvider',";
|
||||
$path_to_file = base_path() . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'app.php';
|
||||
$str = "'App\\Plugins\\$slug"."\\ServiceProvider',";
|
||||
$path_to_file = base_path().DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'app.php';
|
||||
$file_contents = file_get_contents($path_to_file);
|
||||
$file_contents = str_replace($str, '//', $file_contents);
|
||||
file_put_contents($path_to_file, $file_contents);
|
||||
@@ -551,12 +571,13 @@ class SettingsController extends Controller {
|
||||
return redirect()->back()->with('success', 'Deleted Successfully');
|
||||
}
|
||||
|
||||
public function StatusPlugin($slug) {
|
||||
public function StatusPlugin($slug)
|
||||
{
|
||||
$plugs = new Plugin();
|
||||
$plug = $plugs->where('name', $slug)->first();
|
||||
if (!$plug) {
|
||||
$app = base_path() . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'app.php';
|
||||
$str = "\n'App\\Plugins\\$slug" . "\\ServiceProvider',";
|
||||
$app = base_path().DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'app.php';
|
||||
$str = "\n'App\\Plugins\\$slug"."\\ServiceProvider',";
|
||||
$line_i_am_looking_for = 144;
|
||||
$lines = file($app, FILE_IGNORE_NEW_LINES);
|
||||
$lines[$line_i_am_looking_for] = $str;
|
||||
@@ -569,8 +590,8 @@ class SettingsController extends Controller {
|
||||
if ($status == 0) {
|
||||
$plug->status = 1;
|
||||
|
||||
$app = base_path() . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'app.php';
|
||||
$str = "\n'App\\Plugins\\$slug" . "\\ServiceProvider',";
|
||||
$app = base_path().DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'app.php';
|
||||
$str = "\n'App\\Plugins\\$slug"."\\ServiceProvider',";
|
||||
$line_i_am_looking_for = 144;
|
||||
$lines = file($app, FILE_IGNORE_NEW_LINES);
|
||||
$lines[$line_i_am_looking_for] = $str;
|
||||
@@ -581,8 +602,8 @@ class SettingsController extends Controller {
|
||||
/*
|
||||
* remove service provider from app.php
|
||||
*/
|
||||
$str = "\n'App\\Plugins\\$slug" . "\\ServiceProvider',";
|
||||
$path_to_file = base_path() . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'app.php';
|
||||
$str = "\n'App\\Plugins\\$slug"."\\ServiceProvider',";
|
||||
$path_to_file = base_path().DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'app.php';
|
||||
|
||||
$file_contents = file_get_contents($path_to_file);
|
||||
$file_contents = str_replace($str, '//', $file_contents);
|
||||
|
@@ -3,7 +3,6 @@
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Model\helpdesk\Ticket\Tickets;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
class HomeController extends Controller
|
||||
{
|
||||
|
@@ -9,16 +9,18 @@ use Artisan;
|
||||
use Exception;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UpgradeController extends Controller {
|
||||
|
||||
class UpgradeController extends Controller
|
||||
{
|
||||
public $dir;
|
||||
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
$dir = base_path();
|
||||
$this->dir = $dir;
|
||||
}
|
||||
|
||||
public function getLatestVersion() {
|
||||
public function getLatestVersion()
|
||||
{
|
||||
try {
|
||||
$name = \Config::get('app.name');
|
||||
//dd($name);
|
||||
@@ -38,7 +40,7 @@ class UpgradeController extends Controller {
|
||||
$data = Utility::encryptByFaveoPublicKey(json_encode($data));
|
||||
//dd($data);
|
||||
$post_data = [
|
||||
'data' => $data
|
||||
'data' => $data,
|
||||
];
|
||||
$url = 'http://faveohelpdesk.com/billing/public/verification';
|
||||
if (str_contains($url, ' ')) {
|
||||
@@ -59,7 +61,8 @@ class UpgradeController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
public function downloadLatestCode() {
|
||||
public function downloadLatestCode()
|
||||
{
|
||||
$name = \Config::get('app.name');
|
||||
$durl = 'http://www.faveohelpdesk.com/billing/public/download-url';
|
||||
if (str_contains($durl, ' ')) {
|
||||
@@ -75,7 +78,8 @@ class UpgradeController extends Controller {
|
||||
return $download_url;
|
||||
}
|
||||
|
||||
public function saveLatestCodeAtTemp($download_url) {
|
||||
public function saveLatestCodeAtTemp($download_url)
|
||||
{
|
||||
echo '<p>Downloading New Update</p>';
|
||||
$context = stream_context_create(
|
||||
[
|
||||
@@ -87,10 +91,10 @@ class UpgradeController extends Controller {
|
||||
|
||||
$newUpdate = file_get_contents($download_url, false, $context);
|
||||
if (!is_dir("$this->dir/UPDATES/")) {
|
||||
\File::makeDirectory($this->dir . '/UPDATES/', 0777);
|
||||
\File::makeDirectory($this->dir.'/UPDATES/', 0777);
|
||||
}
|
||||
|
||||
$dlHandler = fopen($this->dir . '/UPDATES/' . '/faveo-helpdesk-master.zip', 'w');
|
||||
$dlHandler = fopen($this->dir.'/UPDATES/'.'/faveo-helpdesk-master.zip', 'w');
|
||||
if (!fwrite($dlHandler, $newUpdate)) {
|
||||
echo '<p>Could not save new update. Operation aborted.</p>';
|
||||
exit();
|
||||
@@ -99,25 +103,28 @@ class UpgradeController extends Controller {
|
||||
echo '<p>Update Downloaded And Saved</p>';
|
||||
}
|
||||
|
||||
public function doUpdate() {
|
||||
public function doUpdate()
|
||||
{
|
||||
try {
|
||||
$memory_limit = ini_get('memory_limit');
|
||||
if ($memory_limit < 256) {
|
||||
echo '<ul class=list-unstyled>';
|
||||
echo "<li style='color:red;'>Sorry we can not process your request because of limited memory! You have only $memory_limit. For this you need atleast 256 MB</li>";
|
||||
echo '</ul>';
|
||||
|
||||
return 0;
|
||||
}
|
||||
if (!extension_loaded('zip')) {
|
||||
echo '<ul class=list-unstyled>';
|
||||
echo "<li style='color:red;'>Sorry we can not process your request because you don't have ZIP extension contact your system admin</li>";
|
||||
echo '</ul>';
|
||||
|
||||
return 0;
|
||||
}
|
||||
//Artisan::call('down');
|
||||
$update = $this->dir . '/UPDATES';
|
||||
$update = $this->dir.'/UPDATES';
|
||||
//Open The File And Do Stuff
|
||||
$zipHandle = zip_open($update . '/faveo-helpdesk-master.zip');
|
||||
$zipHandle = zip_open($update.'/faveo-helpdesk-master.zip');
|
||||
//dd($update . '/faveo-' . $aV . '.zip');
|
||||
|
||||
echo '<ul class=list-unstyled>';
|
||||
@@ -132,28 +139,28 @@ class UpgradeController extends Controller {
|
||||
|
||||
|
||||
//Make the directory if we need to...
|
||||
if (!is_dir($update . '/' . $thisFileDir . '/')) {
|
||||
\File::makeDirectory($update . '/' . $thisFileDir, 0775, true, true);
|
||||
if (!is_dir($update.'/'.$thisFileDir.'/')) {
|
||||
\File::makeDirectory($update.'/'.$thisFileDir, 0775, true, true);
|
||||
// mkdir($update.'/'. $thisFileDir, 0775);
|
||||
echo '<li style="color:white;">Created Directory ' . $thisFileDir . '</li>';
|
||||
echo '<li style="color:white;">Created Directory '.$thisFileDir.'</li>';
|
||||
}
|
||||
|
||||
//Overwrite the file
|
||||
if (!is_dir($update . '/' . $thisFileName)) {
|
||||
echo '<li style="color:white;">' . $thisFileName . '...........';
|
||||
if (!is_dir($update.'/'.$thisFileName)) {
|
||||
echo '<li style="color:white;">'.$thisFileName.'...........';
|
||||
$contents = zip_entry_read($aF, zip_entry_filesize($aF));
|
||||
$contents = str_replace("\r\n", "\n", $contents);
|
||||
$updateThis = '';
|
||||
|
||||
//If we need to run commands, then do it.
|
||||
if ($thisFileName == $thisFileDir . '/.env') {
|
||||
if (is_file($update . '/' . $thisFileDir . '/.env')) {
|
||||
unlink($update . '/' . $thisFileDir . '/.env');
|
||||
unlink($update . '/' . $thisFileDir . '/config/database.php');
|
||||
if ($thisFileName == $thisFileDir.'/.env') {
|
||||
if (is_file($update.'/'.$thisFileDir.'/.env')) {
|
||||
unlink($update.'/'.$thisFileDir.'/.env');
|
||||
unlink($update.'/'.$thisFileDir.'/config/database.php');
|
||||
}
|
||||
echo' EXECUTED</li>';
|
||||
} else {
|
||||
$updateThis = fopen($update . '/' . $thisFileName, 'w');
|
||||
$updateThis = fopen($update.'/'.$thisFileName, 'w');
|
||||
fwrite($updateThis, $contents);
|
||||
fclose($updateThis);
|
||||
unset($contents);
|
||||
@@ -166,12 +173,13 @@ class UpgradeController extends Controller {
|
||||
return true;
|
||||
} catch (Exception $ex) {
|
||||
echo '<ul class=list-unstyled>';
|
||||
echo "<li style='color:red;'>" . $ex->getMessage() . "</li>";
|
||||
echo "<li style='color:red;'>".$ex->getMessage().'</li>';
|
||||
echo '</ul>';
|
||||
}
|
||||
}
|
||||
|
||||
public function copyToActualDirectory($latest_version) {
|
||||
public function copyToActualDirectory($latest_version)
|
||||
{
|
||||
try {
|
||||
echo '<ul class=list-unstyled>';
|
||||
$directory = "$this->dir/UPDATES";
|
||||
@@ -190,17 +198,18 @@ class UpgradeController extends Controller {
|
||||
|
||||
$this->deleteBarNotification('new-version');
|
||||
|
||||
echo "<li style='color:green;'>» Faveo Updated to v" . Utility::getFileVersion() . "</li>";
|
||||
echo "<li style='color:green;'>» Faveo Updated to v".Utility::getFileVersion().'</li>';
|
||||
echo '</ul>';
|
||||
} catch (Exception $ex) {
|
||||
echo '<ul class=list-unstyled>';
|
||||
echo "<li style='color:red;'>" . $ex->getMessage() . "</li>";
|
||||
echo "<li style='color:red;'>".$ex->getMessage().'</li>';
|
||||
echo '</ul>';
|
||||
}
|
||||
exit();
|
||||
}
|
||||
|
||||
public function deleteBarNotification($key) {
|
||||
public function deleteBarNotification($key)
|
||||
{
|
||||
try {
|
||||
$noti = new BarNotification();
|
||||
$notifications = $noti->where('key', $key)->get();
|
||||
@@ -212,20 +221,24 @@ class UpgradeController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
public function fileUpdate() {
|
||||
public function fileUpdate()
|
||||
{
|
||||
try {
|
||||
$latest_version = $this->getLatestVersion();
|
||||
if (Utility::getFileVersion() < $latest_version) {
|
||||
$url = url('file-upgrade');
|
||||
|
||||
return view('themes.default1.update.file', compact('url'));
|
||||
}
|
||||
|
||||
return redirect('dashboard')->with('fails', 'Could not find latest realeases from repository.');
|
||||
} catch (Exception $ex) {
|
||||
return redirect()->back()->with('fails', $ex->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function fileUpgrading(Request $request) {
|
||||
public function fileUpgrading(Request $request)
|
||||
{
|
||||
try {
|
||||
//
|
||||
$latest_version = $this->getLatestVersion();
|
||||
@@ -233,10 +246,10 @@ class UpgradeController extends Controller {
|
||||
$current_version = Utility::getFileVersion();
|
||||
if ($latest_version != '') {
|
||||
if (Utility::getFileVersion() < $latest_version) {
|
||||
|
||||
return view('themes.default1.update.update', compact('latest_version', 'current_version', 'request'));
|
||||
}
|
||||
}
|
||||
|
||||
return redirect('dashboard')->with('fails', 'Could not find latest realeases from repository.');
|
||||
|
||||
|
||||
@@ -248,7 +261,8 @@ class UpgradeController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
public function testScroll() {
|
||||
public function testScroll()
|
||||
{
|
||||
$ex = 1000;
|
||||
echo '<ul style=list-unstyled>';
|
||||
for ($i = 0; $i < $ex; $i++) {
|
||||
@@ -257,7 +271,8 @@ class UpgradeController extends Controller {
|
||||
echo '</ul>';
|
||||
}
|
||||
|
||||
public function fileUpgrading1(Request $request) {
|
||||
public function fileUpgrading1(Request $request)
|
||||
{
|
||||
if (Utility::getFileVersion() < Utility::getDatabaseVersion()) {
|
||||
$latest_version = $this->getLatestVersion();
|
||||
// dd($latest_version);
|
||||
@@ -267,7 +282,7 @@ class UpgradeController extends Controller {
|
||||
echo "<p>CURRENT VERSION: $current_version</p>";
|
||||
echo '<p>Reading Current Releases List</p>';
|
||||
if ($latest_version > $current_version) {
|
||||
echo '<p>New Update Found: v' . $latest_version . '</p>';
|
||||
echo '<p>New Update Found: v'.$latest_version.'</p>';
|
||||
$found = true;
|
||||
if (!is_file("$this->dir/UPDATES/faveo-helpdesk-master.zip")) {
|
||||
if ($request->get('dodownload') == true) {
|
||||
@@ -278,7 +293,7 @@ class UpgradeController extends Controller {
|
||||
echo '<p>Error in you network connection.</p>';
|
||||
}
|
||||
} else {
|
||||
echo '<p>Latest code found. <a href=' . url('file-upgrade?dodownload=true') . '>» Download Now?</a></p>';
|
||||
echo '<p>Latest code found. <a href='.url('file-upgrade?dodownload=true').'>» Download Now?</a></p>';
|
||||
exit();
|
||||
}
|
||||
} else {
|
||||
@@ -287,7 +302,7 @@ class UpgradeController extends Controller {
|
||||
if ($request->get('doUpdate') == true) {
|
||||
$updated = $this->doUpdate();
|
||||
} else {
|
||||
echo '<p>Update ready. <a href=' . url('file-upgrade?doUpdate=true') . '>» Install Now?</a></p>';
|
||||
echo '<p>Update ready. <a href='.url('file-upgrade?doUpdate=true').'>» Install Now?</a></p>';
|
||||
exit();
|
||||
}
|
||||
|
||||
@@ -307,17 +322,18 @@ class UpgradeController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
public function getCurl($url) {
|
||||
public function getCurl($url)
|
||||
{
|
||||
try {
|
||||
$curl = Utility::_isCurl();
|
||||
if (!$curl) {
|
||||
throw new Exception("Please enable your curl function to check latest update");
|
||||
throw new Exception('Please enable your curl function to check latest update');
|
||||
}
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
if (curl_exec($ch) === false) {
|
||||
echo 'Curl error: ' . curl_error($ch);
|
||||
echo 'Curl error: '.curl_error($ch);
|
||||
}
|
||||
$data = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
@@ -328,11 +344,12 @@ class UpgradeController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
public function postDownloadCurl($url, $data) {
|
||||
public function postDownloadCurl($url, $data)
|
||||
{
|
||||
try {
|
||||
$curl = Utility::_isCurl();
|
||||
if (!$curl) {
|
||||
throw new Exception("Please enable your curl function to check latest update");
|
||||
throw new Exception('Please enable your curl function to check latest update');
|
||||
}
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_POST, 1);
|
||||
@@ -340,21 +357,23 @@ class UpgradeController extends Controller {
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
if (curl_exec($ch) === false) {
|
||||
echo 'Curl error: ' . curl_error($ch);
|
||||
echo 'Curl error: '.curl_error($ch);
|
||||
}
|
||||
$data = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
|
||||
return json_decode($data, true);
|
||||
} catch (Exception $ex) {
|
||||
return redirect()->back()->with('fails', $ex->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function postCurl($url, $data) {
|
||||
public function postCurl($url, $data)
|
||||
{
|
||||
try {
|
||||
$curl = Utility::_isCurl();
|
||||
if (!$curl) {
|
||||
throw new Exception("Please enable your curl function to check latest update");
|
||||
throw new Exception('Please enable your curl function to check latest update');
|
||||
}
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_POST, 1);
|
||||
@@ -362,18 +381,20 @@ class UpgradeController extends Controller {
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
if (curl_exec($ch) === false) {
|
||||
echo 'Curl error: ' . curl_error($ch);
|
||||
echo 'Curl error: '.curl_error($ch);
|
||||
}
|
||||
$data = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
$data = Utility::decryptByFaveoPrivateKey($data);
|
||||
|
||||
return json_decode($data, true);
|
||||
} catch (Exception $ex) {
|
||||
return redirect()->back()->with('fails', $ex->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function databaseUpdate() {
|
||||
public function databaseUpdate()
|
||||
{
|
||||
try {
|
||||
if (Utility::getFileVersion() > Utility::getDatabaseVersion()) {
|
||||
$url = url('database-upgrade');
|
||||
@@ -387,7 +408,8 @@ class UpgradeController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
public function databaseUpgrade() {
|
||||
public function databaseUpgrade()
|
||||
{
|
||||
try {
|
||||
if (Utility::getFileVersion() > Utility::getDatabaseVersion()) {
|
||||
Artisan::call('migrate', ['--force' => true]);
|
||||
@@ -400,5 +422,4 @@ class UpgradeController extends Controller {
|
||||
return redirect()->back()->with('fails', $ex->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -7,9 +7,10 @@ use Config;
|
||||
use Exception;
|
||||
use Schema;
|
||||
|
||||
class LibraryController extends Controller {
|
||||
|
||||
public static function getFileVersion() {
|
||||
class LibraryController extends Controller
|
||||
{
|
||||
public static function getFileVersion()
|
||||
{
|
||||
try {
|
||||
$app = Config::get('app.version');
|
||||
if ($app) {
|
||||
@@ -22,7 +23,8 @@ class LibraryController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
public static function getDatabaseVersion() {
|
||||
public static function getDatabaseVersion()
|
||||
{
|
||||
try {
|
||||
$database = self::isDatabaseSetup();
|
||||
if ($database == true) {
|
||||
@@ -39,7 +41,8 @@ class LibraryController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
public static function isDatabaseSetup() {
|
||||
public static function isDatabaseSetup()
|
||||
{
|
||||
try {
|
||||
if (Schema::hasTable('settings_system')) {
|
||||
return true;
|
||||
@@ -49,47 +52,50 @@ class LibraryController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
public static function encryptByFaveoPublicKey($data) {
|
||||
public static function encryptByFaveoPublicKey($data)
|
||||
{
|
||||
try {
|
||||
$path = storage_path() . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'public.key';
|
||||
$path = storage_path().DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'public.key';
|
||||
//dd($path);
|
||||
$key_content = file_get_contents($path);
|
||||
$public_key = openssl_get_publickey($key_content);
|
||||
|
||||
$encrypted = $e = NULL;
|
||||
openssl_seal($data, $encrypted, $e, array($public_key));
|
||||
$encrypted = $e = null;
|
||||
openssl_seal($data, $encrypted, $e, [$public_key]);
|
||||
|
||||
$sealed_data = base64_encode($encrypted);
|
||||
$envelope = base64_encode($e[0]);
|
||||
|
||||
$result = ['seal' => $sealed_data, 'envelope' => $envelope];
|
||||
|
||||
return json_encode($result);
|
||||
} catch (Exception $ex) {
|
||||
throw new Exception($ex->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public static function decryptByFaveoPrivateKey($encrypted) {
|
||||
|
||||
public static function decryptByFaveoPrivateKey($encrypted)
|
||||
{
|
||||
try {
|
||||
$encrypted = json_decode($encrypted);
|
||||
$sealed_data = $encrypted->seal;
|
||||
$envelope = $encrypted->envelope;
|
||||
$input = base64_decode($sealed_data);
|
||||
$einput = base64_decode($envelope);
|
||||
$path = storage_path('app' . DIRECTORY_SEPARATOR . 'private.key');
|
||||
$path = storage_path('app'.DIRECTORY_SEPARATOR.'private.key');
|
||||
$key_content = file_get_contents($path);
|
||||
$private_key = openssl_get_privatekey($key_content);
|
||||
$plaintext = NULL;
|
||||
$plaintext = null;
|
||||
openssl_open($input, $plaintext, $einput, $private_key);
|
||||
|
||||
return $plaintext;
|
||||
} catch (Exception $ex) {
|
||||
// dd($ex);
|
||||
}
|
||||
}
|
||||
|
||||
public static function _isCurl() {
|
||||
public static function _isCurl()
|
||||
{
|
||||
return function_exists('curl_version');
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -3,6 +3,7 @@
|
||||
namespace App\Http\Requests\helpdesk;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
//use Illuminate\Http\Request as Req;
|
||||
/**
|
||||
* Sys_userUpdate.
|
||||
|
@@ -9,14 +9,15 @@ use App\Http\Requests\Request;
|
||||
*
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class TicketRequest extends Request {
|
||||
|
||||
class TicketRequest extends Request
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize() {
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -25,12 +26,13 @@ class TicketRequest extends Request {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules() {
|
||||
$error = "";
|
||||
public function rules()
|
||||
{
|
||||
$error = '';
|
||||
try {
|
||||
$size = $this->size();
|
||||
if ($size > 800 || $size==0) {
|
||||
throw new \Exception("File size exceeded", 422);
|
||||
if ($size > 800 || $size == 0) {
|
||||
throw new \Exception('File size exceeded', 422);
|
||||
}
|
||||
} catch (\Exception $ex) {
|
||||
dd($ex);
|
||||
@@ -41,23 +43,25 @@ class TicketRequest extends Request {
|
||||
// ];
|
||||
}
|
||||
|
||||
public function size() {
|
||||
public function size()
|
||||
{
|
||||
$files = $this->file('attachment');
|
||||
if (!$files) {
|
||||
throw new \Exception("exceeded", 422);
|
||||
throw new \Exception('exceeded', 422);
|
||||
}
|
||||
$size = 0;
|
||||
if (count($files) > 0) {
|
||||
foreach ($files as $file) {
|
||||
$size +=$file->getSize();
|
||||
$size += $file->getSize();
|
||||
}
|
||||
}
|
||||
|
||||
return $size;
|
||||
}
|
||||
|
||||
public function error($e) {
|
||||
public function error($e)
|
||||
{
|
||||
if ($this->ajax() || $this->wantsJson()) {
|
||||
|
||||
$message = $e->getMessage();
|
||||
if (is_object($message)) {
|
||||
$message = $message->toArray();
|
||||
@@ -66,5 +70,4 @@ class TicketRequest extends Request {
|
||||
return $message;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -24,6 +24,7 @@ class CategoryRequest extends Request
|
||||
public function rules()
|
||||
{
|
||||
$id = $this->segment(2);
|
||||
|
||||
return [
|
||||
'name' => 'required|max:250|unique:kb_category,name,'.$id,
|
||||
'description' => 'required',
|
||||
|
@@ -24,8 +24,9 @@ class PageRequest extends Request
|
||||
public function rules()
|
||||
{
|
||||
$slug = $this->segment(2);
|
||||
|
||||
return [
|
||||
'name' => 'required|unique:kb_pages,slug,'.$slug
|
||||
'name' => 'required|unique:kb_pages,slug,'.$slug,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@@ -192,13 +192,13 @@ Route::group(['middleware' => ['web']], function () {
|
||||
$breadcrumbs->push(Lang::get('lang.edit'), url('sla/{sla}/edit'));
|
||||
});
|
||||
Route::resource('forms', 'Admin\helpdesk\FormController');
|
||||
Route::post('forms/field/{fieldid}/child',[
|
||||
'as'=>'forms.field.child',
|
||||
'uses'=>'Admin\helpdesk\FormController@addChild',
|
||||
Route::post('forms/field/{fieldid}/child', [
|
||||
'as' => 'forms.field.child',
|
||||
'uses' => 'Admin\helpdesk\FormController@addChild',
|
||||
]);
|
||||
Route::get('forms/render/child',[
|
||||
'as'=>'forms.field.child',
|
||||
'uses'=>'Admin\helpdesk\FormController@renderChild',
|
||||
Route::get('forms/render/child', [
|
||||
'as' => 'forms.field.child',
|
||||
'uses' => 'Admin\helpdesk\FormController@renderChild',
|
||||
]);
|
||||
Breadcrumbs::register('forms.index', function ($breadcrumbs) {
|
||||
$breadcrumbs->parent('setting');
|
||||
@@ -526,50 +526,50 @@ Route::group(['middleware' => ['web']], function () {
|
||||
Route::get('/ticket/inbox', ['as' => 'inbox.ticket', 'uses' => 'Agent\helpdesk\TicketController@inbox_ticket_list']); /* Get Inbox Ticket */
|
||||
Breadcrumbs::register('inbox.ticket', function ($breadcrumbs) {
|
||||
$breadcrumbs->parent('dashboard');
|
||||
$breadcrumbs->push(Lang::get('lang.tickets') . ' > ' . Lang::get('lang.inbox'), route('inbox.ticket'));
|
||||
$breadcrumbs->push(Lang::get('lang.tickets').' > '.Lang::get('lang.inbox'), route('inbox.ticket'));
|
||||
});
|
||||
Route::get('/ticket/get-inbox', ['as' => 'get.inbox.ticket', 'uses' => 'Agent\helpdesk\TicketController@get_inbox']); /* Get tickets in datatable */
|
||||
Route::get('/ticket/open', ['as' => 'open.ticket', 'uses' => 'Agent\helpdesk\TicketController@open_ticket_list']); /* Get Open Ticket */
|
||||
Breadcrumbs::register('open.ticket', function ($breadcrumbs) {
|
||||
$breadcrumbs->parent('dashboard');
|
||||
$breadcrumbs->push(Lang::get('lang.tickets') . ' > ' . Lang::get('lang.open'), route('open.ticket'));
|
||||
$breadcrumbs->push(Lang::get('lang.tickets').' > '.Lang::get('lang.open'), route('open.ticket'));
|
||||
});
|
||||
Route::get('/ticket/get-open', ['as' => 'get.open.ticket', 'uses' => 'Agent\helpdesk\TicketController@get_open']); /* Get tickets in datatable */
|
||||
Route::get('/ticket/answered', ['as' => 'answered.ticket', 'uses' => 'Agent\helpdesk\TicketController@answered_ticket_list']); /* Get Answered Ticket */
|
||||
Breadcrumbs::register('answered.ticket', function ($breadcrumbs) {
|
||||
$breadcrumbs->parent('dashboard');
|
||||
$breadcrumbs->push(Lang::get('lang.tickets') . ' > ' . Lang::get('lang.answered'), route('answered.ticket'));
|
||||
$breadcrumbs->push(Lang::get('lang.tickets').' > '.Lang::get('lang.answered'), route('answered.ticket'));
|
||||
});
|
||||
Route::get('/ticket/get-answered', ['as' => 'get.answered.ticket', 'uses' => 'Agent\helpdesk\TicketController@get_answered']); /* Get tickets in datatable */
|
||||
Route::get('/ticket/myticket', ['as' => 'myticket.ticket', 'uses' => 'Agent\helpdesk\TicketController@myticket_ticket_list']); /* Get Tickets Assigned to logged user */
|
||||
Breadcrumbs::register('myticket.ticket', function ($breadcrumbs) {
|
||||
$breadcrumbs->parent('dashboard');
|
||||
$breadcrumbs->push(Lang::get('lang.tickets') . ' > ' . Lang::get('lang.my_tickets'), route('myticket.ticket'));
|
||||
$breadcrumbs->push(Lang::get('lang.tickets').' > '.Lang::get('lang.my_tickets'), route('myticket.ticket'));
|
||||
});
|
||||
Route::get('/ticket/get-myticket', ['as' => 'get.myticket.ticket', 'uses' => 'Agent\helpdesk\TicketController@get_myticket']); /* Get tickets in datatable */
|
||||
Route::get('/ticket/overdue', ['as' => 'overdue.ticket', 'uses' => 'Agent\helpdesk\TicketController@overdue_ticket_list']); /* Get Overdue Ticket */
|
||||
Breadcrumbs::register('overdue.ticket', function ($breadcrumbs) {
|
||||
$breadcrumbs->parent('dashboard');
|
||||
$breadcrumbs->push(Lang::get('lang.tickets') . ' > ' . Lang::get('lang.overdue'), route('overdue.ticket'));
|
||||
$breadcrumbs->push(Lang::get('lang.tickets').' > '.Lang::get('lang.overdue'), route('overdue.ticket'));
|
||||
});
|
||||
Route::get('/ticket/get-overdue', ['as' => 'get.overdue.ticket', 'uses' => 'Agent\helpdesk\TicketController@getOverdueTickets']); /* Get Overdue Ticket */
|
||||
Route::get('/ticket/closed', ['as' => 'closed.ticket', 'uses' => 'Agent\helpdesk\TicketController@closed_ticket_list']); /* Get Closed Ticket */
|
||||
Breadcrumbs::register('closed.ticket', function ($breadcrumbs) {
|
||||
$breadcrumbs->parent('dashboard');
|
||||
$breadcrumbs->push(Lang::get('lang.tickets') . ' > ' . Lang::get('lang.closed'), route('closed.ticket'));
|
||||
$breadcrumbs->push(Lang::get('lang.tickets').' > '.Lang::get('lang.closed'), route('closed.ticket'));
|
||||
});
|
||||
Route::get('/ticket/get-closed', ['as' => 'get.closed.ticket', 'uses' => 'Agent\helpdesk\TicketController@get_closed']); /* Get tickets in datatable */
|
||||
Route::get('/ticket/assigned', ['as' => 'assigned.ticket', 'uses' => 'Agent\helpdesk\TicketController@assigned_ticket_list']); /* Get Assigned Ticket */
|
||||
Breadcrumbs::register('assigned.ticket', function ($breadcrumbs) {
|
||||
$breadcrumbs->parent('dashboard');
|
||||
$breadcrumbs->push(Lang::get('lang.tickets') . ' > ' . Lang::get('lang.assigned'), route('assigned.ticket'));
|
||||
$breadcrumbs->push(Lang::get('lang.tickets').' > '.Lang::get('lang.assigned'), route('assigned.ticket'));
|
||||
});
|
||||
Route::get('/ticket/get-assigned', ['as' => 'get.assigned.ticket', 'uses' => 'Agent\helpdesk\TicketController@get_assigned']); /* Get tickets in datatable */
|
||||
Route::get('/newticket', ['as' => 'newticket', 'uses' => 'Agent\helpdesk\TicketController@newticket']); /* Get Create New Ticket */
|
||||
Breadcrumbs::register('newticket', function ($breadcrumbs) {
|
||||
$breadcrumbs->parent('dashboard');
|
||||
|
||||
$breadcrumbs->push(Lang::get('lang.tickets') . ' > ' . Lang::get('lang.create'), route('newticket'));
|
||||
$breadcrumbs->push(Lang::get('lang.tickets').' > '.Lang::get('lang.create'), route('newticket'));
|
||||
});
|
||||
Route::get('/newticket/autofill', ['as' => 'post.newticket.autofill', 'uses' => 'Agent\helpdesk\TicketController@autofill']);
|
||||
|
||||
@@ -578,7 +578,7 @@ Route::group(['middleware' => ['web']], function () {
|
||||
Breadcrumbs::register('ticket.thread', function ($breadcrumbs, $id) {
|
||||
$breadcrumbs->parent('dashboard');
|
||||
$ticket_number = App\Model\helpdesk\Ticket\Tickets::where('id', '=', $id)->first();
|
||||
$breadcrumbs->push(Lang::get('lang.tickets') . ' > ' . $ticket_number->ticket_number, url('/thread/{id}'));
|
||||
$breadcrumbs->push(Lang::get('lang.tickets').' > '.$ticket_number->ticket_number, url('/thread/{id}'));
|
||||
});
|
||||
Route::post('/thread/reply/{id}', ['as' => 'ticket.reply', 'uses' => 'Agent\helpdesk\TicketController@reply']); /* Patch Thread Reply */
|
||||
Route::patch('/internal/note/{id}', ['as' => 'Internal.note', 'uses' => 'Agent\helpdesk\TicketController@InternalNote']); /* Patch Internal Note */
|
||||
@@ -595,13 +595,13 @@ Route::group(['middleware' => ['web']], function () {
|
||||
Route::get('trash', ['as' => 'get-trash', 'uses' => 'Agent\helpdesk\TicketController@trash']); /* To show Deleted Tickets */
|
||||
Breadcrumbs::register('get-trash', function ($breadcrumbs) {
|
||||
$breadcrumbs->parent('dashboard');
|
||||
$breadcrumbs->push(Lang::get('lang.tickets') . ' > ' . Lang::get('lang.trash'), route('get-trash'));
|
||||
$breadcrumbs->push(Lang::get('lang.tickets').' > '.Lang::get('lang.trash'), route('get-trash'));
|
||||
});
|
||||
Route::get('/ticket/trash', ['as' => 'get.trash.ticket', 'uses' => 'Agent\helpdesk\TicketController@get_trash']); /* Get tickets in datatable */
|
||||
Route::get('unassigned', ['as' => 'unassigned', 'uses' => 'Agent\helpdesk\TicketController@unassigned']); /* To show Unassigned Tickets */
|
||||
Breadcrumbs::register('unassigned', function ($breadcrumbs) {
|
||||
$breadcrumbs->parent('dashboard');
|
||||
$breadcrumbs->push(Lang::get('lang.tickets') . ' > ' . Lang::get('lang.unassigned'), route('unassigned'));
|
||||
$breadcrumbs->push(Lang::get('lang.tickets').' > '.Lang::get('lang.unassigned'), route('unassigned'));
|
||||
});
|
||||
Route::get('/ticket/unassigned', ['as' => 'get.unassigned.ticket', 'uses' => 'Agent\helpdesk\TicketController@get_unassigned']); /* Get tickets in datatable */
|
||||
Route::get('dashboard', ['as' => 'dashboard', 'uses' => 'Agent\helpdesk\DashboardController@index']); /* To show dashboard pages */
|
||||
@@ -627,17 +627,17 @@ Route::group(['middleware' => ['web']], function () {
|
||||
Route::get('/{dept}/open', ['as' => 'dept.open.ticket', 'uses' => 'Agent\helpdesk\TicketController@deptopen']); // Open
|
||||
Breadcrumbs::register('dept.open.ticket', function ($breadcrumbs, $dept) {
|
||||
$breadcrumbs->parent('dashboard');
|
||||
$breadcrumbs->push(Lang::get('lang.department') . ' > ' . $dept . ' > ' . Lang::get('lang.open_tickets'), url('/{dept}/open'));
|
||||
$breadcrumbs->push(Lang::get('lang.department').' > '.$dept.' > '.Lang::get('lang.open_tickets'), url('/{dept}/open'));
|
||||
});
|
||||
Route::get('/{dept}/assigned', ['as' => 'dept.inprogress.ticket', 'uses' => 'Agent\helpdesk\TicketController@deptinprogress']); // Inprogress
|
||||
Breadcrumbs::register('dept.inprogress.ticket', function ($breadcrumbs, $dept) {
|
||||
$breadcrumbs->parent('dashboard');
|
||||
$breadcrumbs->push(Lang::get('lang.department') . ' > ' . $dept . ' > ' . Lang::get('lang.assigned_tickets'), url('/{dept}/inprogress'));
|
||||
$breadcrumbs->push(Lang::get('lang.department').' > '.$dept.' > '.Lang::get('lang.assigned_tickets'), url('/{dept}/inprogress'));
|
||||
});
|
||||
Route::get('/{dept}/closed', ['as' => 'dept.closed.ticket', 'uses' => 'Agent\helpdesk\TicketController@deptclose']); // Closed
|
||||
Breadcrumbs::register('dept.closed.ticket', function ($breadcrumbs, $dept) {
|
||||
$breadcrumbs->parent('dashboard');
|
||||
$breadcrumbs->push(Lang::get('lang.department') . ' > ' . $dept . ' > ' . Lang::get('lang.closed_tickets'), url('/{dept}/closed'));
|
||||
$breadcrumbs->push(Lang::get('lang.department').' > '.$dept.' > '.Lang::get('lang.closed_tickets'), url('/{dept}/closed'));
|
||||
});
|
||||
Route::post('rating/{id}', ['as' => 'ticket.rating', 'uses' => 'Agent\helpdesk\TicketController@rating']); /* Get overall Ratings */
|
||||
Route::post('rating2/{id}', ['as' => 'ticket.rating2', 'uses' => 'Agent\helpdesk\TicketController@ratingReply']); /* Get reply Ratings */
|
||||
@@ -787,10 +787,10 @@ Route::group(['middleware' => ['web']], function () {
|
||||
echo '</tr>';
|
||||
foreach ($routeCollection as $value) {
|
||||
echo '<tr>';
|
||||
echo '<td>' . $value->getMethods()[0] . '</td>';
|
||||
echo '<td>' . $value->getName() . '</td>';
|
||||
echo '<td>' . $value->getPath() . '</td>';
|
||||
echo '<td>' . $value->getActionName() . '</td>';
|
||||
echo '<td>'.$value->getMethods()[0].'</td>';
|
||||
echo '<td>'.$value->getName().'</td>';
|
||||
echo '<td>'.$value->getPath().'</td>';
|
||||
echo '<td>'.$value->getActionName().'</td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
echo '</table>';
|
||||
@@ -813,7 +813,7 @@ Route::group(['middleware' => ['web']], function () {
|
||||
$breadcrumbs->push('404');
|
||||
});
|
||||
|
||||
Route::get('error-in-database-connection', ['as' => 'errordb', function() {
|
||||
Route::get('error-in-database-connection', ['as' => 'errordb', function () {
|
||||
return view('errors.db');
|
||||
}]);
|
||||
|
||||
@@ -821,7 +821,7 @@ Route::group(['middleware' => ['web']], function () {
|
||||
$breadcrumbs->push('Error establishing connection to database');
|
||||
});
|
||||
|
||||
Route::get('unauthorized', ['as' => 'unauth', function() {
|
||||
Route::get('unauthorized', ['as' => 'unauth', function () {
|
||||
return view('errors.unauth');
|
||||
}]);
|
||||
|
||||
@@ -1114,5 +1114,4 @@ Route::group(['middleware' => ['web']], function () {
|
||||
|
||||
|
||||
Route::get('test', ['as' => 'test', 'uses' => 'Common\PushNotificationController@response']);
|
||||
|
||||
});
|
@@ -2,11 +2,10 @@
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
use App\Jobs\Job;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use App\Http\Controllers\Common\PhpMailController;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class SendEmail extends Job implements ShouldQueue
|
||||
{
|
||||
@@ -16,6 +15,7 @@ class SendEmail extends Job implements ShouldQueue
|
||||
protected $from;
|
||||
protected $to;
|
||||
protected $message;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
|
@@ -6,8 +6,6 @@ use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class FieldValue extends Model
|
||||
{
|
||||
protected $table = "field_values";
|
||||
protected $fillable = ['field_id','parent_id','field_key','field_value'];
|
||||
|
||||
|
||||
protected $table = 'field_values';
|
||||
protected $fillable = ['field_id', 'parent_id', 'field_key', 'field_value'];
|
||||
}
|
||||
|
@@ -4,8 +4,8 @@ namespace App\Model\helpdesk\Form;
|
||||
|
||||
use App\BaseModel;
|
||||
|
||||
class Fields extends BaseModel {
|
||||
|
||||
class Fields extends BaseModel
|
||||
{
|
||||
protected $table = 'custom_form_fields';
|
||||
|
||||
/**
|
||||
@@ -15,17 +15,22 @@ class Fields extends BaseModel {
|
||||
*/
|
||||
protected $fillable = ['forms_id', 'label', 'name', 'type', 'value', 'required'];
|
||||
|
||||
public function valueRelation() {
|
||||
public function valueRelation()
|
||||
{
|
||||
$related = "App\Model\helpdesk\Form\FieldValue";
|
||||
|
||||
return $this->hasMany($related, 'field_id');
|
||||
}
|
||||
|
||||
public function values() {
|
||||
public function values()
|
||||
{
|
||||
$value = $this->valueRelation();
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
public function deleteValues() {
|
||||
public function deleteValues()
|
||||
{
|
||||
$values = $this->values()->get();
|
||||
if ($values->count() > 0) {
|
||||
foreach ($values as $value) {
|
||||
@@ -34,9 +39,8 @@ class Fields extends BaseModel {
|
||||
}
|
||||
}
|
||||
|
||||
public function delete() {
|
||||
|
||||
public function delete()
|
||||
{
|
||||
parent::delete();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -15,49 +15,58 @@ class Forms extends BaseModel
|
||||
*/
|
||||
protected $fillable = ['formname'];
|
||||
|
||||
|
||||
public function fieldRelation(){
|
||||
public function fieldRelation()
|
||||
{
|
||||
$related = "App\Model\helpdesk\Form\Fields";
|
||||
|
||||
return $this->hasMany($related);
|
||||
}
|
||||
|
||||
public function fields(){
|
||||
public function fields()
|
||||
{
|
||||
$relation = $this->fieldRelation()->get();
|
||||
|
||||
return $relation;
|
||||
}
|
||||
|
||||
public function fieldsDelete(){
|
||||
public function fieldsDelete()
|
||||
{
|
||||
$fields = $this->fields();
|
||||
if($fields->count()>0){
|
||||
foreach($fields as $field){
|
||||
if ($fields->count() > 0) {
|
||||
foreach ($fields as $field) {
|
||||
$field->delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function formValueRelation(){
|
||||
public function formValueRelation()
|
||||
{
|
||||
$related = "App\Model\helpdesk\Form\FieldValue";
|
||||
return $this->hasMany($related,'child_id');
|
||||
|
||||
return $this->hasMany($related, 'child_id');
|
||||
}
|
||||
|
||||
public function formValueChild(){
|
||||
public function formValueChild()
|
||||
{
|
||||
$childs = $this->formValueRelation()->get();
|
||||
|
||||
return $childs;
|
||||
}
|
||||
|
||||
public function deleteFormChild(){
|
||||
public function deleteFormChild()
|
||||
{
|
||||
$childs = $this->formValueChild();
|
||||
if($childs->count()>0){
|
||||
foreach ($childs as $child){
|
||||
$child->child_id = NULL;
|
||||
if ($childs->count() > 0) {
|
||||
foreach ($childs as $child) {
|
||||
$child->child_id = null;
|
||||
$child->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function delete() {
|
||||
public function delete()
|
||||
{
|
||||
$this->fieldsDelete();
|
||||
parent::delete();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -50,7 +50,7 @@ class AppServiceProvider extends ServiceProvider
|
||||
\View::composer('themes.default1.update.notification', function () {
|
||||
$notification = new BarNotification();
|
||||
$not = [
|
||||
'notification' => $notification->where('value','!=','')->get(),
|
||||
'notification' => $notification->where('value', '!=', '')->get(),
|
||||
];
|
||||
view()->share($not);
|
||||
});
|
||||
|
@@ -28,7 +28,7 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
|
||||
protected $fillable = ['user_name', 'email', 'password', 'active', 'first_name', 'last_name', 'ban', 'ext', 'mobile', 'profile_pic',
|
||||
'phone_number', 'company', 'agent_sign', 'account_type', 'account_status',
|
||||
'assign_group', 'primary_dpt', 'agent_tzone', 'daylight_save', 'limit_access',
|
||||
'directory_listing', 'vacation_mode', 'role', 'internal_note', 'country_code','fcm_token' ];
|
||||
'directory_listing', 'vacation_mode', 'role', 'internal_note', 'country_code', 'fcm_token', ];
|
||||
|
||||
/**
|
||||
* The attributes excluded from the model's JSON form.
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@@ -26,13 +26,13 @@ return array(
|
||||
| can also be used. For PDO, run the package migrations first.
|
||||
|
|
||||
*/
|
||||
'storage' => array(
|
||||
'storage' => [
|
||||
'enabled' => true,
|
||||
'driver' => 'file', // redis, file, pdo, custom
|
||||
'path' => storage_path('debugbar'), // For file driver
|
||||
'connection' => null, // Leave null for default connection (Redis/PDO)
|
||||
'provider' => '' // Instance of StorageInterface for custom driver
|
||||
),
|
||||
'provider' => '', // Instance of StorageInterface for custom driver
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@@ -82,7 +82,7 @@ return array(
|
||||
|
|
||||
*/
|
||||
|
||||
'collectors' => array(
|
||||
'collectors' => [
|
||||
'phpinfo' => true, // Php version
|
||||
'messages' => true, // Messages
|
||||
'time' => true, // Time Datalogger
|
||||
@@ -103,7 +103,7 @@ return array(
|
||||
'auth' => false, // Display Laravel authentication status
|
||||
'gate' => false, // Display Laravel Gate checks
|
||||
'session' => true, // Display session data
|
||||
),
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@@ -114,33 +114,33 @@ return array(
|
||||
|
|
||||
*/
|
||||
|
||||
'options' => array(
|
||||
'auth' => array(
|
||||
'options' => [
|
||||
'auth' => [
|
||||
'show_name' => false, // Also show the users name/email in the debugbar
|
||||
),
|
||||
'db' => array(
|
||||
],
|
||||
'db' => [
|
||||
'with_params' => true, // Render SQL with the parameters substituted
|
||||
'timeline' => false, // Add the queries to the timeline
|
||||
'backtrace' => false, // EXPERIMENTAL: Use a backtrace to find the origin of the query in your files.
|
||||
'explain' => array( // EXPERIMENTAL: Show EXPLAIN output on queries
|
||||
'explain' => [ // EXPERIMENTAL: Show EXPLAIN output on queries
|
||||
'enabled' => false,
|
||||
'types' => array('SELECT'), // array('SELECT', 'INSERT', 'UPDATE', 'DELETE'); for MySQL 5.6.3+
|
||||
),
|
||||
'types' => ['SELECT'], // array('SELECT', 'INSERT', 'UPDATE', 'DELETE'); for MySQL 5.6.3+
|
||||
],
|
||||
'hints' => true, // Show hints for common mistakes
|
||||
),
|
||||
'mail' => array(
|
||||
'full_log' => false
|
||||
),
|
||||
'views' => array(
|
||||
],
|
||||
'mail' => [
|
||||
'full_log' => false,
|
||||
],
|
||||
'views' => [
|
||||
'data' => false, //Note: Can slow down the application, because the data can be quite large..
|
||||
),
|
||||
'route' => array(
|
||||
'label' => true // show complete route on bar
|
||||
),
|
||||
'logs' => array(
|
||||
'file' => null
|
||||
),
|
||||
),
|
||||
],
|
||||
'route' => [
|
||||
'label' => true, // show complete route on bar
|
||||
],
|
||||
'logs' => [
|
||||
'file' => null,
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@@ -167,4 +167,4 @@ return array(
|
||||
*/
|
||||
'route_prefix' => '_debugbar',
|
||||
|
||||
);
|
||||
];
|
||||
|
@@ -1,14 +1,14 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'driver' => env('FCM_PROTOCOL','http'),
|
||||
'driver' => env('FCM_PROTOCOL', 'http'),
|
||||
'log_enabled' => true,
|
||||
|
||||
'http' => [
|
||||
'server_key' => env('FCM_SERVER_KEY','Your FCM server key'),
|
||||
'server_key' => env('FCM_SERVER_KEY', 'Your FCM server key'),
|
||||
'sender_id' => env('FCM_SENDER_ID', 'Your sender id'),
|
||||
'server_send_url' => 'https://fcm.googleapis.com/fcm/send',
|
||||
'server_group_url' => 'https://android.googleapis.com/gcm/notification',
|
||||
'timeout' => 30.0, // in second
|
||||
]
|
||||
],
|
||||
];
|
||||
|
@@ -1,6 +1,5 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class Version1079table extends Migration
|
||||
@@ -16,7 +15,7 @@ class Version1079table extends Migration
|
||||
$current_version2 = explode(' ', $current_version1);
|
||||
$current_version = $current_version2[1];
|
||||
$settings_system = DB::table('settings_system')->where('id', '=', '1')->first();
|
||||
if($settings_system != null) {
|
||||
if ($settings_system != null) {
|
||||
DB::table('settings_system')->insert(['version' => $current_version]);
|
||||
DB::table('common_settings')
|
||||
->insert(
|
||||
@@ -24,7 +23,5 @@ class Version1079table extends Migration
|
||||
['option_name' => 'user_set_ticket_status', 'status' => 1]
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -26,6 +26,7 @@ use App\Model\helpdesk\Utility\CountryCode;
|
||||
use App\Model\helpdesk\Utility\Date_format;
|
||||
use App\Model\helpdesk\Utility\Date_time_format;
|
||||
use App\Model\helpdesk\Utility\Languages;
|
||||
use App\Model\helpdesk\Utility\Limit_Login;
|
||||
use App\Model\helpdesk\Utility\Log_notification;
|
||||
use App\Model\helpdesk\Utility\MailboxProtocol;
|
||||
use App\Model\helpdesk\Utility\Time_format;
|
||||
@@ -33,7 +34,6 @@ use App\Model\helpdesk\Utility\Timezones;
|
||||
use App\Model\helpdesk\Utility\Version_Check;
|
||||
use App\Model\helpdesk\Workflow\WorkflowClose;
|
||||
use App\Model\kb\Settings;
|
||||
use App\Model\helpdesk\Utility\Limit_Login;
|
||||
use App\Model\Update\BarNotification;
|
||||
// Knowledge base
|
||||
use Illuminate\Database\Seeder;
|
||||
@@ -1977,7 +1977,7 @@ class DatabaseSeeder extends Seeder
|
||||
|
||||
|
||||
Security::create(['id' => '1', 'lockout_message' => 'You have been locked out of application due to too many failed login attempts.', 'backlist_offender' => '0', 'backlist_threshold' => '15', 'lockout_period' => '15', 'days_to_keep_logs' => '0']);
|
||||
Limit_Login::create(['id'=>'1']);
|
||||
Limit_Login::create(['id' => '1']);
|
||||
|
||||
TemplateSet::create(['id' => '1', 'name' => 'default', 'active' => '1']);
|
||||
|
||||
|
@@ -35,13 +35,10 @@ if (!empty($_POST)) {
|
||||
$value = htmlspecialchars(stripslashes((string) $value));
|
||||
} else {
|
||||
$value = htmlspecialchars((string) $value);
|
||||
}
|
||||
?>
|
||||
} ?>
|
||||
<tr>
|
||||
<th style="vertical-align: top"><?php echo htmlspecialchars((string) $key);
|
||||
?></th>
|
||||
<td><pre class="samples"><?php echo $value;
|
||||
?></pre></td>
|
||||
<th style="vertical-align: top"><?php echo htmlspecialchars((string) $key); ?></th>
|
||||
<td><pre class="samples"><?php echo $value; ?></pre></td>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
|
@@ -1007,7 +1007,7 @@ return [
|
||||
'organization_profile' => 'Organization Profile',
|
||||
'organization-s_head' => "Organization's Head",
|
||||
'select_department_manager' => 'Select Department Manager',
|
||||
'select_organization_manager' => "Select Organization Manager",
|
||||
'select_organization_manager' => 'Select Organization Manager',
|
||||
'users_of' => 'Users of',
|
||||
'organization_created_successfully' => 'Organization Created Successfully',
|
||||
'organization_can_not_create' => 'Organization can not Create',
|
||||
|
Reference in New Issue
Block a user