Applied fixes from StyleCI
This commit is contained in:

committed by
StyleCI Bot

parent
09bf25b5e2
commit
e2390f67d4
@@ -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,9 +226,10 @@ 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();
|
||||
if ($system->department == $id) {
|
||||
return redirect('departments')->with('fails', Lang::get('lang.you_cannot_delete_default_department'));
|
||||
@@ -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'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -99,11 +99,10 @@ class LanguageController extends Controller
|
||||
return \Datatable::collection(new Collection($values))
|
||||
->addColumn('language', function ($model) {
|
||||
if ($model == Config::get('app.fallback_locale')) {
|
||||
return Config::get('languages.'.$model).' ('.Lang::get('lang.default').')';
|
||||
return Config::get('languages.'.$model).' ('.Lang::get('lang.default').')';
|
||||
} else {
|
||||
return Config::get('languages.'.$model);
|
||||
}
|
||||
|
||||
})
|
||||
->addColumn('id', function ($model) {
|
||||
return $model;
|
||||
@@ -239,16 +238,17 @@ class LanguageController extends Controller
|
||||
if ($success) {
|
||||
//sending back with success message
|
||||
Session::flash('success', Lang::get('lang.delete-success'));
|
||||
|
||||
|
||||
return Redirect::back();
|
||||
} else {
|
||||
//sending back with error message
|
||||
Session::flash('fails', Lang::get('lang.lang-doesnot-exist'));
|
||||
|
||||
|
||||
return Redirect::back();
|
||||
}
|
||||
} else {
|
||||
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());
|
||||
|
Reference in New Issue
Block a user