Skip to content

Commit

Permalink
Merge pull request #1 from rahul1321/fix/sms-sending-time
Browse files Browse the repository at this point in the history
fix sms sending time
  • Loading branch information
kalyan312 authored Nov 1, 2021
2 parents 059a7bd + 9dc4547 commit 3d7e1fb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
"license": "MIT",
"type": "library",
"require": {
"php": "^7.2",
"ixudra/curl": "6.*"
"php": "^7.2|^8.0",
"ixudra/curl": "6.*",
"ext-json": "*"
},
"authors": [
{
Expand Down
2 changes: 1 addition & 1 deletion src/SMS.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ private function beforeSend($recipient, $message, $params = null){
$history->mobile_number = is_array($recipient) ? json_encode($recipient) : $recipient;
$history->message = is_array($message) ? json_encode($message) : $message;
$history->gateway = $this->gateway;
$history->created_at = now();
$history->created_at = getCurrentDateTime();
$history->save();
$this->smsRecord = $history;
} catch (\Exception $exception){
Expand Down
11 changes: 11 additions & 0 deletions src/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,14 @@ function sms()
return new \Khbd\LaravelSmsBD\SMS();
}
}

if (!function_exists('getCurrentDateTime')) {

function getCurrentDateTime()
{
if(class_exists(\Carbon\Carbon::class)){
return \Carbon\Carbon::now();
}
return date('Y-m-d H:i:s');
}
}

0 comments on commit 3d7e1fb

Please sign in to comment.