Apply fixes from StyleCI
This commit is contained in:

committed by
StyleCI Bot

parent
837c99db39
commit
7a78368037
@@ -271,10 +271,12 @@ class AgentController extends Controller
|
|||||||
$team_assign_agent = $team_assign_agent->where('agent_id', $id);
|
$team_assign_agent = $team_assign_agent->where('agent_id', $id);
|
||||||
$team_assign_agent->delete();
|
$team_assign_agent->delete();
|
||||||
$user = $user->whereId($id)->first();
|
$user = $user->whereId($id)->first();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$error = Lang::get('lang.this_staff_is_related_to_some_tickets');
|
$error = Lang::get('lang.this_staff_is_related_to_some_tickets');
|
||||||
$user->id;
|
$user->id;
|
||||||
$user->delete();
|
$user->delete();
|
||||||
|
|
||||||
throw new \Exception($error);
|
throw new \Exception($error);
|
||||||
return redirect('agents')->with('success', Lang::get('lang.agent_deleted_sucessfully'));
|
return redirect('agents')->with('success', Lang::get('lang.agent_deleted_sucessfully'));
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
@@ -428,6 +428,7 @@ class EmailsController extends Controller
|
|||||||
return redirect('emails')->with('fails', Lang::get('lang.you_cannot_delete_system_default_email'));
|
return redirect('emails')->with('fails', Lang::get('lang.you_cannot_delete_system_default_email'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// fetching the database instance of the current email
|
// fetching the database instance of the current email
|
||||||
$emails = $email->whereId($id)->first();
|
$emails = $email->whereId($id)->first();
|
||||||
|
@@ -106,6 +106,7 @@ class FormController extends Controller
|
|||||||
|
|
||||||
return view('themes.default1.admin.helpdesk.manage.form.preview', compact('form', 'fields'));
|
return view('themes.default1.admin.helpdesk.manage.form.preview', compact('form', 'fields'));
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new Exception("Sorry we can't find your request");
|
throw new Exception("Sorry we can't find your request");
|
||||||
} catch (Exception $ex) {
|
} catch (Exception $ex) {
|
||||||
return redirect()->back()->with('fails', $ex->getMessage());
|
return redirect()->back()->with('fails', $ex->getMessage());
|
||||||
@@ -125,6 +126,7 @@ class FormController extends Controller
|
|||||||
'name.*' => 'required',
|
'name.*' => 'required',
|
||||||
'type.*' => 'required',
|
'type.*' => 'required',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$forms = new Forms();
|
$forms = new Forms();
|
||||||
$require = Input::get('required');
|
$require = Input::get('required');
|
||||||
@@ -195,6 +197,7 @@ class FormController extends Controller
|
|||||||
//dd($fields);
|
//dd($fields);
|
||||||
return view('themes.default1.admin.helpdesk.manage.form.edit', compact('form', 'fields', 'select_forms'));
|
return view('themes.default1.admin.helpdesk.manage.form.edit', compact('form', 'fields', 'select_forms'));
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new Exception("Sorry we can't find your request");
|
throw new Exception("Sorry we can't find your request");
|
||||||
} catch (Exception $ex) {
|
} catch (Exception $ex) {
|
||||||
return redirect()->back()->with('fails', $ex->getMessage());
|
return redirect()->back()->with('fails', $ex->getMessage());
|
||||||
@@ -213,6 +216,7 @@ class FormController extends Controller
|
|||||||
//dd($fields);
|
//dd($fields);
|
||||||
return view('themes.default1.admin.helpdesk.manage.form.add-child', compact('form', 'fields', 'select_forms'));
|
return view('themes.default1.admin.helpdesk.manage.form.add-child', compact('form', 'fields', 'select_forms'));
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new Exception("Sorry we can't find your request");
|
throw new Exception("Sorry we can't find your request");
|
||||||
} catch (Exception $ex) {
|
} catch (Exception $ex) {
|
||||||
return redirect()->back()->with('fails', $ex->getMessage());
|
return redirect()->back()->with('fails', $ex->getMessage());
|
||||||
@@ -227,6 +231,7 @@ class FormController extends Controller
|
|||||||
'name.*' => 'required',
|
'name.*' => 'required',
|
||||||
'type.*' => 'required',
|
'type.*' => 'required',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (!$request->input('formname')) {
|
if (!$request->input('formname')) {
|
||||||
throw new Exception(Lang::get('lang.please_fill_form_name'));
|
throw new Exception(Lang::get('lang.please_fill_form_name'));
|
||||||
@@ -391,6 +396,7 @@ class FormController extends Controller
|
|||||||
public function addChild($fieldid, Request $request)
|
public function addChild($fieldid, Request $request)
|
||||||
{
|
{
|
||||||
$ids = $request->except('_token');
|
$ids = $request->except('_token');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
foreach ($ids as $valueid => $formid) {
|
foreach ($ids as $valueid => $formid) {
|
||||||
$field_value = new \App\Model\helpdesk\Form\FieldValue();
|
$field_value = new \App\Model\helpdesk\Form\FieldValue();
|
||||||
|
@@ -32,6 +32,7 @@ class SocialMediaController extends Controller
|
|||||||
'client_secret' => 'required',
|
'client_secret' => 'required',
|
||||||
'redirect' => 'required|url',
|
'redirect' => 'required|url',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$requests = $request->except('_token');
|
$requests = $request->except('_token');
|
||||||
$this->insertProvider($provider, $requests);
|
$this->insertProvider($provider, $requests);
|
||||||
|
@@ -149,6 +149,7 @@ class WorkflowController extends Controller
|
|||||||
$email_data["E-$key"] = $email;
|
$email_data["E-$key"] = $email;
|
||||||
}
|
}
|
||||||
$emails = $email_data;
|
$emails = $email_data;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return view('themes.default1.admin.helpdesk.manage.workflow.create', compact('emails'));
|
return view('themes.default1.admin.helpdesk.manage.workflow.create', compact('emails'));
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
@@ -284,24 +284,22 @@ class TicketController extends Controller
|
|||||||
if ($result[1]) {
|
if ($result[1]) {
|
||||||
$status = $this->checkUserVerificationStatus();
|
$status = $this->checkUserVerificationStatus();
|
||||||
if ($status == 1) {
|
if ($status == 1) {
|
||||||
if ($api != false)
|
if ($api != false) {
|
||||||
{
|
|
||||||
$ticket = Tickets::where('ticket_number', '=', $result[0])->select('id')->first();
|
$ticket = Tickets::where('ticket_number', '=', $result[0])->select('id')->first();
|
||||||
|
|
||||||
return ['ticket_id' => $ticket->id, 'message' => Lang::get('lang.Ticket-created-successfully')];
|
return ['ticket_id' => $ticket->id, 'message' => Lang::get('lang.Ticket-created-successfully')];
|
||||||
}
|
}
|
||||||
|
|
||||||
return Redirect('newticket')->with('success', Lang::get('lang.Ticket-created-successfully'));
|
return Redirect('newticket')->with('success', Lang::get('lang.Ticket-created-successfully'));
|
||||||
} else {
|
} else {
|
||||||
if ($api != false)
|
if ($api != false) {
|
||||||
{
|
|
||||||
return response()->json(['success' => Lang::get('lang.Ticket-created-successfully')]);
|
return response()->json(['success' => Lang::get('lang.Ticket-created-successfully')]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Redirect('newticket')->with('success', Lang::get('lang.Ticket-created-successfully2'));
|
return Redirect('newticket')->with('success', Lang::get('lang.Ticket-created-successfully2'));
|
||||||
}
|
}
|
||||||
} else {
|
} 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);
|
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) {
|
} catch (Exception $e) {
|
||||||
dd($e);
|
dd($e);
|
||||||
if ($api != false)
|
if ($api != false) {
|
||||||
{
|
|
||||||
return response()->json(['error' => $e->getMessage()], 500);
|
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 = '')
|
public function reply(Ticket_Thread $thread, Request $request, Ticket_attachments $ta, $mail = true, $system_reply = true, $user_id = '')
|
||||||
{
|
{
|
||||||
\Event::fire('reply.request', [$request]);
|
\Event::fire('reply.request', [$request]);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (is_array($request->file('attachment'))) {
|
if (is_array($request->file('attachment'))) {
|
||||||
} else {
|
} else {
|
||||||
@@ -815,6 +813,7 @@ class TicketController extends Controller
|
|||||||
}
|
}
|
||||||
// Event fire
|
// Event fire
|
||||||
\Event::fire(new \App\Events\ReadMailEvent($user_id, $password));
|
\Event::fire(new \App\Events\ReadMailEvent($user_id, $password));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if ($auto_response == 0) {
|
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]);
|
$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 {
|
} else {
|
||||||
$body2 = null;
|
$body2 = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if ($auto_response == 0) {
|
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'],
|
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('0', $ticketdata->dept_id), $to = ['name' => $username, 'email' => $emailadd], $message = ['subject' => $updated_subject, 'scenario' => 'create-ticket'],
|
||||||
@@ -1265,6 +1265,7 @@ class TicketController extends Controller
|
|||||||
} else {
|
} else {
|
||||||
$from_email = $sending_emails->id;
|
$from_email = $sending_emails->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
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]);
|
$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) {
|
} catch (\Exception $e) {
|
||||||
@@ -1501,6 +1502,7 @@ class TicketController extends Controller
|
|||||||
$agent_email = $user_detail->email;
|
$agent_email = $user_detail->email;
|
||||||
$ticket_link = route('ticket.thread', $id);
|
$ticket_link = route('ticket.thread', $id);
|
||||||
$master = Auth::user()->first_name.' '.Auth::user()->last_name;
|
$master = Auth::user()->first_name.' '.Auth::user()->last_name;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('0', $ticket->dept_id), $to = ['name' => $agent, 'email' => $agent_email], $message = ['subject' => $ticket_subject.'[#'.$ticket_number.']', 'scenario' => 'assign-ticket'], $template_variables = ['ticket_agent_name' => $agent, 'ticket_number' => $ticket_number, 'ticket_assigner' => $master, 'ticket_link' => $ticket_link]);
|
$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) {
|
} catch (\Exception $e) {
|
||||||
@@ -1634,6 +1636,7 @@ class TicketController extends Controller
|
|||||||
$create_user->password = Hash::make($password);
|
$create_user->password = Hash::make($password);
|
||||||
$create_user->save();
|
$create_user->save();
|
||||||
$user_id = $create_user->id;
|
$user_id = $create_user->id;
|
||||||
|
|
||||||
try {
|
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]);
|
$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) {
|
} catch (\Exception $e) {
|
||||||
@@ -2321,6 +2324,7 @@ class TicketController extends Controller
|
|||||||
$user->role = 'user';
|
$user->role = 'user';
|
||||||
if ($user->save()) {
|
if ($user->save()) {
|
||||||
$user_id = $user->id;
|
$user_id = $user->id;
|
||||||
|
|
||||||
try {
|
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]);
|
$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) {
|
} catch (\Exception $e) {
|
||||||
|
@@ -298,6 +298,7 @@ class UserController extends Controller
|
|||||||
$password = $this->generateRandomString();
|
$password = $this->generateRandomString();
|
||||||
$user->password = Hash::make($password);
|
$user->password = Hash::make($password);
|
||||||
$user->role = 'user';
|
$user->role = 'user';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if ($request->get('country_code') == '' && ($request->get('phone_number') != '' || $request->get('mobile') != '')) {
|
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();
|
return redirect()->back()->with(['fails' => Lang::get('lang.country-code-required-error'), 'country_code_error' => 1])->withInput();
|
||||||
@@ -708,6 +709,7 @@ class UserController extends Controller
|
|||||||
public function getProfile()
|
public function getProfile()
|
||||||
{
|
{
|
||||||
$user = Auth::user();
|
$user = Auth::user();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return view('themes.default1.agent.helpdesk.user.profile', compact('user'));
|
return view('themes.default1.agent.helpdesk.user.profile', compact('user'));
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
@@ -727,6 +729,7 @@ class UserController extends Controller
|
|||||||
$phonecode = $code->where('iso', '=', $location->iso_code)->first();
|
$phonecode = $code->where('iso', '=', $location->iso_code)->first();
|
||||||
$settings = CommonSettings::select('status')->where('option_name', '=', 'send_otp')->first();
|
$settings = CommonSettings::select('status')->where('option_name', '=', 'send_otp')->first();
|
||||||
$status = $settings->status;
|
$status = $settings->status;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return view('themes.default1.agent.helpdesk.user.profile-edit', compact('user'))
|
return view('themes.default1.agent.helpdesk.user.profile-edit', compact('user'))
|
||||||
->with(['phonecode' => $phonecode->phonecode,
|
->with(['phonecode' => $phonecode->phonecode,
|
||||||
@@ -805,6 +808,7 @@ class UserController extends Controller
|
|||||||
// checking if the old password matches the new password
|
// checking if the old password matches the new password
|
||||||
if (Hash::check($request->input('old_password'), $user->getAuthPassword())) {
|
if (Hash::check($request->input('old_password'), $user->getAuthPassword())) {
|
||||||
$user->password = Hash::make($request->input('new_password'));
|
$user->password = Hash::make($request->input('new_password'));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$user->save();
|
$user->save();
|
||||||
|
|
||||||
|
@@ -51,6 +51,7 @@ class PageController extends Controller
|
|||||||
{
|
{
|
||||||
$pages = $this->page->paginate(3);
|
$pages = $this->page->paginate(3);
|
||||||
$pages->setPath('page');
|
$pages->setPath('page');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return view('themes.default1.agent.kb.pages.index', compact('pages'));
|
return view('themes.default1.agent.kb.pages.index', compact('pages'));
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
@@ -128,6 +129,7 @@ class PageController extends Controller
|
|||||||
$sl = $request->input('name');
|
$sl = $request->input('name');
|
||||||
$slug = str_slug($sl, '-');
|
$slug = str_slug($sl, '-');
|
||||||
$this->page->slug = $slug;
|
$this->page->slug = $slug;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->page->fill($request->input())->save();
|
$this->page->fill($request->input())->save();
|
||||||
|
|
||||||
@@ -169,6 +171,7 @@ class PageController extends Controller
|
|||||||
$pages = $this->page->where('slug', $slug)->first();
|
$pages = $this->page->where('slug', $slug)->first();
|
||||||
$sl = $request->input('name');
|
$sl = $request->input('name');
|
||||||
$slug = str_slug($sl, '-');
|
$slug = str_slug($sl, '-');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$pages->fill($request->all())->save();
|
$pages->fill($request->all())->save();
|
||||||
$pages->slug = $slug;
|
$pages->slug = $slug;
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -32,7 +32,6 @@ use Mail;
|
|||||||
*/
|
*/
|
||||||
class TicketController extends Controller
|
class TicketController extends Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new controller instance.
|
* Create a new controller instance.
|
||||||
*
|
*
|
||||||
@@ -58,19 +57,14 @@ class TicketController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function createTicket($user_id, $subject, $body, $helptopic, $sla, $priority, $source, $headers, $dept, $assignto, $form_data, $attach = '')
|
public function createTicket($user_id, $subject, $body, $helptopic, $sla, $priority, $source, $headers, $dept, $assignto, $form_data, $attach = '')
|
||||||
{
|
{
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
//return $headers;
|
//return $headers;
|
||||||
$max_number = Tickets::whereRaw('id = (select max(`id`) from tickets)')->first();
|
$max_number = Tickets::whereRaw('id = (select max(`id`) from tickets)')->first();
|
||||||
//dd($max_number);
|
//dd($max_number);
|
||||||
if ($max_number == null)
|
if ($max_number == null) {
|
||||||
{
|
|
||||||
$ticket_number = 'AAAA-9999-9999999';
|
$ticket_number = 'AAAA-9999-9999999';
|
||||||
}
|
} else {
|
||||||
else
|
foreach ($max_number as $number) {
|
||||||
{
|
|
||||||
foreach ($max_number as $number)
|
|
||||||
{
|
|
||||||
$ticket_number = $max_number->ticket_number;
|
$ticket_number = $max_number->ticket_number;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -89,16 +83,12 @@ class TicketController extends Controller
|
|||||||
//dd($ticket);
|
//dd($ticket);
|
||||||
$ticket_number = $ticket->ticket_number;
|
$ticket_number = $ticket->ticket_number;
|
||||||
$id = $ticket->id;
|
$id = $ticket->id;
|
||||||
if ($form_data != null)
|
if ($form_data != null) {
|
||||||
{
|
|
||||||
$help_topic = Help_topic::where('id', '=', $helptopic)->first();
|
$help_topic = Help_topic::where('id', '=', $helptopic)->first();
|
||||||
$forms = Fields::where('forms_id', '=', $help_topic->custom_form)->get();
|
$forms = Fields::where('forms_id', '=', $help_topic->custom_form)->get();
|
||||||
foreach ($form_data as $key => $form_details)
|
foreach ($form_data as $key => $form_details) {
|
||||||
{
|
foreach ($forms as $from) {
|
||||||
foreach ($forms as $from)
|
if ($from->name == $key) {
|
||||||
{
|
|
||||||
if ($from->name == $key)
|
|
||||||
{
|
|
||||||
$form_value = new Ticket_Form_Data();
|
$form_value = new Ticket_Form_Data();
|
||||||
$form_value->ticket_id = $id;
|
$form_value->ticket_id = $id;
|
||||||
$form_value->title = $from->label;
|
$form_value->title = $from->label;
|
||||||
@@ -112,15 +102,12 @@ class TicketController extends Controller
|
|||||||
$this->storeCollaborators($headers, $id);
|
$this->storeCollaborators($headers, $id);
|
||||||
|
|
||||||
$thread = $this->ticketThread($subject, $body, $id, $user_id);
|
$thread = $this->ticketThread($subject, $body, $id, $user_id);
|
||||||
if (!empty($attach))
|
if (!empty($attach)) {
|
||||||
{
|
|
||||||
$this->attach($thread, $attach);
|
$this->attach($thread, $attach);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $thread;
|
return $thread;
|
||||||
}
|
} catch (\Exception $e) {
|
||||||
catch (\Exception $e)
|
|
||||||
{
|
|
||||||
return $e->getMessage();
|
return $e->getMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -134,18 +121,14 @@ class TicketController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function storeCollaborators($headers, $id)
|
public function storeCollaborators($headers, $id)
|
||||||
{
|
{
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
//return $headers;
|
//return $headers;
|
||||||
$company = $this->company();
|
$company = $this->company();
|
||||||
if (isset($headers))
|
if (isset($headers)) {
|
||||||
{
|
foreach ($headers as $email) {
|
||||||
foreach ($headers as $email)
|
|
||||||
{
|
|
||||||
$name = $email;
|
$name = $email;
|
||||||
$email = $email;
|
$email = $email;
|
||||||
if ($this->checkEmail($email) == false)
|
if ($this->checkEmail($email) == false) {
|
||||||
{
|
|
||||||
$create_user = new User();
|
$create_user = new User();
|
||||||
$create_user->user_name = $name;
|
$create_user->user_name = $name;
|
||||||
$create_user->email = $email;
|
$create_user->email = $email;
|
||||||
@@ -160,9 +143,7 @@ class TicketController extends Controller
|
|||||||
// });
|
// });
|
||||||
|
|
||||||
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $name, 'email' => $email], $message = ['subject' => 'password', 'scenario' => 'registration-notification'], $template_variables = ['user' => $name, 'email_address' => $email, 'user_password' => $password]);
|
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $name, 'email' => $email], $message = ['subject' => 'password', 'scenario' => 'registration-notification'], $template_variables = ['user' => $name, 'email_address' => $email, 'user_password' => $password]);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$user = $this->checkEmail($email);
|
$user = $this->checkEmail($email);
|
||||||
$user_id = $user->id;
|
$user_id = $user->id;
|
||||||
}
|
}
|
||||||
@@ -177,9 +158,7 @@ class TicketController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
} catch (\Exception $e) {
|
||||||
catch (\Exception $e)
|
|
||||||
{
|
|
||||||
return $e->getMessage();
|
return $e->getMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -196,8 +175,7 @@ class TicketController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function ticketThread($subject, $body, $id, $user_id)
|
public function ticketThread($subject, $body, $id, $user_id)
|
||||||
{
|
{
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
$thread = new Ticket_Thread();
|
$thread = new Ticket_Thread();
|
||||||
$thread->user_id = $user_id;
|
$thread->user_id = $user_id;
|
||||||
$thread->ticket_id = $id;
|
$thread->ticket_id = $id;
|
||||||
@@ -207,9 +185,7 @@ class TicketController extends Controller
|
|||||||
$thread->save();
|
$thread->save();
|
||||||
|
|
||||||
return $thread->id;
|
return $thread->id;
|
||||||
}
|
} catch (\Exception $e) {
|
||||||
catch (\Exception $e)
|
|
||||||
{
|
|
||||||
return $e->getMessage();
|
return $e->getMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -223,24 +199,20 @@ class TicketController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function ticketNumber($ticket_number)
|
public function ticketNumber($ticket_number)
|
||||||
{
|
{
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
//dd($ticket_number);
|
//dd($ticket_number);
|
||||||
$number = $ticket_number;
|
$number = $ticket_number;
|
||||||
$number = explode('-', $number);
|
$number = explode('-', $number);
|
||||||
$number1 = $number[0];
|
$number1 = $number[0];
|
||||||
if ($number1 == 'ZZZZ')
|
if ($number1 == 'ZZZZ') {
|
||||||
{
|
|
||||||
$number1 = 'AAAA';
|
$number1 = 'AAAA';
|
||||||
}
|
}
|
||||||
$number2 = $number[1];
|
$number2 = $number[1];
|
||||||
if ($number2 == '9999')
|
if ($number2 == '9999') {
|
||||||
{
|
|
||||||
$number2 = '0000';
|
$number2 = '0000';
|
||||||
}
|
}
|
||||||
$number3 = $number[2];
|
$number3 = $number[2];
|
||||||
if ($number3 == '9999999')
|
if ($number3 == '9999999') {
|
||||||
{
|
|
||||||
$number3 = '0000000';
|
$number3 = '0000000';
|
||||||
}
|
}
|
||||||
$number1++;
|
$number1++;
|
||||||
@@ -252,9 +224,7 @@ class TicketController extends Controller
|
|||||||
$number = implode('-', $array);
|
$number = implode('-', $array);
|
||||||
|
|
||||||
return $number;
|
return $number;
|
||||||
}
|
} catch (\Exception $e) {
|
||||||
catch (\Exception $e)
|
|
||||||
{
|
|
||||||
dd($e);
|
dd($e);
|
||||||
|
|
||||||
return $e->getMessage();
|
return $e->getMessage();
|
||||||
@@ -270,20 +240,16 @@ class TicketController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function generateRandomString($length = 10)
|
public function generateRandomString($length = 10)
|
||||||
{
|
{
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||||
$charactersLength = strlen($characters);
|
$charactersLength = strlen($characters);
|
||||||
$randomString = '';
|
$randomString = '';
|
||||||
for ($i = 0; $i < $length; $i++)
|
for ($i = 0; $i < $length; $i++) {
|
||||||
{
|
|
||||||
$randomString .= $characters[rand(0, $charactersLength - 1)];
|
$randomString .= $characters[rand(0, $charactersLength - 1)];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $randomString;
|
return $randomString;
|
||||||
}
|
} catch (\Exception $e) {
|
||||||
catch (\Exception $e)
|
|
||||||
{
|
|
||||||
return $e->getMessage();
|
return $e->getMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -298,8 +264,7 @@ class TicketController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function reply($thread, $request, $ta, $attach = '')
|
public function reply($thread, $request, $ta, $attach = '')
|
||||||
{
|
{
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
$check_attachment = null;
|
$check_attachment = null;
|
||||||
$eventthread = $thread->where('ticket_id', $request->input('ticket_ID'))->first();
|
$eventthread = $thread->where('ticket_id', $request->input('ticket_ID'))->first();
|
||||||
//dd($request->input('ticket_ID'));
|
//dd($request->input('ticket_ID'));
|
||||||
@@ -324,8 +289,7 @@ class TicketController extends Controller
|
|||||||
|
|
||||||
$ticket_user = User::where('id', '=', $tickets->user_id)->first();
|
$ticket_user = User::where('id', '=', $tickets->user_id)->first();
|
||||||
|
|
||||||
if ($tickets->assigned_to == 0)
|
if ($tickets->assigned_to == 0) {
|
||||||
{
|
|
||||||
$tickets->assigned_to = Auth::user()->id;
|
$tickets->assigned_to = Auth::user()->id;
|
||||||
$tickets->save();
|
$tickets->save();
|
||||||
$thread2 = new Ticket_Thread();
|
$thread2 = new Ticket_Thread();
|
||||||
@@ -335,16 +299,14 @@ class TicketController extends Controller
|
|||||||
$thread2->body = 'This Ticket have been assigned to '.Auth::user()->first_name.' '.Auth::user()->last_name;
|
$thread2->body = 'This Ticket have been assigned to '.Auth::user()->first_name.' '.Auth::user()->last_name;
|
||||||
$thread2->save();
|
$thread2->save();
|
||||||
}
|
}
|
||||||
if ($tickets->status > 1)
|
if ($tickets->status > 1) {
|
||||||
{
|
|
||||||
$tickets->status = '1';
|
$tickets->status = '1';
|
||||||
$tickets->isanswered = '1';
|
$tickets->isanswered = '1';
|
||||||
$tickets->save();
|
$tickets->save();
|
||||||
}
|
}
|
||||||
$thread->save();
|
$thread->save();
|
||||||
|
|
||||||
if (!empty($attach))
|
if (!empty($attach)) {
|
||||||
{
|
|
||||||
$check_attachment = $this->attach($thread->id, $attach);
|
$check_attachment = $this->attach($thread->id, $attach);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -357,12 +319,9 @@ class TicketController extends Controller
|
|||||||
$ticket_number = $tickets->ticket_number;
|
$ticket_number = $tickets->ticket_number;
|
||||||
$company = $this->company();
|
$company = $this->company();
|
||||||
$username = $ticket_user->user_name;
|
$username = $ticket_user->user_name;
|
||||||
if (!empty(Auth::user()->agent_sign))
|
if (!empty(Auth::user()->agent_sign)) {
|
||||||
{
|
|
||||||
$agentsign = Auth::user()->agent_sign;
|
$agentsign = Auth::user()->agent_sign;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$agentsign = null;
|
$agentsign = null;
|
||||||
}
|
}
|
||||||
\Event::fire(new \App\Events\FaveoAfterReply($reply_content, $user->phone_number, $request, $tickets));
|
\Event::fire(new \App\Events\FaveoAfterReply($reply_content, $user->phone_number, $request, $tickets));
|
||||||
@@ -382,29 +341,22 @@ class TicketController extends Controller
|
|||||||
* Getting the subject of the thread
|
* Getting the subject of the thread
|
||||||
*/
|
*/
|
||||||
//dd($eventthread);
|
//dd($eventthread);
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
$re = $this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('0', $tickets->dept_id), $to = ['name' => $user_name, 'email' => $email], $message = ['subject' => $eventthread->title, 'scenario' => 'create-ticket-by-agent', 'body' => $thread->body], $template_variables = ['agent_sign' => Auth::user()->agent_sign, 'ticket_number' => $tickets->number]);
|
$re = $this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('0', $tickets->dept_id), $to = ['name' => $user_name, 'email' => $email], $message = ['subject' => $eventthread->title, 'scenario' => 'create-ticket-by-agent', 'body' => $thread->body], $template_variables = ['agent_sign' => Auth::user()->agent_sign, 'ticket_number' => $tickets->number]);
|
||||||
//dd($re);
|
//dd($re);
|
||||||
}
|
} catch (\Exception $e) {
|
||||||
catch (\Exception $e)
|
|
||||||
{
|
|
||||||
//throw new \Exception($e->getMessage());
|
//throw new \Exception($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
$collaborators = Ticket_Collaborator::where('ticket_id', '=', $ticket_id)->get();
|
$collaborators = Ticket_Collaborator::where('ticket_id', '=', $ticket_id)->get();
|
||||||
foreach ($collaborators as $collaborator)
|
foreach ($collaborators as $collaborator) {
|
||||||
{
|
|
||||||
//mail to collaborators
|
//mail to collaborators
|
||||||
$collab_user_id = $collaborator->user_id;
|
$collab_user_id = $collaborator->user_id;
|
||||||
$user_id_collab = User::where('id', '=', $collab_user_id)->first();
|
$user_id_collab = User::where('id', '=', $collab_user_id)->first();
|
||||||
$collab_email = $user_id_collab->email;
|
$collab_email = $user_id_collab->email;
|
||||||
if ($user_id_collab->role == 'user')
|
if ($user_id_collab->role == 'user') {
|
||||||
{
|
|
||||||
$collab_user_name = $user_id_collab->user_name;
|
$collab_user_name = $user_id_collab->user_name;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$collab_user_name = $user_id_collab->first_name.' '.$user_id_collab->last_name;
|
$collab_user_name = $user_id_collab->first_name.' '.$user_id_collab->last_name;
|
||||||
}
|
}
|
||||||
// Mail::send('emails.ticket_re-reply', ['content' => $reply_content, 'ticket_number' => $ticket_number, 'From' => $company, 'name' => $collab_user_name, 'Agent_Signature' => $agentsign], function ($message) use ($collab_email, $collab_user_name, $ticket_number, $ticket_subject, $check_attachment) {
|
// Mail::send('emails.ticket_re-reply', ['content' => $reply_content, 'ticket_number' => $ticket_number, 'From' => $company, 'name' => $collab_user_name, 'Agent_Signature' => $agentsign], function ($message) use ($collab_email, $collab_user_name, $ticket_number, $ticket_subject, $check_attachment) {
|
||||||
@@ -417,20 +369,14 @@ class TicketController extends Controller
|
|||||||
// // }
|
// // }
|
||||||
// }, true);
|
// }, true);
|
||||||
|
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('0', $ticketdata->dept_id), $to = ['user' => $admin_user, 'email' => $admin_email], $message = ['subject' => $updated_subject, 'body' => $body, 'scenario' => $mail], $template_variables = ['ticket_agent_name' => $admin_user, 'ticket_client_name' => $username, 'ticket_client_email' => $emailadd, 'user' => $admin_user, 'ticket_number' => $ticket_number2, 'email_address' => $emailadd, 'name' => $ticket_creator]);
|
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('0', $ticketdata->dept_id), $to = ['user' => $admin_user, 'email' => $admin_email], $message = ['subject' => $updated_subject, 'body' => $body, 'scenario' => $mail], $template_variables = ['ticket_agent_name' => $admin_user, 'ticket_client_name' => $username, 'ticket_client_email' => $emailadd, 'user' => $admin_user, 'ticket_number' => $ticket_number2, 'email_address' => $emailadd, 'name' => $ticket_creator]);
|
||||||
}
|
} catch (\Exception $e) {
|
||||||
catch (\Exception $e)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $thread;
|
return $thread;
|
||||||
}
|
} catch (\Exception $e) {
|
||||||
catch (\Exception $e)
|
|
||||||
{
|
|
||||||
//dd($e);
|
//dd($e);
|
||||||
return $e->getMessage();
|
return $e->getMessage();
|
||||||
}
|
}
|
||||||
@@ -443,22 +389,16 @@ class TicketController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function company()
|
public function company()
|
||||||
{
|
{
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
$company = Company::Where('id', '=', '1')->first();
|
$company = Company::Where('id', '=', '1')->first();
|
||||||
if ($company->company_name == null)
|
if ($company->company_name == null) {
|
||||||
{
|
|
||||||
$company = 'Support Center';
|
$company = 'Support Center';
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$company = $company->company_name;
|
$company = $company->company_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $company;
|
return $company;
|
||||||
}
|
} catch (\Exception $e) {
|
||||||
catch (\Exception $e)
|
|
||||||
{
|
|
||||||
return $e->getMessage();
|
return $e->getMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -473,8 +413,7 @@ class TicketController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function ticketEditPost($ticket_id, $thread, $ticket)
|
public function ticketEditPost($ticket_id, $thread, $ticket)
|
||||||
{
|
{
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
$ticket = $ticket->where('id', '=', $ticket_id)->first();
|
$ticket = $ticket->where('id', '=', $ticket_id)->first();
|
||||||
|
|
||||||
$ticket->sla = Input::get('sla_plan');
|
$ticket->sla = Input::get('sla_plan');
|
||||||
@@ -487,13 +426,13 @@ class TicketController extends Controller
|
|||||||
$threads = $thread->where('ticket_id', '=', $ticket_id)->first();
|
$threads = $thread->where('ticket_id', '=', $ticket_id)->first();
|
||||||
$threads->title = Input::get('subject');
|
$threads->title = Input::get('subject');
|
||||||
$threads->save();
|
$threads->save();
|
||||||
}
|
} catch (\Exception $ex) {
|
||||||
catch (\Exception $ex)
|
|
||||||
{
|
|
||||||
$result = $ex->getMessage();
|
$result = $ex->getMessage();
|
||||||
|
|
||||||
return response()->json(compact('result'), 500);
|
return response()->json(compact('result'), 500);
|
||||||
}
|
}
|
||||||
$result = ["success" => "Edited successfully"];
|
$result = ['success' => 'Edited successfully'];
|
||||||
|
|
||||||
return response()->json(compact('result'));
|
return response()->json(compact('result'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -506,28 +445,24 @@ class TicketController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function assign($id)
|
public function assign($id)
|
||||||
{
|
{
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
$UserEmail = Input::get('user');
|
$UserEmail = Input::get('user');
|
||||||
//dd($UserEmail);
|
//dd($UserEmail);
|
||||||
// $UserEmail = 'sujitprasad12@yahoo.in';
|
// $UserEmail = 'sujitprasad12@yahoo.in';
|
||||||
$user = User::where('email', '=', $UserEmail)->first();
|
$user = User::where('email', '=', $UserEmail)->first();
|
||||||
if (!$user)
|
if (!$user) {
|
||||||
{
|
|
||||||
return ['error' => 'No agent not found'];
|
return ['error' => 'No agent not found'];
|
||||||
}
|
}
|
||||||
$user_id = $user->id;
|
$user_id = $user->id;
|
||||||
$ticket = Tickets::where('id', '=', $id)->first();
|
$ticket = Tickets::where('id', '=', $id)->first();
|
||||||
if (!$ticket)
|
if (!$ticket) {
|
||||||
{
|
|
||||||
return ['error' => 'No ticket not found'];
|
return ['error' => 'No ticket not found'];
|
||||||
}
|
}
|
||||||
$ticket_number = $ticket->ticket_number;
|
$ticket_number = $ticket->ticket_number;
|
||||||
$ticket->assigned_to = $user_id;
|
$ticket->assigned_to = $user_id;
|
||||||
$ticket->save();
|
$ticket->save();
|
||||||
$ticket_thread = Ticket_Thread::where('ticket_id', '=', $id)->first();
|
$ticket_thread = Ticket_Thread::where('ticket_id', '=', $id)->first();
|
||||||
if (!$ticket_thread)
|
if (!$ticket_thread) {
|
||||||
{
|
|
||||||
return ['error' => 'No thread not found'];
|
return ['error' => 'No thread not found'];
|
||||||
}
|
}
|
||||||
$ticket_subject = $ticket_thread->title;
|
$ticket_subject = $ticket_thread->title;
|
||||||
@@ -545,27 +480,21 @@ class TicketController extends Controller
|
|||||||
$agent_email = $user->email;
|
$agent_email = $user->email;
|
||||||
|
|
||||||
$master = Auth::user()->first_name.' '.Auth::user()->last_name;
|
$master = Auth::user()->first_name.' '.Auth::user()->last_name;
|
||||||
if (Alert::first()->internal_status == 1 || Alert::first()->internal_assigned_agent == 1)
|
if (Alert::first()->internal_status == 1 || Alert::first()->internal_assigned_agent == 1) {
|
||||||
{
|
|
||||||
// // ticket assigned send mail
|
// // ticket assigned send mail
|
||||||
// Mail::send('emails.Ticket_assign', ['agent' => $agent, 'ticket_number' => $ticket_number, 'from' => $company, 'master' => $master, 'system' => $system], function ($message) use ($agent_email, $agent, $ticket_number, $ticket_subject) {
|
// Mail::send('emails.Ticket_assign', ['agent' => $agent, 'ticket_number' => $ticket_number, 'from' => $company, 'master' => $master, 'system' => $system], function ($message) use ($agent_email, $agent, $ticket_number, $ticket_subject) {
|
||||||
// $message->to($agent_email, $agent)->subject($ticket_subject . '[#' . $ticket_number . ']');
|
// $message->to($agent_email, $agent)->subject($ticket_subject . '[#' . $ticket_number . ']');
|
||||||
// });
|
// });
|
||||||
|
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('0', $ticket->dept_id), $to = ['name' => $agent, 'email' => $agent_email], $message = ['subject' => $ticket_subject.'[#'.$ticket_number.']', 'scenario' => 'assign-ticket'], $template_variables = ['ticket_agent_name' => $agent, 'ticket_number' => $ticket_number, 'ticket_assigner' => $master]);
|
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('0', $ticket->dept_id), $to = ['name' => $agent, 'email' => $agent_email], $message = ['subject' => $ticket_subject.'[#'.$ticket_number.']', 'scenario' => 'assign-ticket'], $template_variables = ['ticket_agent_name' => $agent, 'ticket_number' => $ticket_number, 'ticket_assigner' => $master]);
|
||||||
}
|
} catch (\Exception $e) {
|
||||||
catch (\Exception $e)
|
|
||||||
{
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
} catch (\Exception $e) {
|
||||||
catch (\Exception $e)
|
|
||||||
{
|
|
||||||
return $e->getMessage();
|
return $e->getMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -580,41 +509,29 @@ class TicketController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function delete($ids, $ticket)
|
public function delete($ids, $ticket)
|
||||||
{
|
{
|
||||||
try
|
try {
|
||||||
{
|
foreach ($ids as $id) {
|
||||||
foreach ($ids as $id)
|
|
||||||
{
|
|
||||||
$ticket_delete = $ticket->where('id', '=', $id)->first();
|
$ticket_delete = $ticket->where('id', '=', $id)->first();
|
||||||
if ($ticket_delete)
|
if ($ticket_delete) {
|
||||||
{
|
if ($ticket_delete->status == 5) {
|
||||||
if ($ticket_delete->status == 5)
|
|
||||||
{
|
|
||||||
$ticket_delete->delete();
|
$ticket_delete->delete();
|
||||||
$ticket_threads = Ticket_Thread::where('ticket_id', '=', $id)->get();
|
$ticket_threads = Ticket_Thread::where('ticket_id', '=', $id)->get();
|
||||||
if ($ticket_threads)
|
if ($ticket_threads) {
|
||||||
{
|
foreach ($ticket_threads as $ticket_thread) {
|
||||||
foreach ($ticket_threads as $ticket_thread)
|
if ($ticket_thread) {
|
||||||
{
|
|
||||||
if ($ticket_thread)
|
|
||||||
{
|
|
||||||
$ticket_thread->delete();
|
$ticket_thread->delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$ticket_attachments = Ticket_attachments::where('thread_id', '=', $id)->get();
|
$ticket_attachments = Ticket_attachments::where('thread_id', '=', $id)->get();
|
||||||
if ($ticket_attachments)
|
if ($ticket_attachments) {
|
||||||
{
|
foreach ($ticket_attachments as $ticket_attachment) {
|
||||||
foreach ($ticket_attachments as $ticket_attachment)
|
if ($ticket_attachment) {
|
||||||
{
|
|
||||||
if ($ticket_attachment)
|
|
||||||
{
|
|
||||||
$ticket_attachment->delete();
|
$ticket_attachment->delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$ticket_delete->is_deleted = 0;
|
$ticket_delete->is_deleted = 0;
|
||||||
$ticket_delete->status = 5;
|
$ticket_delete->status = 5;
|
||||||
$ticket_delete->save();
|
$ticket_delete->save();
|
||||||
@@ -626,17 +543,13 @@ class TicketController extends Controller
|
|||||||
$thread->body = $ticket_status_message->message.' '.Auth::user()->first_name.' '.Auth::user()->last_name;
|
$thread->body = $ticket_status_message->message.' '.Auth::user()->first_name.' '.Auth::user()->last_name;
|
||||||
$thread->save();
|
$thread->save();
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return 'ticket not found';
|
return 'ticket not found';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 'your tickets has been deleted';
|
return 'your tickets has been deleted';
|
||||||
}
|
} catch (\Exception $e) {
|
||||||
catch (\Exception $e)
|
|
||||||
{
|
|
||||||
return $e->getMessage();
|
return $e->getMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -650,20 +563,14 @@ class TicketController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function checkEmail($email)
|
public function checkEmail($email)
|
||||||
{
|
{
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
$check = User::where('email', '=', $email)->first();
|
$check = User::where('email', '=', $email)->first();
|
||||||
if ($check)
|
if ($check) {
|
||||||
{
|
|
||||||
return $check;
|
return $check;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
} catch (\Exception $e) {
|
||||||
catch (\Exception $e)
|
|
||||||
{
|
|
||||||
return $e->getMessage();
|
return $e->getMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -675,22 +582,16 @@ class TicketController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function system()
|
public function system()
|
||||||
{
|
{
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
$system = System::Where('id', '=', '1')->first();
|
$system = System::Where('id', '=', '1')->first();
|
||||||
if ($system->name == null)
|
if ($system->name == null) {
|
||||||
{
|
|
||||||
$system = 'Support Center';
|
$system = 'Support Center';
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$system = $system->name;
|
$system = $system->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $system;
|
return $system;
|
||||||
}
|
} catch (\Exception $e) {
|
||||||
catch (\Exception $e)
|
|
||||||
{
|
|
||||||
return $e->getMessage();
|
return $e->getMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -705,19 +606,15 @@ class TicketController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function attach($thread, $attach)
|
public function attach($thread, $attach)
|
||||||
{
|
{
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
$ta = new Ticket_attachments();
|
$ta = new Ticket_attachments();
|
||||||
foreach ($attach as $file)
|
foreach ($attach as $file) {
|
||||||
{
|
|
||||||
$ta->create(['thread_id' => $thread, 'name' => $file['name'], 'size' => $file['size'], 'type' => $file['type'], 'file' => $file['file'], 'poster' => 'ATTACHMENT']);
|
$ta->create(['thread_id' => $thread, 'name' => $file['name'], 'size' => $file['size'], 'type' => $file['type'], 'file' => $file['file'], 'poster' => 'ATTACHMENT']);
|
||||||
}
|
}
|
||||||
$ta->create(['thread_id' => $thread, 'name' => $name, 'size' => $size, 'type' => $type, 'file' => $file, 'poster' => 'ATTACHMENT']);
|
$ta->create(['thread_id' => $thread, 'name' => $name, 'size' => $size, 'type' => $type, 'file' => $file, 'poster' => 'ATTACHMENT']);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
} catch (\Exception $e) {
|
||||||
catch (\Exception $e)
|
|
||||||
{
|
|
||||||
return $e->getMessage();
|
return $e->getMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -754,8 +651,7 @@ class TicketController extends Controller
|
|||||||
$user->password = \Hash::make($password);
|
$user->password = \Hash::make($password);
|
||||||
$user->role = 'user';
|
$user->role = 'user';
|
||||||
$user->active = 1;
|
$user->active = 1;
|
||||||
if ($user->save())
|
if ($user->save()) {
|
||||||
{
|
|
||||||
$user_id = $user->id;
|
$user_id = $user->id;
|
||||||
$php_mailer = new PhpMailController();
|
$php_mailer = new PhpMailController();
|
||||||
$php_mailer->sendmail($from = $php_mailer->mailfrom('1', '0'), $to = ['name' => $email, 'email' => $email], $message = ['subject' => 'Password', 'scenario' => 'registration-notification'], $template_variables = ['user' => $email, 'email_address' => $email, 'user_password' => $password]);
|
$php_mailer->sendmail($from = $php_mailer->mailfrom('1', '0'), $to = ['name' => $email, 'email' => $email], $message = ['subject' => 'Password', 'scenario' => 'registration-notification'], $template_variables = ['user' => $email, 'email_address' => $email, 'user_password' => $password]);
|
||||||
@@ -786,77 +682,60 @@ class TicketController extends Controller
|
|||||||
$ticket_collaborator = Ticket_Collaborator::where('ticket_id', '=', $ticketid)
|
$ticket_collaborator = Ticket_Collaborator::where('ticket_id', '=', $ticketid)
|
||||||
->where('user_id', $user->id)
|
->where('user_id', $user->id)
|
||||||
->first();
|
->first();
|
||||||
if ($ticket_collaborator)
|
if ($ticket_collaborator) {
|
||||||
{
|
|
||||||
$ticket_collaborator->delete();
|
$ticket_collaborator->delete();
|
||||||
|
|
||||||
return 'deleted successfully';
|
return 'deleted successfully';
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return 'not found';
|
return 'not found';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCollaboratorForTicket()
|
public function getCollaboratorForTicket()
|
||||||
{
|
{
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
$ticketid = Input::get('ticket_id');
|
$ticketid = Input::get('ticket_id');
|
||||||
|
|
||||||
$ticket_collaborator = \DB::table('users')
|
$ticket_collaborator = \DB::table('users')
|
||||||
->join('ticket_collaborator', function ($join) use ($ticketid)
|
->join('ticket_collaborator', function ($join) use ($ticketid) {
|
||||||
{
|
|
||||||
$join->on('users.id', '=', 'ticket_collaborator.user_id')
|
$join->on('users.id', '=', 'ticket_collaborator.user_id')
|
||||||
->where('ticket_collaborator.ticket_id', '=', $ticketid);
|
->where('ticket_collaborator.ticket_id', '=', $ticketid);
|
||||||
})
|
})
|
||||||
->select('users.email', 'users.user_name')
|
->select('users.email', 'users.user_name')
|
||||||
->get();
|
->get();
|
||||||
if (count($ticket_collaborator) > 0)
|
if (count($ticket_collaborator) > 0) {
|
||||||
{
|
foreach ($ticket_collaborator as $key => $collaborator) {
|
||||||
foreach ($ticket_collaborator as $key => $collaborator)
|
|
||||||
{
|
|
||||||
$collab[$key]['email'] = $collaborator->email;
|
$collab[$key]['email'] = $collaborator->email;
|
||||||
$collab[$key]['user_name'] = $collaborator->user_name;
|
$collab[$key]['user_name'] = $collaborator->user_name;
|
||||||
$collab[$key]['avatar'] = $this->avatarUrl($collaborator->email);
|
$collab[$key]['avatar'] = $this->avatarUrl($collaborator->email);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$collab = $ticket_collaborator;
|
$collab = $ticket_collaborator;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $collab;
|
return $collab;
|
||||||
}
|
} catch (\Exception $ex) {
|
||||||
catch (\Exception $ex)
|
|
||||||
{
|
|
||||||
return $ex->getMessage();
|
return $ex->getMessage();
|
||||||
|
|
||||||
throw new \Exception('get collaborator for ticket fails');
|
throw new \Exception('get collaborator for ticket fails');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function avatarUrl($email)
|
public function avatarUrl($email)
|
||||||
{
|
{
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
$user = new User();
|
$user = new User();
|
||||||
$user = $user->where('email', $email)->first();
|
$user = $user->where('email', $email)->first();
|
||||||
if ($user->profile_pic)
|
if ($user->profile_pic) {
|
||||||
{
|
|
||||||
$url = url('uploads/profilepic/'.$user->profile_pic);
|
$url = url('uploads/profilepic/'.$user->profile_pic);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$url = \Gravatar::src($email);
|
$url = \Gravatar::src($email);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $url;
|
return $url;
|
||||||
}
|
} catch (\Exception $ex) {
|
||||||
catch (\Exception $ex)
|
|
||||||
{
|
|
||||||
//return $ex->getMessage();
|
//return $ex->getMessage();
|
||||||
throw new \Exception($ex->getMessage());
|
throw new \Exception($ex->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -38,7 +38,6 @@ use Socialite;
|
|||||||
*/
|
*/
|
||||||
class AuthController extends Controller
|
class AuthController extends Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
use AuthenticatesAndRegistersUsers;
|
use AuthenticatesAndRegistersUsers;
|
||||||
/* to redirect after login */
|
/* to redirect after login */
|
||||||
|
|
||||||
@@ -69,8 +68,7 @@ class AuthController extends Controller
|
|||||||
|
|
||||||
public function redirectToProvider($provider, $redirect = '')
|
public function redirectToProvider($provider, $redirect = '')
|
||||||
{
|
{
|
||||||
if ($redirect !== '')
|
if ($redirect !== '') {
|
||||||
{
|
|
||||||
$this->setSession($provider, $redirect);
|
$this->setSession($provider, $redirect);
|
||||||
}
|
}
|
||||||
//dd(\Config::get('services'));
|
//dd(\Config::get('services'));
|
||||||
@@ -81,23 +79,19 @@ class AuthController extends Controller
|
|||||||
|
|
||||||
public function handleProviderCallback($provider)
|
public function handleProviderCallback($provider)
|
||||||
{
|
{
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
//notice we are not doing any validation, you should do it
|
//notice we are not doing any validation, you should do it
|
||||||
$this->changeRedirect();
|
$this->changeRedirect();
|
||||||
|
|
||||||
$user = Socialite::driver($provider)->user();
|
$user = Socialite::driver($provider)->user();
|
||||||
if ($user)
|
if ($user) {
|
||||||
{
|
|
||||||
// stroing data to our use table and logging them in
|
// stroing data to our use table and logging them in
|
||||||
$username = $user->getEmail();
|
$username = $user->getEmail();
|
||||||
$first_name = $user->getName();
|
$first_name = $user->getName();
|
||||||
if ($user->nickname)
|
if ($user->nickname) {
|
||||||
{
|
|
||||||
$username = $user->nickname;
|
$username = $user->nickname;
|
||||||
}
|
}
|
||||||
if (!$first_name)
|
if (!$first_name) {
|
||||||
{
|
|
||||||
$first_name = $username;
|
$first_name = $username;
|
||||||
}
|
}
|
||||||
$data = [
|
$data = [
|
||||||
@@ -108,21 +102,17 @@ class AuthController extends Controller
|
|||||||
'active' => 1,
|
'active' => 1,
|
||||||
];
|
];
|
||||||
$user = User::where('email', $data['email'])->first();
|
$user = User::where('email', $data['email'])->first();
|
||||||
if (!$user)
|
if (!$user) {
|
||||||
{
|
|
||||||
$user = User::where('user_name', $data['user_name'])->first();
|
$user = User::where('user_name', $data['user_name'])->first();
|
||||||
}
|
}
|
||||||
if (!$user)
|
if (!$user) {
|
||||||
{
|
|
||||||
$user = User::firstOrCreate($data);
|
$user = User::firstOrCreate($data);
|
||||||
}
|
}
|
||||||
Auth::login($user);
|
Auth::login($user);
|
||||||
}
|
}
|
||||||
//after login redirecting to home page
|
//after login redirecting to home page
|
||||||
return redirect('/');
|
return redirect('/');
|
||||||
}
|
} catch (\Exception $ex) {
|
||||||
catch (\Exception $ex)
|
|
||||||
{
|
|
||||||
return redirect()->back()->with('fails', $ex->getMessage());
|
return redirect()->back()->with('fails', $ex->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -139,19 +129,13 @@ class AuthController extends Controller
|
|||||||
$email_mandatory = $settings->select('status')->where('option_name', '=', 'email_mandatory')->first();
|
$email_mandatory = $settings->select('status')->where('option_name', '=', 'email_mandatory')->first();
|
||||||
//dd($settings->status);
|
//dd($settings->status);
|
||||||
\Event::fire(new \App\Events\FormRegisterEvent());
|
\Event::fire(new \App\Events\FormRegisterEvent());
|
||||||
if (Auth::user())
|
if (Auth::user()) {
|
||||||
{
|
if (Auth::user()->role == 'admin' || Auth::user()->role == 'agent') {
|
||||||
if (Auth::user()->role == 'admin' || Auth::user()->role == 'agent')
|
|
||||||
{
|
|
||||||
return \Redirect::route('dashboard');
|
return \Redirect::route('dashboard');
|
||||||
}
|
} elseif (Auth::user()->role == 'user') {
|
||||||
elseif (Auth::user()->role == 'user')
|
|
||||||
{
|
|
||||||
// return view('auth.register');
|
// return view('auth.register');
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return view('auth.register', compact('settings', 'email_mandatory'));
|
return view('auth.register', compact('settings', 'email_mandatory'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -167,43 +151,30 @@ class AuthController extends Controller
|
|||||||
public function postRegister(User $user, RegisterRequest $request, $api = false)
|
public function postRegister(User $user, RegisterRequest $request, $api = false)
|
||||||
{
|
{
|
||||||
//dd($request->all());
|
//dd($request->all());
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
$request_array = $request->input();
|
$request_array = $request->input();
|
||||||
$password = Hash::make($request->input('password'));
|
$password = Hash::make($request->input('password'));
|
||||||
$user->password = $password;
|
$user->password = $password;
|
||||||
$name = $request->input('full_name');
|
$name = $request->input('full_name');
|
||||||
$user->first_name = $name;
|
$user->first_name = $name;
|
||||||
if ($request_array['email'] == '')
|
if ($request_array['email'] == '') {
|
||||||
{
|
|
||||||
$user->email = null;
|
$user->email = null;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$user->email = $request->input('email');
|
$user->email = $request->input('email');
|
||||||
}
|
}
|
||||||
if (!checkArray('mobile', $request_array))
|
if (!checkArray('mobile', $request_array)) {
|
||||||
{
|
|
||||||
$user->mobile = null;
|
$user->mobile = null;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$user->mobile = $request->input('mobile');
|
$user->mobile = $request->input('mobile');
|
||||||
}
|
}
|
||||||
if (!checkArray('code', $request_array))
|
if (!checkArray('code', $request_array)) {
|
||||||
{
|
|
||||||
$user->country_code = 0;
|
$user->country_code = 0;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$user->country_code = $request->input('code');
|
$user->country_code = $request->input('code');
|
||||||
}
|
}
|
||||||
if (checkArray('username', $request_array))
|
if (checkArray('username', $request_array)) {
|
||||||
{
|
|
||||||
$user->user_name = checkArray('username', $request_array);
|
$user->user_name = checkArray('username', $request_array);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$user->user_name = $request->input('email');
|
$user->user_name = $request->input('email');
|
||||||
}
|
}
|
||||||
$user->role = 'user';
|
$user->role = 'user';
|
||||||
@@ -215,51 +186,36 @@ class AuthController extends Controller
|
|||||||
$sms = Plugin::select('status')->where('name', '=', 'SMS')->first();
|
$sms = Plugin::select('status')->where('name', '=', 'SMS')->first();
|
||||||
// Event for login
|
// Event for login
|
||||||
\Event::fire(new \App\Events\LoginEvent($request));
|
\Event::fire(new \App\Events\LoginEvent($request));
|
||||||
if ($request->input('email') !== '')
|
if ($request->input('email') !== '') {
|
||||||
{
|
|
||||||
$var = $this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $name, 'email' => $request->input('email')], $message = ['subject' => null, 'scenario' => 'registration'], $template_variables = ['user' => $name, 'email_address' => $request->input('email'), 'password_reset_link' => url('account/activate/'.$code)]);
|
$var = $this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $name, 'email' => $request->input('email')], $message = ['subject' => null, 'scenario' => 'registration'], $template_variables = ['user' => $name, 'email_address' => $request->input('email'), 'password_reset_link' => url('account/activate/'.$code)]);
|
||||||
}
|
}
|
||||||
if ($settings->status == 1 || $settings->status == '1')
|
if ($settings->status == 1 || $settings->status == '1') {
|
||||||
{
|
if (count($sms) > 0) {
|
||||||
if (count($sms) > 0)
|
if ($sms->status == 1 || $sms->status == '1') {
|
||||||
{
|
|
||||||
if ($sms->status == 1 || $sms->status == '1')
|
|
||||||
{
|
|
||||||
$message12 = Lang::get('lang.activate_your_account_click_on_Link_that_send_to_your_mail_and_moble');
|
$message12 = Lang::get('lang.activate_your_account_click_on_Link_that_send_to_your_mail_and_moble');
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$message12 = Lang::get('lang.activate_your_account_click_on_Link_that_send_to_your_mail_sms_plugin_inactive_or_not_setup');
|
$message12 = Lang::get('lang.activate_your_account_click_on_Link_that_send_to_your_mail_sms_plugin_inactive_or_not_setup');
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
if ($request->input('email') !== '') {
|
||||||
{
|
|
||||||
if ($request->input('email') !== '')
|
|
||||||
{
|
|
||||||
$message12 = Lang::get('lang.activate_your_account_click_on_Link_that_send_to_your_mail');
|
$message12 = Lang::get('lang.activate_your_account_click_on_Link_that_send_to_your_mail');
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$message12 = Lang::get('lang.account-created-contact-admin-as-we-were-not-able-to-send-opt');
|
$message12 = Lang::get('lang.account-created-contact-admin-as-we-were-not-able-to-send-opt');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$message12 = Lang::get('lang.activate_your_account_click_on_Link_that_send_to_your_mail');
|
$message12 = Lang::get('lang.activate_your_account_click_on_Link_that_send_to_your_mail');
|
||||||
}
|
}
|
||||||
if ($api == true)
|
if ($api == true) {
|
||||||
{
|
|
||||||
return ['message' => $message12, 'user' => $user->toArray()];
|
return ['message' => $message12, 'user' => $user->toArray()];
|
||||||
}
|
}
|
||||||
|
|
||||||
return redirect('home')->with('success', $message12);
|
return redirect('home')->with('success', $message12);
|
||||||
}
|
} catch (\Exception $e) {
|
||||||
catch (\Exception $e)
|
if ($api == true) {
|
||||||
{
|
|
||||||
if ($api == true)
|
|
||||||
{
|
|
||||||
throw new \Exception($e->getMessage());
|
throw new \Exception($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return redirect()->back()->with('fails', $e->getMessage());
|
return redirect()->back()->with('fails', $e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -274,17 +230,14 @@ class AuthController extends Controller
|
|||||||
public function accountActivate($token)
|
public function accountActivate($token)
|
||||||
{
|
{
|
||||||
$user = User::where('remember_token', '=', $token)->first();
|
$user = User::where('remember_token', '=', $token)->first();
|
||||||
if ($user)
|
if ($user) {
|
||||||
{
|
|
||||||
$user->active = 1;
|
$user->active = 1;
|
||||||
$user->remember_token = null;
|
$user->remember_token = null;
|
||||||
$user->save();
|
$user->save();
|
||||||
$this->openTicketAfterVerification($user->id);
|
$this->openTicketAfterVerification($user->id);
|
||||||
|
|
||||||
return redirect('/auth/login')->with('status', 'Acount activated. Login to start');
|
return redirect('/auth/login')->with('status', 'Acount activated. Login to start');
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return redirect('/auth/login')->with('fails', 'Invalid Token');
|
return redirect('/auth/login')->with('fails', 'Invalid Token');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -300,15 +253,12 @@ class AuthController extends Controller
|
|||||||
public function getMail($token, User $user)
|
public function getMail($token, User $user)
|
||||||
{
|
{
|
||||||
$user = $user->where('remember_token', $token)->where('active', 0)->first();
|
$user = $user->where('remember_token', $token)->where('active', 0)->first();
|
||||||
if ($user)
|
if ($user) {
|
||||||
{
|
|
||||||
$user->active = 1;
|
$user->active = 1;
|
||||||
$user->save();
|
$user->save();
|
||||||
|
|
||||||
return redirect('auth/login');
|
return redirect('auth/login');
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return redirect('auth/login');
|
return redirect('auth/login');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -321,26 +271,17 @@ class AuthController extends Controller
|
|||||||
public function getLogin()
|
public function getLogin()
|
||||||
{
|
{
|
||||||
$directory = base_path();
|
$directory = base_path();
|
||||||
if (file_exists($directory . DIRECTORY_SEPARATOR . '.env'))
|
if (file_exists($directory.DIRECTORY_SEPARATOR.'.env')) {
|
||||||
{
|
if (Auth::user()) {
|
||||||
if (Auth::user())
|
if (Auth::user()->role == 'admin' || Auth::user()->role == 'agent') {
|
||||||
{
|
|
||||||
if (Auth::user()->role == 'admin' || Auth::user()->role == 'agent')
|
|
||||||
{
|
|
||||||
return \Redirect::route('dashboard');
|
return \Redirect::route('dashboard');
|
||||||
}
|
} elseif (Auth::user()->role == 'user') {
|
||||||
elseif (Auth::user()->role == 'user')
|
|
||||||
{
|
|
||||||
return \Redirect::route('home');
|
return \Redirect::route('home');
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return view('auth.login');
|
return view('auth.login');
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return Redirect::route('licence');
|
return Redirect::route('licence');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -354,20 +295,16 @@ class AuthController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function postLogin(LoginRequest $request)
|
public function postLogin(LoginRequest $request)
|
||||||
{
|
{
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
// dd($request->input());
|
// dd($request->input());
|
||||||
\Event::fire('auth.login.event', []); //added 5/5/2016
|
\Event::fire('auth.login.event', []); //added 5/5/2016
|
||||||
// Set login attempts and login time
|
// Set login attempts and login time
|
||||||
$value = $_SERVER['REMOTE_ADDR'];
|
$value = $_SERVER['REMOTE_ADDR'];
|
||||||
$usernameinput = $request->input('email');
|
$usernameinput = $request->input('email');
|
||||||
$password = $request->input('password');
|
$password = $request->input('password');
|
||||||
if ($request->input('referer'))
|
if ($request->input('referer')) {
|
||||||
{
|
|
||||||
$referer = 'form';
|
$referer = 'form';
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$referer = '/';
|
$referer = '/';
|
||||||
}
|
}
|
||||||
$field = filter_var($usernameinput, FILTER_VALIDATE_EMAIL) ? 'email' : 'user_name';
|
$field = filter_var($usernameinput, FILTER_VALIDATE_EMAIL) ? 'email' : 'user_name';
|
||||||
@@ -375,14 +312,12 @@ class AuthController extends Controller
|
|||||||
|
|
||||||
// If attempts > 3 and time < 30 minutes
|
// If attempts > 3 and time < 30 minutes
|
||||||
$security = Security::whereId('1')->first();
|
$security = Security::whereId('1')->first();
|
||||||
if ($result == 1)
|
if ($result == 1) {
|
||||||
{
|
|
||||||
return redirect()->back()->withErrors('email', 'Incorrect details')->with(['error' => $security->lockout_message, 'referer' => $referer]);
|
return redirect()->back()->withErrors('email', 'Incorrect details')->with(['error' => $security->lockout_message, 'referer' => $referer]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$check_active = User::where('email', '=', $request->input('email'))->orwhere('user_name', '=', $request->input('email'))->first();
|
$check_active = User::where('email', '=', $request->input('email'))->orwhere('user_name', '=', $request->input('email'))->first();
|
||||||
if (!$check_active)
|
if (!$check_active) { //check if user exists or not
|
||||||
{ //check if user exists or not
|
|
||||||
//if user deos not exist then return back with error that user is not registered
|
//if user deos not exist then return back with error that user is not registered
|
||||||
return redirect()->back()
|
return redirect()->back()
|
||||||
->withInput($request->only('email', 'remember'))
|
->withInput($request->only('email', 'remember'))
|
||||||
@@ -396,21 +331,16 @@ class AuthController extends Controller
|
|||||||
//if user exists
|
//if user exists
|
||||||
$settings = CommonSettings::select('status')->where('option_name', '=', 'send_otp')->first();
|
$settings = CommonSettings::select('status')->where('option_name', '=', 'send_otp')->first();
|
||||||
|
|
||||||
if ($settings->status == '1' || $settings->status == 1)
|
if ($settings->status == '1' || $settings->status == 1) { // check for otp verification setting
|
||||||
{ // check for otp verification setting
|
|
||||||
// setting is enabled
|
// setting is enabled
|
||||||
$sms = Plugin::select('status')->where('name', '=', 'SMS')->first();
|
$sms = Plugin::select('status')->where('name', '=', 'SMS')->first();
|
||||||
if ($sms)
|
if ($sms) { //check sms plugin installed or not
|
||||||
{ //check sms plugin installed or not
|
|
||||||
// plugin is installed
|
// plugin is installed
|
||||||
if ($sms->status == 1 || $sms->status === '1')
|
if ($sms->status == 1 || $sms->status === '1') { //check plugin is active or not
|
||||||
{ //check plugin is active or not
|
|
||||||
// plugin is active
|
// plugin is active
|
||||||
if (!$check_active->active)
|
if (!$check_active->active) { //check account is active or not
|
||||||
{ //check account is active or not
|
|
||||||
// account is not active show verify otp window
|
// account is not active show verify otp window
|
||||||
if ($check_active->mobile)
|
if ($check_active->mobile) { //check user has mobile or not
|
||||||
{ //check user has mobile or not
|
|
||||||
// user has mobile number return verify OTP screen
|
// user has mobile number return verify OTP screen
|
||||||
return \Redirect::route('otp-verification')
|
return \Redirect::route('otp-verification')
|
||||||
->withInput($request->input())
|
->withInput($request->input())
|
||||||
@@ -419,32 +349,21 @@ class AuthController extends Controller
|
|||||||
'name' => $check_active->first_name,
|
'name' => $check_active->first_name,
|
||||||
'number' => $check_active->mobile,
|
'number' => $check_active->mobile,
|
||||||
'code' => $check_active->country_code, ]);
|
'code' => $check_active->country_code, ]);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
goto a; //attenmpt login (be careful while using goto statements)
|
goto a; //attenmpt login (be careful while using goto statements)
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
goto a; //attenmpt login (be careful while using goto statements)
|
goto a; //attenmpt login (be careful while using goto statements)
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
goto a; //attenmpt login (be careful while using goto statements)
|
goto a; //attenmpt login (be careful while using goto statements)
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
goto a; //attenmpt login (be careful while using goto statements)
|
goto a; //attenmpt login (be careful while using goto statements)
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
// setting is disabled
|
// setting is disabled
|
||||||
a: if (!$check_active->active)
|
a: if (!$check_active->active) { //check account is active or not
|
||||||
{ //check account is active or not
|
|
||||||
// if accoutn is not active return back with error message that account is inactive
|
// if accoutn is not active return back with error message that account is inactive
|
||||||
return redirect()->back()
|
return redirect()->back()
|
||||||
->withInput($request->only('email', 'remember'))
|
->withInput($request->only('email', 'remember'))
|
||||||
@@ -453,14 +372,11 @@ class AuthController extends Controller
|
|||||||
'password' => $this->getFailedLoginMessage(),
|
'password' => $this->getFailedLoginMessage(),
|
||||||
])->with(['error' => Lang::get('lang.this_account_is_currently_inactive'),
|
])->with(['error' => Lang::get('lang.this_account_is_currently_inactive'),
|
||||||
'referer' => $referer, ]);
|
'referer' => $referer, ]);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
// try login
|
// try login
|
||||||
$loginAttempts = 1;
|
$loginAttempts = 1;
|
||||||
// If session has login attempts, retrieve attempts counter and attempts time
|
// If session has login attempts, retrieve attempts counter and attempts time
|
||||||
if (\Session::has('loginAttempts'))
|
if (\Session::has('loginAttempts')) {
|
||||||
{
|
|
||||||
$loginAttempts = \Session::get('loginAttempts');
|
$loginAttempts = \Session::get('loginAttempts');
|
||||||
$loginAttemptTime = \Session::get('loginAttemptTime');
|
$loginAttemptTime = \Session::get('loginAttemptTime');
|
||||||
$this->addLoginAttempt($value, $usernameinput);
|
$this->addLoginAttempt($value, $usernameinput);
|
||||||
@@ -469,38 +385,29 @@ class AuthController extends Controller
|
|||||||
$password = $request->input('password');
|
$password = $request->input('password');
|
||||||
$field = filter_var($usernameinput, FILTER_VALIDATE_EMAIL) ? 'email' : 'user_name';
|
$field = filter_var($usernameinput, FILTER_VALIDATE_EMAIL) ? 'email' : 'user_name';
|
||||||
// If attempts > 3 and time < 10 minutes
|
// If attempts > 3 and time < 10 minutes
|
||||||
if ($loginAttempts > $security->backlist_threshold && (time() - $loginAttemptTime <= ($security->lockout_period * 60)))
|
if ($loginAttempts > $security->backlist_threshold && (time() - $loginAttemptTime <= ($security->lockout_period * 60))) {
|
||||||
{
|
|
||||||
return redirect()->back()->withErrors('email', 'incorrect email')->with('error', $security->lockout_message);
|
return redirect()->back()->withErrors('email', 'incorrect email')->with('error', $security->lockout_message);
|
||||||
}
|
}
|
||||||
// If time > 10 minutes, reset attempts counter and time in session
|
// If time > 10 minutes, reset attempts counter and time in session
|
||||||
if (time() - $loginAttemptTime > ($security->lockout_period * 60))
|
if (time() - $loginAttemptTime > ($security->lockout_period * 60)) {
|
||||||
{
|
|
||||||
\Session::put('loginAttempts', 1);
|
\Session::put('loginAttempts', 1);
|
||||||
\Session::put('loginAttemptTime', time());
|
\Session::put('loginAttemptTime', time());
|
||||||
}
|
}
|
||||||
}
|
} else { // If no login attempts stored, init login attempts and time
|
||||||
else
|
|
||||||
{ // If no login attempts stored, init login attempts and time
|
|
||||||
\Session::put('loginAttempts', $loginAttempts);
|
\Session::put('loginAttempts', $loginAttempts);
|
||||||
\Session::put('loginAttemptTime', time());
|
\Session::put('loginAttemptTime', time());
|
||||||
$this->clearLoginAttempts($value, $usernameinput);
|
$this->clearLoginAttempts($value, $usernameinput);
|
||||||
}
|
}
|
||||||
// If auth ok, redirect to restricted area
|
// If auth ok, redirect to restricted area
|
||||||
\Session::put('loginAttempts', $loginAttempts + 1);
|
\Session::put('loginAttempts', $loginAttempts + 1);
|
||||||
if (Auth::Attempt([$field => $usernameinput, 'password' => $password], $request->has('remember')))
|
if (Auth::Attempt([$field => $usernameinput, 'password' => $password], $request->has('remember'))) {
|
||||||
{
|
if (Auth::user()->role == 'user') {
|
||||||
if (Auth::user()->role == 'user')
|
if ($request->input('referer')) {
|
||||||
{
|
|
||||||
if ($request->input('referer'))
|
|
||||||
{
|
|
||||||
return \Redirect::route($request->input('referer'));
|
return \Redirect::route($request->input('referer'));
|
||||||
}
|
}
|
||||||
|
|
||||||
return \Redirect::route('/');
|
return \Redirect::route('/');
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return redirect()->intended($this->redirectPath());
|
return redirect()->intended($this->redirectPath());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -515,9 +422,7 @@ class AuthController extends Controller
|
|||||||
])->with(['error' => Lang::get('lang.invalid'),
|
])->with(['error' => Lang::get('lang.invalid'),
|
||||||
'referer' => $referer, ]);
|
'referer' => $referer, ]);
|
||||||
// Increment login attempts
|
// Increment login attempts
|
||||||
}
|
} catch (\Exception $e) {
|
||||||
catch (\Exception $e)
|
|
||||||
{
|
|
||||||
return redirect()->back()->with('fails', $e->getMessage());
|
return redirect()->back()->with('fails', $e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -535,22 +440,16 @@ class AuthController extends Controller
|
|||||||
$data = $result;
|
$data = $result;
|
||||||
$security = Security::whereId('1')->first();
|
$security = Security::whereId('1')->first();
|
||||||
$apt = $security->backlist_threshold;
|
$apt = $security->backlist_threshold;
|
||||||
if ($data)
|
if ($data) {
|
||||||
{
|
|
||||||
$attempts = $data->Attempts + 1;
|
$attempts = $data->Attempts + 1;
|
||||||
if ($attempts == $apt)
|
if ($attempts == $apt) {
|
||||||
{
|
|
||||||
// $result = DB::select('UPDATE login_attempts SET Attempts='.$attempts.", LastLogin=NOW() WHERE IP = '$value' OR User = '$field'");
|
// $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::table('login_attempts')->where('IP', '=', $value)->orWhere('User', '=', $field)->update(['Attempts' => $attempts, 'LastLogin' => date('Y-m-d H:i:s')]);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$result = DB::table('login_attempts')->where('IP', '=', $value)->orWhere('User', '=', $field)->update(['Attempts' => $attempts]);
|
$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'");
|
// $result = DB::select("UPDATE login_attempts SET Attempts=".$attempts." WHERE IP = '$value' OR User = '$field'");
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
// $result = DB::select("INSERT INTO login_attempts (Attempts,User,IP,LastLogin) values (1,'$field','$value', NOW())");
|
// $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::table('login_attempts')->update(['Attempts' => 1, 'User' => $field, 'IP' => $value, 'LastLogin' => date('Y-m-d H:i:s')]);
|
||||||
}
|
}
|
||||||
@@ -587,18 +486,13 @@ class AuthController extends Controller
|
|||||||
' FROM '.$table." WHERE IP = '$value' OR User = '$field'");
|
' FROM '.$table." WHERE IP = '$value' OR User = '$field'");
|
||||||
$data = $result;
|
$data = $result;
|
||||||
//Verify that at least one login attempt is in database
|
//Verify that at least one login attempt is in database
|
||||||
if (!$data)
|
if (!$data) {
|
||||||
{
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if ($data[0]->Attempts >= $max_attempts)
|
if ($data[0]->Attempts >= $max_attempts) {
|
||||||
{
|
if ($data[0]->Denied == 1) {
|
||||||
if ($data[0]->Denied == 1)
|
|
||||||
{
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->clearLoginAttempts($value, $field);
|
$this->clearLoginAttempts($value, $field);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -627,12 +521,9 @@ class AuthController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function getVerifyOTP()
|
public function getVerifyOTP()
|
||||||
{
|
{
|
||||||
if (\Session::has('values'))
|
if (\Session::has('values')) {
|
||||||
{
|
|
||||||
return view('auth.otp-verify');
|
return view('auth.otp-verify');
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return redirect('auth/login');
|
return redirect('auth/login');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -649,32 +540,23 @@ class AuthController extends Controller
|
|||||||
$user = User::select('id', 'mobile', 'user_name')->where('email', '=', $request->input('email'))
|
$user = User::select('id', 'mobile', 'user_name')->where('email', '=', $request->input('email'))
|
||||||
->orWhere('user_name', '=', $request->input('email'))->first();
|
->orWhere('user_name', '=', $request->input('email'))->first();
|
||||||
$otp_length = strlen($request->input('otp'));
|
$otp_length = strlen($request->input('otp'));
|
||||||
if (!\Schema::hasTable('user_verification'))
|
if (!\Schema::hasTable('user_verification')) {
|
||||||
{
|
|
||||||
$message = Lang::get('lang.opt-can-not-be-verified');
|
$message = Lang::get('lang.opt-can-not-be-verified');
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$otp = Otp::select('otp', 'updated_at')->where('user_id', '=', $user->id)
|
$otp = Otp::select('otp', 'updated_at')->where('user_id', '=', $user->id)
|
||||||
->first();
|
->first();
|
||||||
if ($otp != null)
|
if ($otp != null) {
|
||||||
{
|
if (($otp_length == 6 && !preg_match('/[a-z]/i', $request->input('otp')))) {
|
||||||
if (($otp_length == 6 && !preg_match('/[a-z]/i', $request->input('otp'))))
|
|
||||||
{
|
|
||||||
$otp2 = Hash::make($request->input('otp'));
|
$otp2 = Hash::make($request->input('otp'));
|
||||||
$date1 = date_format($otp->updated_at, 'Y-m-d h:i:sa');
|
$date1 = date_format($otp->updated_at, 'Y-m-d h:i:sa');
|
||||||
$date2 = date('Y-m-d h:i:sa');
|
$date2 = date('Y-m-d h:i:sa');
|
||||||
$time1 = new DateTime($date2);
|
$time1 = new DateTime($date2);
|
||||||
$time2 = new DateTime($date1);
|
$time2 = new DateTime($date1);
|
||||||
$interval = $time1->diff($time2);
|
$interval = $time1->diff($time2);
|
||||||
if ($interval->i > 30 || $interval->h > 0)
|
if ($interval->i > 30 || $interval->h > 0) {
|
||||||
{
|
|
||||||
$message = Lang::get('lang.otp-expired');
|
$message = Lang::get('lang.otp-expired');
|
||||||
}
|
} else {
|
||||||
else
|
if (Hash::check($request->input('otp'), $otp->otp)) {
|
||||||
{
|
|
||||||
if (Hash::check($request->input('otp'), $otp->otp))
|
|
||||||
{
|
|
||||||
Otp::where('user_id', '=', $user->id)
|
Otp::where('user_id', '=', $user->id)
|
||||||
->update(['otp' => '']);
|
->update(['otp' => '']);
|
||||||
User::where('id', '=', $user->id)
|
User::where('id', '=', $user->id)
|
||||||
@@ -682,20 +564,14 @@ class AuthController extends Controller
|
|||||||
$this->openTicketAfterVerification($user->id);
|
$this->openTicketAfterVerification($user->id);
|
||||||
|
|
||||||
return $this->postLogin($request);
|
return $this->postLogin($request);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$message = Lang::get('lang.otp-not-matched');
|
$message = Lang::get('lang.otp-not-matched');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$message = Lang::get('lang.otp-invalid');
|
$message = Lang::get('lang.otp-invalid');
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$message = Lang::get('lang.otp-not-matched');
|
$message = Lang::get('lang.otp-not-matched');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -710,23 +586,17 @@ class AuthController extends Controller
|
|||||||
|
|
||||||
public function resendOTP(OtpVerifyRequest $request)
|
public function resendOTP(OtpVerifyRequest $request)
|
||||||
{
|
{
|
||||||
if (!\Schema::hasTable('user_verification') || !\Schema::hasTable('sms'))
|
if (!\Schema::hasTable('user_verification') || !\Schema::hasTable('sms')) {
|
||||||
{
|
|
||||||
$message = Lang::get('lang.opt-can-not-be-verified');
|
$message = Lang::get('lang.opt-can-not-be-verified');
|
||||||
|
|
||||||
return $message;
|
return $message;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$sms = DB::table('sms')->get();
|
$sms = DB::table('sms')->get();
|
||||||
if (count($sms) > 0)
|
if (count($sms) > 0) {
|
||||||
{
|
|
||||||
\Event::fire(new \App\Events\LoginEvent($request));
|
\Event::fire(new \App\Events\LoginEvent($request));
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$message = Lang::get('lang.opt-can-not-be-verified');
|
$message = Lang::get('lang.opt-can-not-be-verified');
|
||||||
|
|
||||||
return $message;
|
return $message;
|
||||||
@@ -751,10 +621,8 @@ class AuthController extends Controller
|
|||||||
->get();
|
->get();
|
||||||
Tickets::where(['user_id' => $id, 'status' => 6])
|
Tickets::where(['user_id' => $id, 'status' => 6])
|
||||||
->update(['status' => 1]);
|
->update(['status' => 1]);
|
||||||
if ($ticket != null)
|
if ($ticket != null) {
|
||||||
{
|
foreach ($ticket as $value) {
|
||||||
foreach ($ticket as $value)
|
|
||||||
{
|
|
||||||
$ticket_id = $value->id;
|
$ticket_id = $value->id;
|
||||||
Ticket_Thread::where('ticket_id', '=', $ticket_id)
|
Ticket_Thread::where('ticket_id', '=', $ticket_id)
|
||||||
->update(['updated_at' => date('Y-m-d H:i:s')]);
|
->update(['updated_at' => date('Y-m-d H:i:s')]);
|
||||||
@@ -776,5 +644,4 @@ class AuthController extends Controller
|
|||||||
\Session::set($provider.'redirect', $url);
|
\Session::set($provider.'redirect', $url);
|
||||||
$this->changeRedirect();
|
$this->changeRedirect();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -237,6 +237,7 @@ class GuestController extends Controller
|
|||||||
//echo $user->password;
|
//echo $user->password;
|
||||||
if (Hash::check($request->input('old_password'), $user->getAuthPassword())) {
|
if (Hash::check($request->input('old_password'), $user->getAuthPassword())) {
|
||||||
$user->password = Hash::make($request->input('new_password'));
|
$user->password = Hash::make($request->input('new_password'));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$user->save();
|
$user->save();
|
||||||
|
|
||||||
|
@@ -94,6 +94,7 @@ class UnAuthController extends Controller
|
|||||||
$ticket_token->token = $hashed_token;
|
$ticket_token->token = $hashed_token;
|
||||||
$ticket_token->save();
|
$ticket_token->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->PhpMailController->sendmail(
|
$this->PhpMailController->sendmail(
|
||||||
$from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $username, 'email' => $user_details->email], $message = ['subject' => 'Ticket link Request ['.$ticket_number.']', 'scenario' => 'check-ticket'], $template_variables = ['user' => $username, 'ticket_link_with_number' => url('show-ticket/'.$ticket->id.'/'.$token)]
|
$from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $username, 'email' => $user_details->email], $message = ['subject' => 'Ticket link Request ['.$ticket_number.']', 'scenario' => 'check-ticket'], $template_variables = ['user' => $username, 'ticket_link_with_number' => url('show-ticket/'.$ticket->id.'/'.$token)]
|
||||||
@@ -270,6 +271,7 @@ class UnAuthController extends Controller
|
|||||||
} else {
|
} else {
|
||||||
$from_email = $sending_emails->id;
|
$from_email = $sending_emails->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('0', $tickets->dept_id), $to = ['name' => $user_name, 'email' => $email], $message = ['subject' => $ticket_subject.'[#'.$ticket_number.']', 'scenario' => 'close-ticket'], $template_variables = ['ticket_number' => $ticket_number]);
|
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('0', $tickets->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) {
|
} catch (\Exception $e) {
|
||||||
|
@@ -51,6 +51,7 @@ class ApiSettings extends Controller
|
|||||||
$this->validate($request, [
|
$this->validate($request, [
|
||||||
'ticket_detail' => 'url',
|
'ticket_detail' => 'url',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// dd($request->input());
|
// dd($request->input());
|
||||||
DB::table('settings_system')
|
DB::table('settings_system')
|
||||||
@@ -91,6 +92,7 @@ class ApiSettings extends Controller
|
|||||||
$this->postHook($data);
|
$this->postHook($data);
|
||||||
} catch (Exception $ex) {
|
} catch (Exception $ex) {
|
||||||
dd($ex);
|
dd($ex);
|
||||||
|
|
||||||
throw new Exception($ex->getMessage());
|
throw new Exception($ex->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -106,6 +108,7 @@ class ApiSettings extends Controller
|
|||||||
}
|
}
|
||||||
} catch (Exception $ex) {
|
} catch (Exception $ex) {
|
||||||
dd($ex);
|
dd($ex);
|
||||||
|
|
||||||
throw new Exception($ex->getMessage());
|
throw new Exception($ex->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -120,6 +120,7 @@ class SettingsController extends Controller
|
|||||||
$widget = $widgets->where('id', '=', $id)->first();
|
$widget = $widgets->where('id', '=', $id)->first();
|
||||||
$widget->title = $request->title;
|
$widget->title = $request->title;
|
||||||
$widget->value = $request->content;
|
$widget->value = $request->content;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$widget->save();
|
$widget->save();
|
||||||
|
|
||||||
@@ -198,6 +199,7 @@ class SettingsController extends Controller
|
|||||||
$widget = $widgets->where('id', '=', $id)->first();
|
$widget = $widgets->where('id', '=', $id)->first();
|
||||||
$widget->title = $request->title;
|
$widget->title = $request->title;
|
||||||
$widget->value = $request->content;
|
$widget->value = $request->content;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$widget->save();
|
$widget->save();
|
||||||
|
|
||||||
@@ -234,6 +236,7 @@ class SettingsController extends Controller
|
|||||||
$data->name = $request->input('name');
|
$data->name = $request->input('name');
|
||||||
$data->email = $request->input('email');
|
$data->email = $request->input('email');
|
||||||
$data->password = Crypt::encrypt($request->input('password'));
|
$data->password = Crypt::encrypt($request->input('password'));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$data->save();
|
$data->save();
|
||||||
|
|
||||||
@@ -257,6 +260,7 @@ class SettingsController extends Controller
|
|||||||
$pass = $request->input('password');
|
$pass = $request->input('password');
|
||||||
$password = Crypt::encrypt($pass);
|
$password = Crypt::encrypt($pass);
|
||||||
$settings->password = $password;
|
$settings->password = $password;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$settings->save();
|
$settings->save();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
@@ -270,6 +274,7 @@ class SettingsController extends Controller
|
|||||||
$settings->logo = $fileName;
|
$settings->logo = $fileName;
|
||||||
$settings->save();
|
$settings->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$settings->fill($request->except('logo', 'password'))->save();
|
$settings->fill($request->except('logo', 'password'))->save();
|
||||||
|
|
||||||
@@ -364,6 +369,7 @@ class SettingsController extends Controller
|
|||||||
public function PostPlugins(Request $request)
|
public function PostPlugins(Request $request)
|
||||||
{
|
{
|
||||||
$this->validate($request, ['plugin' => 'required|mimes:application/zip,zip,Zip']);
|
$this->validate($request, ['plugin' => 'required|mimes:application/zip,zip,Zip']);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (!extension_loaded('zip')) {
|
if (!extension_loaded('zip')) {
|
||||||
throw new Exception('Please enable zip extension in your php');
|
throw new Exception('Please enable zip extension in your php');
|
||||||
|
@@ -375,6 +375,7 @@ class InstallController extends Controller
|
|||||||
$datacontent2 = str_replace('http://localhost', $link, $datacontent2);
|
$datacontent2 = str_replace('http://localhost', $link, $datacontent2);
|
||||||
File::put($app_url, $datacontent2);
|
File::put($app_url, $datacontent2);
|
||||||
$language = Cache::get('language');
|
$language = Cache::get('language');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Cache::flush();
|
Cache::flush();
|
||||||
|
|
||||||
|
@@ -43,6 +43,7 @@ class MailController extends Controller
|
|||||||
public function getServiceForm($short_name)
|
public function getServiceForm($short_name)
|
||||||
{
|
{
|
||||||
$form = '';
|
$form = '';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
switch ($short_name) {
|
switch ($short_name) {
|
||||||
case 'smtp':
|
case 'smtp':
|
||||||
|
@@ -29,6 +29,7 @@ class TicketRequest extends Request
|
|||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
$error = '';
|
$error = '';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$size = $this->size();
|
$size = $this->size();
|
||||||
if ($size > 800 || $size == 0) {
|
if ($size > 800 || $size == 0) {
|
||||||
|
@@ -188,8 +188,6 @@ return [
|
|||||||
App\FaveoStorage\StorageServiceProvider::class,
|
App\FaveoStorage\StorageServiceProvider::class,
|
||||||
Yajra\Datatables\DatatablesServiceProvider::class,
|
Yajra\Datatables\DatatablesServiceProvider::class,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
],
|
],
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
@@ -41,7 +41,6 @@ if (!empty($_POST)) {
|
|||||||
<td><pre class="samples"><?php echo $value; ?></pre></td>
|
<td><pre class="samples"><?php echo $value; ?></pre></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
Reference in New Issue
Block a user