From 3c41089a8a5f334c4ee4e56ed64c3fa58490358f Mon Sep 17 00:00:00 2001 From: Nabeel Shahzad Date: Sun, 10 Dec 2017 08:47:03 -0600 Subject: [PATCH] Force default timezone to UTC; move helpers.php --- app/Repositories/Traits/CacheableRepository.php | 6 +++--- app/{Support => }/helpers.php | 0 composer.json | 2 +- config/app.php | 2 +- config/database.php | 5 +++++ 5 files changed, 10 insertions(+), 5 deletions(-) rename app/{Support => }/helpers.php (100%) diff --git a/app/Repositories/Traits/CacheableRepository.php b/app/Repositories/Traits/CacheableRepository.php index 2b8a5c8a..7edd4c58 100644 --- a/app/Repositories/Traits/CacheableRepository.php +++ b/app/Repositories/Traits/CacheableRepository.php @@ -224,14 +224,14 @@ trait CacheableRepository public function paginate($limit = null, $columns = ['*'], $method='paginate') { if (!$this->allowedCache('paginate') || $this->isSkippedCache()) { - return parent::paginate($limit, $columns); + return parent::paginate($limit, $columns, $method); } $key = $this->getCacheKey('paginate', func_get_args()); $minutes = $this->getCacheMinutes(); - $value = $this->getCacheRepository()->remember($key, $minutes, function () use ($limit, $columns) { - return parent::paginate($limit, $columns); + $value = $this->getCacheRepository()->remember($key, $minutes, function () use ($limit, $columns, $method) { + return parent::paginate($limit, $columns, $method); }); $this->resetModel(); diff --git a/app/Support/helpers.php b/app/helpers.php similarity index 100% rename from app/Support/helpers.php rename to app/helpers.php diff --git a/composer.json b/composer.json index 2a97473d..b212a203 100755 --- a/composer.json +++ b/composer.json @@ -64,7 +64,7 @@ }, "autoload": { "files": [ - "app/Support/helpers.php" + "app/helpers.php" ], "classmap": [ "database" diff --git a/config/app.php b/config/app.php index 5c8cf5b3..b71aa83f 100755 --- a/config/app.php +++ b/config/app.php @@ -8,7 +8,7 @@ return [ 'url' => env('APP_URL', 'http://localhost'), 'version' => '4.0', - 'timezone' => env('APP_TIMEZONE', 'UTC'), + 'timezone' => 'UTC', 'locale' => env('APP_LOCALE', 'en'), 'fallback_locale' => 'en', diff --git a/config/database.php b/config/database.php index c8a4f364..85e4731e 100755 --- a/config/database.php +++ b/config/database.php @@ -13,6 +13,7 @@ return [ 'username' => env('DB_USERNAME', 'forge'), 'password' => env('DB_PASSWORD', ''), 'unix_socket' => env('DB_SOCKET', ''), + 'timezone' => '+00:00', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', @@ -22,21 +23,25 @@ return [ 'sqlite' => [ 'driver' => 'sqlite', 'database' => env('DB_DATABASE', storage_path('db.sqlite')), + 'timezone' => '+00:00', 'prefix' => '', ], 'local' => [ 'driver' => 'sqlite', 'database' => storage_path('local.sqlite'), + 'timezone' => '+00:00', 'prefix' => '', ], 'unittest' => [ 'driver' => 'sqlite', 'database' => storage_path('unittest.sqlite'), + 'timezone' => '+00:00', 'prefix' => '', ], 'memory' => [ 'driver' => 'sqlite', 'database' => ':memory:', + 'timezone' => '+00:00', 'prefix' => '', ], ],