update 1.0.8.0
Commits for version update
This commit is contained in:
@@ -68,7 +68,6 @@ class ClientTicketController extends Controller
|
||||
|
||||
$fromaddress = $user_cred->email;
|
||||
$fromname = $user_cred->user_name;
|
||||
$to = '';
|
||||
$phone = '';
|
||||
$phonecode = '';
|
||||
$mobile_number = '';
|
||||
@@ -85,9 +84,7 @@ class ClientTicketController extends Controller
|
||||
$ticket_status = null;
|
||||
$auto_response = 0;
|
||||
|
||||
$inline_attachment = null;
|
||||
|
||||
$this->TicketWorkflowController->workflow($fromaddress, $fromname, $to, $subject, $body, $phone, $phonecode, $mobile_number, $helptopic, $sla, $priority, $source, $collaborator, $dept, $assign, $team_assign, $ticket_status, $form_data, $auto_response, $inline_attachment);
|
||||
$this->TicketWorkflowController->workflow($fromaddress, $fromname, $subject, $body, $phone, $phonecode, $mobile_number, $helptopic, $sla, $priority, $source, $collaborator, $dept, $assign, $team_assign, $ticket_status, $form_data, $auto_response);
|
||||
|
||||
return \Redirect::back()->with('success1', Lang::get('lang.successfully_replied'));
|
||||
}
|
||||
|
@@ -4,7 +4,6 @@ namespace App\Http\Controllers\Client\helpdesk;
|
||||
|
||||
// controllers
|
||||
use App\Http\Controllers\Agent\helpdesk\TicketWorkflowController;
|
||||
use App\Http\Controllers\Common\FileuploadController;
|
||||
use App\Http\Controllers\Controller;
|
||||
// requests
|
||||
use App\Http\Requests\helpdesk\ClientRequest;
|
||||
@@ -12,9 +11,11 @@ use App\Model\helpdesk\Agent\Department;
|
||||
// models
|
||||
use App\Model\helpdesk\Form\Fields;
|
||||
use App\Model\helpdesk\Manage\Help_topic;
|
||||
use App\Model\helpdesk\Settings\CommonSettings;
|
||||
use App\Model\helpdesk\Settings\System;
|
||||
use App\Model\helpdesk\Settings\Ticket;
|
||||
use App\Model\helpdesk\Ticket\Ticket_attachments;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Priority;
|
||||
use App\Model\helpdesk\Ticket\Ticket_source;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Thread;
|
||||
use App\Model\helpdesk\Ticket\Tickets;
|
||||
@@ -61,6 +62,11 @@ class FormController extends Controller
|
||||
if (\Config::get('database.install') == '%0%') {
|
||||
return \Redirect::route('licence');
|
||||
}
|
||||
$settings = CommonSettings::select('status')->where('option_name', '=', 'send_otp')->first();
|
||||
$email_mandatory = CommonSettings::select('status')->where('option_name', '=', 'email_mandatory')->first();
|
||||
if (!\Auth::check() && ($settings->status == 1 || $settings->status == '1')) {
|
||||
return redirect('auth/login')->with(['login_require' => 'Please login to your account for submitting a ticket', 'referer' => 'form']);
|
||||
}
|
||||
$location = GeoIP::getLocation();
|
||||
$phonecode = $code->where('iso', '=', $location['isoCode'])->first();
|
||||
if (System::first()->status == 1) {
|
||||
@@ -71,12 +77,8 @@ class FormController extends Controller
|
||||
} else {
|
||||
$phonecode = '';
|
||||
}
|
||||
$fileupload = new FileuploadController();
|
||||
$fileupload = $fileupload->file_upload_max_size();
|
||||
$max_size_in_bytes = $fileupload[0];
|
||||
$max_size_in_actual = $fileupload[1];
|
||||
|
||||
return view('themes.default1.client.helpdesk.form', compact('topics', 'codes', 'max_size_in_bytes', 'max_size_in_actual'))->with('phonecode', $phonecode);
|
||||
return view('themes.default1.client.helpdesk.form', compact('topics', 'codes', 'email_mandatory'))->with('phonecode', $phonecode);
|
||||
} else {
|
||||
return \Redirect::route('home');
|
||||
}
|
||||
@@ -112,7 +114,7 @@ class FormController extends Controller
|
||||
$vals = explode(',', $type2);
|
||||
echo '<br/><label>'.ucfirst($form_data->label).'</label><br/>';
|
||||
foreach ($vals as $val) {
|
||||
echo '<input type="'.$form_data->type.'" name="'.$form_data->name.'"> '.$val.' ';
|
||||
echo '<input type="'.$form_data->type.'" name="'.$form_data->name.'"> '.$form_data->value.' ';
|
||||
}
|
||||
echo '<br/>';
|
||||
} elseif ($form_data->type == 'textarea') {
|
||||
@@ -144,16 +146,26 @@ class FormController extends Controller
|
||||
*/
|
||||
public function postedForm(User $user, ClientRequest $request, Ticket $ticket_settings, Ticket_source $ticket_source, Ticket_attachments $ta, CountryCode $code)
|
||||
{
|
||||
$form_extras = $request->except('Name', 'Phone', 'Email', 'Subject', 'Details', 'helptopic', '_wysihtml5_mode', '_token');
|
||||
|
||||
$form_extras = $request->except('Name', 'Phone', 'Email', 'Subject', 'Details', 'helptopic', '_wysihtml5_mode', '_token', 'mobile', 'Code');
|
||||
$name = $request->input('Name');
|
||||
$phone = $request->input('Phone');
|
||||
$email = $request->input('Email');
|
||||
$to = '';
|
||||
if ($request->input('Email')) {
|
||||
if ($request->input('Email')) {
|
||||
$email = $request->input('Email');
|
||||
} else {
|
||||
$email = null;
|
||||
}
|
||||
} else {
|
||||
$email = null;
|
||||
}
|
||||
$subject = $request->input('Subject');
|
||||
$details = $request->input('Details');
|
||||
$phonecode = $request->input('Code');
|
||||
$mobile_number = $request->input('Mobile');
|
||||
if ($request->input('mobile')) {
|
||||
$mobile_number = $request->input('mobile');
|
||||
} else {
|
||||
$mobile_number = null;
|
||||
}
|
||||
$status = $ticket_settings->first()->status;
|
||||
$helptopic = $request->input('helptopic');
|
||||
$helpTopicObj = Help_topic::where('id', '=', $helptopic);
|
||||
@@ -164,7 +176,15 @@ class FormController extends Controller
|
||||
$department = Help_topic::where('id', '=', $defaultHelpTopicID)->value('department');
|
||||
}
|
||||
$sla = $ticket_settings->first()->sla;
|
||||
$priority = $ticket_settings->first()->priority;
|
||||
|
||||
// $priority = $ticket_settings->first()->priority;
|
||||
$default_priority = Ticket_Priority::where('is_default', '=', 1)->first();
|
||||
$user_priority = CommonSettings::where('id', '=', 6)->first();
|
||||
if ($user_priority->status == 0) {
|
||||
$priority = $default_priority->priority_id;
|
||||
} else {
|
||||
$priority = $request->input('priority');
|
||||
}
|
||||
$source = $ticket_source->where('name', '=', 'web')->first()->id;
|
||||
$attachments = $request->file('attachment');
|
||||
$collaborator = null;
|
||||
@@ -195,14 +215,8 @@ class FormController extends Controller
|
||||
}
|
||||
}
|
||||
}
|
||||
// this param is used for inline attachments via email
|
||||
if (empty($attachments)) {
|
||||
$inline_attachment = $attachments;
|
||||
} else {
|
||||
$inline_attachment = null;
|
||||
}
|
||||
$result = $this->TicketWorkflowController->workflow($email, $name, $to, $subject, $details, $phone, $phonecode, $mobile_number, $helptopic, $sla, $priority, $source, $collaborator, $department, $assignto, $team_assign, $status, $form_extras, $auto_response, $inline_attachment);
|
||||
|
||||
$result = $this->TicketWorkflowController->workflow($email, $name, $subject, $details, $phone, $phonecode, $mobile_number, $helptopic, $sla, $priority, $source, $collaborator, $department, $assignto, $team_assign, $status, $form_extras, $auto_response);
|
||||
// dd($result);
|
||||
if ($result[1] == 1) {
|
||||
$ticketId = Tickets::where('ticket_number', '=', $result[0])->first();
|
||||
$thread = Ticket_Thread::where('ticket_id', '=', $ticketId->id)->first();
|
||||
@@ -220,6 +234,8 @@ class FormController extends Controller
|
||||
}
|
||||
// dd($result);
|
||||
return Redirect::back()->with('success', Lang::get('lang.Ticket-has-been-created-successfully-your-ticket-number-is').' '.$result[0].'. '.Lang::get('lang.Please-save-this-for-future-reference'));
|
||||
} else {
|
||||
return Redirect::back()->withInput($request->except('password'))->with('fails', Lang::get('lang.failed-to-create-user-tcket-as-mobile-has-been-taken'));
|
||||
}
|
||||
// dd($result);
|
||||
}
|
||||
@@ -245,7 +261,6 @@ class FormController extends Controller
|
||||
|
||||
$fromaddress = $user_cred->email;
|
||||
$fromname = $user_cred->user_name;
|
||||
$to = '';
|
||||
$phone = '';
|
||||
$phonecode = '';
|
||||
$mobile_number = '';
|
||||
@@ -262,7 +277,7 @@ class FormController extends Controller
|
||||
$ticket_status = null;
|
||||
$auto_response = 0;
|
||||
|
||||
$this->TicketWorkflowController->workflow($fromaddress, $to, $fromname, $subject, $body, $phone, $phonecode, $mobile_number, $helptopic, $sla, $priority, $source, $collaborator, $dept, $assign, $team_assign, $ticket_status, $form_data, $auto_response);
|
||||
$this->TicketWorkflowController->workflow($fromaddress, $fromname, $subject, $body, $phone, $phonecode, $mobile_number, $helptopic, $sla, $priority, $source, $collaborator, $dept, $assign, $team_assign, $ticket_status, $form_data, $auto_response);
|
||||
|
||||
return \Redirect::back()->with('success1', Lang::get('lang.successfully_replied'));
|
||||
} else {
|
||||
|
@@ -6,26 +6,31 @@ namespace App\Http\Controllers\Client\helpdesk;
|
||||
use App\Http\Controllers\Common\PhpMailController;
|
||||
use App\Http\Controllers\Controller;
|
||||
// requests
|
||||
use App\Http\Requests\helpdesk\OtpVerifyRequest;
|
||||
use App\Http\Requests\helpdesk\ProfilePassword;
|
||||
use App\Http\Requests\helpdesk\ProfileRequest;
|
||||
use App\Http\Requests\helpdesk\TicketRequest;
|
||||
use App\Model\helpdesk\Manage\Help_topic;
|
||||
// models
|
||||
use App\Model\helpdesk\Manage\Help_topic;
|
||||
use App\Model\helpdesk\Settings\CommonSettings;
|
||||
use App\Model\helpdesk\Settings\Company;
|
||||
use App\Model\helpdesk\Settings\System;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Thread;
|
||||
use App\Model\helpdesk\Ticket\Tickets;
|
||||
use App\Model\helpdesk\Utility\CountryCode;
|
||||
use App\Model\helpdesk\Utility\Otp;
|
||||
use App\User;
|
||||
use Auth;
|
||||
// classes
|
||||
use DateTime;
|
||||
use DB;
|
||||
use Exception;
|
||||
use GeoIP;
|
||||
use Hash;
|
||||
use Illuminate\Http\Request;
|
||||
use Input;
|
||||
use Lang;
|
||||
use Socialite;
|
||||
|
||||
/**
|
||||
* GuestController.
|
||||
@@ -47,19 +52,23 @@ class GuestController extends Controller
|
||||
$this->middleware('auth');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get profile.
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function getProfile(CountryCode $code)
|
||||
{
|
||||
$user = Auth::user();
|
||||
$location = GeoIP::getLocation();
|
||||
$phonecode = $code->where('iso', '=', $location['isoCode'])->first();
|
||||
/**
|
||||
* Get profile.
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function getProfile(CountryCode $code)
|
||||
{
|
||||
$user = Auth::user();
|
||||
$location = GeoIP::getLocation();
|
||||
$phonecode = $code->where('iso', '=', $location['isoCode'])->first();
|
||||
$settings = CommonSettings::select('status')->where('option_name', '=', 'send_otp')->first();
|
||||
$status = $settings->status;
|
||||
|
||||
return view('themes.default1.client.helpdesk.profile', compact('user'))->with('phonecode', $phonecode->phonecode);
|
||||
}
|
||||
return view('themes.default1.client.helpdesk.profile', compact('user'))
|
||||
->with(['phonecode' => $phonecode->phonecode,
|
||||
'verify' => $status, ]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Save profile data.
|
||||
@@ -95,18 +104,29 @@ class GuestController extends Controller
|
||||
$user->profile_pic = $fileName;
|
||||
} else {
|
||||
if ($request->get('country_code') == '' && ($request->get('phone_number') != '' || $request->get('mobile') != '')) {
|
||||
return redirect()->back()->with(['fails1' => Lang::get('lang.country-code-required-error'),
|
||||
'country_code' => 1, ])->withInput();
|
||||
return redirect()->back()->with(['fails1' => Lang::get('lang.country-code-required-error'),
|
||||
'country_code' => 1, ])->withInput();
|
||||
} else {
|
||||
$code = CountryCode::select('phonecode')->where('phonecode', '=', $request->get('country_code'))->get();
|
||||
if (!count($code)) {
|
||||
return redirect()->back()->with(['fails1' => Lang::get('lang.incorrect-country-code-error'),
|
||||
'country_code' => 1, ])->withInput();
|
||||
return redirect()->back()->with(['fails1' => Lang::get('lang.incorrect-country-code-error'),
|
||||
'country_code' => 1, ])->withInput();
|
||||
} else {
|
||||
$user->country_code = $request->input('country_code');
|
||||
}
|
||||
}
|
||||
$user->fill($request->except('profile_pic', 'gender'))->save();
|
||||
if ($request->get('mobile')) {
|
||||
$mobile = $request->get('mobile');
|
||||
} else {
|
||||
$mobile = null;
|
||||
}
|
||||
$check = $this->checkMobile($mobile);
|
||||
if ($check == true) {
|
||||
return redirect()->back()->with(['fails1' => Lang::get('lang.mobile-has-been-taken'), 'country_code' => 1])->withInput();
|
||||
}
|
||||
$user->fill($request->except('profile_pic', 'gender', 'mobile'));
|
||||
$user->mobile = $mobile;
|
||||
$user->save();
|
||||
|
||||
return redirect()->back()->with('success1', Lang::get('lang.profile_updated_sucessfully'));
|
||||
}
|
||||
@@ -115,6 +135,27 @@ class GuestController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*@category fucntion to check if mobile number is unqique or not
|
||||
*
|
||||
*@param string $mobile
|
||||
*
|
||||
*@return bool true(if mobile exists in users table)/false (if mobile does not exist in user table)
|
||||
*/
|
||||
public function checkMobile($mobile)
|
||||
{
|
||||
if ($mobile) {
|
||||
$check = User::where('mobile', '=', $mobile)
|
||||
->where('id', '<>', \Auth::user()->id)
|
||||
->first();
|
||||
if (count($check) > 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Ticket page.
|
||||
*
|
||||
@@ -319,7 +360,6 @@ class GuestController extends Controller
|
||||
*/
|
||||
public function get_ticket_email($id, CommonSettings $common_settings)
|
||||
{
|
||||
$id1 = \Crypt::decrypt($id);
|
||||
$common_setting = $common_settings->select('status')
|
||||
->where('option_name', '=', 'user_set_ticket_status')
|
||||
->first();
|
||||
@@ -355,4 +395,172 @@ class GuestController extends Controller
|
||||
|
||||
return $company;
|
||||
}
|
||||
|
||||
public function resendOTP(OtpVerifyRequest $request)
|
||||
{
|
||||
if (\Schema::hasTable('sms')) {
|
||||
$sms = DB::table('sms')->get();
|
||||
if (count($sms) > 0) {
|
||||
\Event::fire(new \App\Events\LoginEvent($request));
|
||||
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
return 'Plugin has not been setup successfully.';
|
||||
}
|
||||
}
|
||||
|
||||
public function verifyOTP()
|
||||
{
|
||||
// dd(Input::all());
|
||||
// $user = User::select('id', 'mobile', 'user_name')->where('email', '=', $request->input('email'))->first();
|
||||
$otp = Otp::select('otp', 'updated_at')->where('user_id', '=', Input::get('u_id'))
|
||||
->first();
|
||||
if ($otp != null) {
|
||||
$otp_length = strlen(Input::get('otp'));
|
||||
if (($otp_length == 6 && !preg_match('/[a-z]/i', Input::get('otp')))) {
|
||||
$otp2 = Hash::make(Input::get('otp'));
|
||||
$date1 = date_format($otp->updated_at, 'Y-m-d h:i:sa');
|
||||
$date2 = date('Y-m-d h:i:sa');
|
||||
$time1 = new DateTime($date2);
|
||||
$time2 = new DateTime($date1);
|
||||
$interval = $time1->diff($time2);
|
||||
if ($interval->i > 10 || $interval->h > 0) {
|
||||
$message = Lang::get('lang.otp-expired');
|
||||
|
||||
return $message;
|
||||
} else {
|
||||
if (Hash::check(Input::get('otp'), $otp->otp)) {
|
||||
Otp::where('user_id', '=', Input::get('u_id'))
|
||||
->update(['otp' => '']);
|
||||
// User::where('id', '=', $user->id)
|
||||
// ->update(['active' => 1]);
|
||||
// $this->openTicketAfterVerification($user->id);
|
||||
return 1;
|
||||
} else {
|
||||
$message = Lang::get('lang.otp-not-matched');
|
||||
|
||||
return $message;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$message = Lang::get('lang.otp-invalid');
|
||||
|
||||
return $message;
|
||||
}
|
||||
} else {
|
||||
$message = Lang::get('lang.otp-not-matched');
|
||||
|
||||
return $message;
|
||||
}
|
||||
}
|
||||
|
||||
public function sync()
|
||||
{
|
||||
try {
|
||||
$provider = $this->getProvider();
|
||||
$this->changeRedirect();
|
||||
$users = Socialite::driver($provider)->user();
|
||||
$this->forgetSession();
|
||||
$user['provider'] = $provider;
|
||||
$user['social_id'] = $users->id;
|
||||
$user['name'] = $users->name;
|
||||
$user['email'] = $users->email;
|
||||
$user['username'] = $users->nickname;
|
||||
$user['avatar'] = $users->avatar;
|
||||
|
||||
return redirect('client-profile')->with('success', 'Additional informations fetched');
|
||||
} catch (Exception $ex) {
|
||||
dd($ex);
|
||||
|
||||
return redirect('client-profile')->with('fails', $ex->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function getProvider()
|
||||
{
|
||||
$provider = \Session::get('provider');
|
||||
|
||||
return $provider;
|
||||
}
|
||||
|
||||
public function changeRedirect()
|
||||
{
|
||||
$provider = \Session::get('provider');
|
||||
$url = \Session::get($provider.'redirect');
|
||||
\Config::set("services.$provider.redirect", $url);
|
||||
}
|
||||
|
||||
public function forgetSession()
|
||||
{
|
||||
$provider = $this->getProvider();
|
||||
\Session::forget('provider');
|
||||
\Session::forget($provider.'redirect');
|
||||
}
|
||||
|
||||
public function checkArray($key, $array)
|
||||
{
|
||||
$value = '';
|
||||
if (array_key_exists($key, $array)) {
|
||||
$value = $array[$key];
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
public function updateUser($user = [])
|
||||
{
|
||||
$userid = \Auth::user()->id;
|
||||
$useremail = \Auth::user()->email;
|
||||
$email = $this->checkArray('email', $user); //$user['email'];
|
||||
if ($email !== '' && $email !== $useremail) {
|
||||
throw new Exception('Sorry! your current email and '.ucfirst($user['provider']).' email is different so system can not sync');
|
||||
}
|
||||
$this->update($userid, $user);
|
||||
}
|
||||
|
||||
public function update($userid, $user, $provider)
|
||||
{
|
||||
$email = $this->checkArray('email', $user);
|
||||
$this->deleteUser($userid, $user, $provider);
|
||||
$this->insertAdditional($userid, $provider, $user);
|
||||
$this->changeEmail($email);
|
||||
}
|
||||
|
||||
public function deleteUser($userid, $user, $provider)
|
||||
{
|
||||
$info = new \App\UserAdditionalInfo();
|
||||
$infos = $info->where('owner', $userid)->where('service', $provider)->get();
|
||||
if ($infos->count() > 0 && count($user) > 0) {
|
||||
foreach ($infos as $key => $detail) {
|
||||
//if ($user[$key] !== $detail->$key) {
|
||||
$detail->delete();
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function insertAdditional($id, $provider, $user = [])
|
||||
{
|
||||
$info = new \App\UserAdditionalInfo();
|
||||
if (count($user) > 0) {
|
||||
foreach ($user as $key => $value) {
|
||||
$info->create([
|
||||
'owner' => $id,
|
||||
'service' => $provider,
|
||||
'key' => $key,
|
||||
'value' => $value,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function changeEmail($email)
|
||||
{
|
||||
$user = \Auth::user();
|
||||
if ($user && $email && !$user->email) {
|
||||
$user->email = $email;
|
||||
$user->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -9,6 +9,7 @@ use App\Http\Controllers\Controller;
|
||||
use App\Model\helpdesk\Email\Emails;
|
||||
// models
|
||||
use App\Model\helpdesk\Settings\CommonSettings;
|
||||
use App\Model\helpdesk\Settings\Followup;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Status;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Thread;
|
||||
use App\Model\helpdesk\Ticket\Tickets;
|
||||
@@ -316,4 +317,101 @@ class UnAuthController extends Controller
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*@category function to change system's language
|
||||
*
|
||||
*@param string $lang //desired language's iso code
|
||||
*
|
||||
*@return response
|
||||
*/
|
||||
public static function changeLanguage($lang)
|
||||
{
|
||||
//if(Cache::has('language'))
|
||||
//{
|
||||
// return Cache::get('language');
|
||||
//} else return 'false';
|
||||
// Cache::put('language',$)
|
||||
$path = base_path('resources/lang'); // Path to check available language packages
|
||||
if (array_key_exists($lang, \Config::get('languages')) && in_array($lang, scandir($path))) {
|
||||
// dd(array_key_exists($lang, Config::get('languages')));
|
||||
// app()->setLocale($lang);
|
||||
|
||||
\Cache::forever('language', $lang);
|
||||
// dd(Cache::get('language'));
|
||||
// dd()
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Follow up tickets
|
||||
public function followup()
|
||||
{
|
||||
$followup = Followup::whereId('1')->first();
|
||||
$condition = $followup->condition;
|
||||
// dd($condition);
|
||||
|
||||
switch ($condition) {
|
||||
case 'everyMinute':
|
||||
$followup_set = ' + 1 minute';
|
||||
break;
|
||||
case 'everyFiveMinutes':
|
||||
$followup_set = ' + 5 minute';
|
||||
break;
|
||||
case 'everyTenMinutes':
|
||||
$followup_set = ' + 10 minute';
|
||||
break;
|
||||
case 'everyThirtyMinutes':
|
||||
$followup_set = ' + 30 minute';
|
||||
break;
|
||||
case 'hourly':
|
||||
$followup_set = ' + 1 hours';
|
||||
break;
|
||||
case 'daily':
|
||||
$followup_set = ' + 1 day';
|
||||
break;
|
||||
case 'weekly':
|
||||
$followup_set = ' + 7 day';
|
||||
break;
|
||||
case 'monthly':
|
||||
$followup_set = ' + 30 day';
|
||||
break;
|
||||
case 'yearly':
|
||||
$followup_set = ' + 365 day';
|
||||
break;
|
||||
}
|
||||
|
||||
if ($followup->status = 1) {
|
||||
$tickets = Tickets::where('id', '>=', 1)->where('status', '!=', 5)->get();
|
||||
// dd( $tickets);
|
||||
// $tickets=Tickets::where('id', '>=', 1)->where('status', '!=', 5)->pluck('id');
|
||||
// dd( $tickets);
|
||||
// $id=1;
|
||||
foreach ($tickets as $ticket) {
|
||||
// $id=1;
|
||||
// $id++;
|
||||
// $ticket=Tickets::where('status', '!=', 5)->get();
|
||||
|
||||
// dd($ticket);
|
||||
// if($ticket != null){
|
||||
// dd('here');
|
||||
$ck = date('Y-m-d H:i:s', strtotime($ticket->updated_at.$followup_set));
|
||||
// dd($ck);
|
||||
$current_time = date('Y-m-d H:i:s');
|
||||
if ($current_time > $ck) {
|
||||
$ticket->follow_up = 1;
|
||||
$ticket->save();
|
||||
// Tickets::where('id', '=',$id)
|
||||
// ->update(['follow_up' => 1]);
|
||||
|
||||
// }
|
||||
}
|
||||
// if($id=2)
|
||||
// {dd($ticket);}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user