Apply fixes from StyleCI

This commit is contained in:
Manish Verma
2017-09-04 09:52:33 +00:00
committed by StyleCI Bot
parent 837c99db39
commit 7a78368037
39 changed files with 1023 additions and 1498 deletions

View File

@@ -232,7 +232,7 @@ class FilterController extends Controller
public function table()
{
// if (Auth::user()->role == 'admin') {
$ticket = new Tickets();
$ticket = new Tickets();
$tickets = $ticket
->leftJoin('ticket_thread', function ($join) {
$join->on('tickets.id', '=', 'ticket_thread.ticket_id')

View File

@@ -284,24 +284,22 @@ class TicketController extends Controller
if ($result[1]) {
$status = $this->checkUserVerificationStatus();
if ($status == 1) {
if ($api != false)
{
if ($api != false) {
$ticket = Tickets::where('ticket_number', '=', $result[0])->select('id')->first();
return ['ticket_id' => $ticket->id, 'message' => Lang::get('lang.Ticket-created-successfully')];
}
return Redirect('newticket')->with('success', Lang::get('lang.Ticket-created-successfully'));
} else {
if ($api != false)
{
if ($api != false) {
return response()->json(['success' => Lang::get('lang.Ticket-created-successfully')]);
}
return Redirect('newticket')->with('success', Lang::get('lang.Ticket-created-successfully2'));
}
} else {
if ($api != false)
{
if ($api != false) {
return response()->json(['error' => Lang::get('lang.failed-to-create-user-tcket-as-mobile-has-been-taken')], 500);
}
@@ -309,8 +307,7 @@ class TicketController extends Controller
}
} catch (Exception $e) {
dd($e);
if ($api != false)
{
if ($api != false) {
return response()->json(['error' => $e->getMessage()], 500);
}
@@ -403,6 +400,7 @@ class TicketController extends Controller
public function reply(Ticket_Thread $thread, Request $request, Ticket_attachments $ta, $mail = true, $system_reply = true, $user_id = '')
{
\Event::fire('reply.request', [$request]);
try {
if (is_array($request->file('attachment'))) {
} else {
@@ -815,6 +813,7 @@ class TicketController extends Controller
}
// Event fire
\Event::fire(new \App\Events\ReadMailEvent($user_id, $password));
try {
if ($auto_response == 0) {
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $user->first_name, 'email' => $emailadd], $message = ['subject' => null, 'scenario' => 'registration-notification'], $template_variables = ['user' => $user->first_name, 'email_address' => $emailadd, 'user_password' => $password]);
@@ -867,6 +866,7 @@ class TicketController extends Controller
}
} else {
$body2 = null;
try {
if ($auto_response == 0) {
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('0', $ticketdata->dept_id), $to = ['name' => $username, 'email' => $emailadd], $message = ['subject' => $updated_subject, 'scenario' => 'create-ticket'],
@@ -1234,10 +1234,10 @@ class TicketController extends Controller
} else {
$ticket_status = $ticket->where('id', '=', $id)->first();
}
// checking for unautherised access attempt on other than owner ticket id
if ($ticket_status == null) {
return redirect()->route('unauth');
}
// checking for unautherised access attempt on other than owner ticket id
if ($ticket_status == null) {
return redirect()->route('unauth');
}
$ticket_status->status = 3;
$ticket_status->closed = 1;
$ticket_status->closed_at = date('Y-m-d H:i:s');
@@ -1265,6 +1265,7 @@ class TicketController extends Controller
} else {
$from_email = $sending_emails->id;
}
try {
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('0', $ticket_status->dept_id), $to = ['name' => $user_name, 'email' => $email], $message = ['subject' => $ticket_subject.'[#'.$ticket_number.']', 'scenario' => 'close-ticket'], $template_variables = ['ticket_number' => $ticket_number]);
} catch (\Exception $e) {
@@ -1501,6 +1502,7 @@ class TicketController extends Controller
$agent_email = $user_detail->email;
$ticket_link = route('ticket.thread', $id);
$master = Auth::user()->first_name.' '.Auth::user()->last_name;
try {
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('0', $ticket->dept_id), $to = ['name' => $agent, 'email' => $agent_email], $message = ['subject' => $ticket_subject.'[#'.$ticket_number.']', 'scenario' => 'assign-ticket'], $template_variables = ['ticket_agent_name' => $agent, 'ticket_number' => $ticket_number, 'ticket_assigner' => $master, 'ticket_link' => $ticket_link]);
} catch (\Exception $e) {
@@ -1634,6 +1636,7 @@ class TicketController extends Controller
$create_user->password = Hash::make($password);
$create_user->save();
$user_id = $create_user->id;
try {
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $name, 'email' => $email], $message = ['subject' => 'password', 'scenario' => 'registration-notification'], $template_variables = ['user' => $name, 'email_address' => $email, 'user_password' => $password]);
} catch (\Exception $e) {
@@ -2321,6 +2324,7 @@ class TicketController extends Controller
$user->role = 'user';
if ($user->save()) {
$user_id = $user->id;
try {
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $name, 'email' => $email], $message = ['subject' => 'Password', 'scenario' => 'registration-notification'], $template_variables = ['user' => $name, 'email_address' => $email, 'user_password' => $password]);
} catch (\Exception $e) {

View File

@@ -149,7 +149,7 @@ class UserController extends Controller
}
// displaying list of users with chumper datatables
// return \Datatable::collection(User::where('role', "!=", "admin")->get())
return \Datatables::of($users)
return \Datatables::of($users)
/* column username */
->removeColumn('id', 'last_name', 'country_code', 'phone_number')
->addColumn('user_name', function ($model) {
@@ -218,14 +218,14 @@ class UserController extends Controller
if (Auth::user()->role == 'admin') {
// @if(Auth::user()->role == 'admin')
return '<a href="'.route('user.show', $model->id).'" class="btn btn-primary btn-xs">'.\Lang::get('lang.view').'</a>';
return '<a href="'.route('user.show', $model->id).'" class="btn btn-primary btn-xs">'.\Lang::get('lang.view').'</a>';
}
if (Auth::user()->role == 'agent') {
// @if(Auth::user()->role == 'admin')
if ($model->role == 'user') {
return '<a href="'.route('user.show', $model->id).'" class="btn btn-primary btn-xs">'.\Lang::get('lang.view').'</a>';
}
if ($model->role == 'user') {
return '<a href="'.route('user.show', $model->id).'" class="btn btn-primary btn-xs">'.\Lang::get('lang.view').'</a>';
}
}
}
})
@@ -235,7 +235,7 @@ class UserController extends Controller
public function restoreUser($id)
{
// dd($id);
// $delete_all = Input::get('delete_all');
// $delete_all = Input::get('delete_all');
$users = User::where('id', '=', $id)->first();
$users->is_delete = 0;
$users->active = 1;
@@ -298,6 +298,7 @@ class UserController extends Controller
$password = $this->generateRandomString();
$user->password = Hash::make($password);
$user->role = 'user';
try {
if ($request->get('country_code') == '' && ($request->get('phone_number') != '' || $request->get('mobile') != '')) {
return redirect()->back()->with(['fails' => Lang::get('lang.country-code-required-error'), 'country_code_error' => 1])->withInput();
@@ -514,19 +515,19 @@ class UserController extends Controller
// $ticket_logic4 = User_org::where('user_id', '=', $id)->update(['user_id' => $assign_to[1]]);
// }
// $thread2 = Ticket_Thread::where('ticket_id', '=', $ticket->id)->first();
// $thread2->body = 'This Ticket have been Reassigned to' .' '. $assignee;
// $thread2->save();
// UserNotification::where('notification_id', '=', $ticket->id)->delete();
// $users = User::where('id', '=', $id)->get();
// $organization = User_org::where('user_id', '=', $id)->delete();
// Assign_team_agent::where('agent_id', '=', $id)->update(['agent_id' => $assign_to[1]]);
$tickets = Tickets::where('assigned_to', '=', $id)->get();
// $thread2 = Ticket_Thread::where('ticket_id', '=', $ticket->id)->first();
// $thread2->body = 'This Ticket have been Reassigned to' .' '. $assignee;
// $thread2->save();
// UserNotification::where('notification_id', '=', $ticket->id)->delete();
// $users = User::where('id', '=', $id)->get();
// $organization = User_org::where('user_id', '=', $id)->delete();
// Assign_team_agent::where('agent_id', '=', $id)->update(['agent_id' => $assign_to[1]]);
$tickets = Tickets::where('assigned_to', '=', $id)->get();
foreach ($tickets as $ticket) {
// code...
$ticket->assigned_to = $assign_to[1];
$ticket->assigned_to = $assign_to[1];
$user_detail = User::where('id', '=', $assign_to[1])->first();
$assignee = $user_detail->first_name.' '.$user_detail->last_name;
$ticket_number = $ticket->ticket_number;
@@ -561,20 +562,20 @@ class UserController extends Controller
} elseif ($delete_all == 1) {
if ($delete_all) {
// dd('here');
$tickets = Tickets::where('assigned_to', '=', $id)->get();
// dd($tickets);
foreach ($tickets as $ticket) {
$ticket->assigned_to = null;
$ticket_number = $ticket->ticket_number;
$ticket->save();
$tickets = Tickets::where('assigned_to', '=', $id)->get();
// dd($tickets);
foreach ($tickets as $ticket) {
$ticket->assigned_to = null;
$ticket_number = $ticket->ticket_number;
$ticket->save();
$thread = new Ticket_Thread();
$thread->ticket_id = $ticket->id;
$thread->user_id = Auth::user()->id;
$thread->is_internal = 1;
$thread->body = 'This Ticket has been unassigned ';
$thread->save();
}
$thread = new Ticket_Thread();
$thread->ticket_id = $ticket->id;
$thread->user_id = Auth::user()->id;
$thread->is_internal = 1;
$thread->body = 'This Ticket has been unassigned ';
$thread->save();
}
// $users = User::where('id', '=', $id)->get();
$user = User::find($id);
$users->is_delete = 1;
@@ -708,6 +709,7 @@ class UserController extends Controller
public function getProfile()
{
$user = Auth::user();
try {
return view('themes.default1.agent.helpdesk.user.profile', compact('user'));
} catch (Exception $e) {
@@ -727,6 +729,7 @@ class UserController extends Controller
$phonecode = $code->where('iso', '=', $location->iso_code)->first();
$settings = CommonSettings::select('status')->where('option_name', '=', 'send_otp')->first();
$status = $settings->status;
try {
return view('themes.default1.agent.helpdesk.user.profile-edit', compact('user'))
->with(['phonecode' => $phonecode->phonecode,
@@ -766,13 +769,13 @@ class UserController extends Controller
$name = Input::file('profile_pic')->getClientOriginalName();
// dd($name);
// dd(str_replace(" ", "_", $name));
// fetching upload destination path
// fetching upload destination path
$destinationPath = 'uploads/profilepic';
// adding a random value to profile picture filename
// adding a random value to profile picture filename
$fileName = rand(0000, 9999).'.'.str_replace(' ', '_', $name);
// moving the picture to a destination folder
// moving the picture to a destination folder
Input::file('profile_pic')->move($destinationPath, $fileName);
// saving filename to database
// saving filename to database
$user->profile_pic = $fileName;
}
if ($request->get('mobile')) {
@@ -805,6 +808,7 @@ class UserController extends Controller
// checking if the old password matches the new password
if (Hash::check($request->input('old_password'), $user->getAuthPassword())) {
$user->password = Hash::make($request->input('new_password'));
try {
$user->save();