Skip to content

Commit

Permalink
Merge pull request #30 from Tadaz/patch-1
Browse files Browse the repository at this point in the history
Fixing timestamps bug
  • Loading branch information
arcanedev-maroc authored Feb 25, 2021
2 parents fb72349 + f161b09 commit 96df83e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Stores/DatabaseStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Arcanedev\LaravelSettings\Utilities\Arr;
use Closure;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Carbon;

/**
* Class DatabaseStore
Expand Down Expand Up @@ -269,13 +270,16 @@ protected function newQuery(bool $insert = false): Builder
*/
protected function prepareInsertData(array $data): array
{
$now = Carbon::now();
$dbData = [];
$extraColumns = $this->extraColumns ? $this->extraColumns : [];

foreach ($data as $key => $value) {
$dbData[] = array_merge($extraColumns, [
$this->keyColumn => $key,
$this->valueColumn => $value,
$this->keyColumn => $key,
$this->valueColumn => $value,
$this->model->getCreatedAtColumn() => $now,
$this->model->getUpdatedAtColumn() => $now,
]);
}

Expand Down

0 comments on commit 96df83e

Please sign in to comment.