@@ -55,17 +55,17 @@ |
||
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | if ($collection = $this->getCollection()) { |
| 58 | - if ($var = $collection |
|
| 59 | - ->where('key', $key) |
|
| 60 | - ->whereIn('locale', [$this->locale, null]) |
|
| 61 | - //->orWhere('locale', null) |
|
| 62 | - ->first()) { |
|
| 63 | - |
|
| 64 | - return $var->value; |
|
| 65 | - } |
|
| 66 | - } |
|
| 58 | + if ($var = $collection |
|
| 59 | + ->where('key', $key) |
|
| 60 | + ->whereIn('locale', [$this->locale, null]) |
|
| 61 | + //->orWhere('locale', null) |
|
| 62 | + ->first()) { |
|
| 63 | + |
|
| 64 | + return $var->value; |
|
| 65 | + } |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - return $default; |
|
| 68 | + return $default; |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | public function set(string $key, $value = null, $locale = null) |
@@ -26,8 +26,8 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | public function __construct($variableModel, $cacheRepository, $app = null) |
| 28 | 28 | { |
| 29 | - if (! $app) { |
|
| 30 | - $app = app(); //Fallback when $app is not given |
|
| 29 | + if (!$app) { |
|
| 30 | + $app = app(); //Fallback when $app is not given |
|
| 31 | 31 | } |
| 32 | 32 | $this->app = $app; |
| 33 | 33 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | { |
| 48 | 48 | if ($useCache === false) { |
| 49 | 49 | $var = $this->variableModel->where('key', $key) |
| 50 | - ->when($this->locale, function ($q) { |
|
| 50 | + ->when($this->locale, function($q) { |
|
| 51 | 51 | $q->where('locale', $this->locale); |
| 52 | 52 | }) |
| 53 | 53 | ->first(); |
@@ -120,11 +120,11 @@ discard block |
||
| 120 | 120 | protected function getCollection() |
| 121 | 121 | { |
| 122 | 122 | try { |
| 123 | - return $this->cacheRepository->remember($this->config['cache']['name'], $this->config['cache']['time'], function () { |
|
| 123 | + return $this->cacheRepository->remember($this->config['cache']['name'], $this->config['cache']['time'], function() { |
|
| 124 | 124 | return $this->variableModel->select('key', 'value', 'locale')->get(); |
| 125 | 125 | }); |
| 126 | 126 | } catch (\Exception $exception) { |
| 127 | - $this->app['log']->info(__CLASS__ . ': ' . $exception->getMessage()); |
|
| 127 | + $this->app['log']->info(__CLASS__.': '.$exception->getMessage()); |
|
| 128 | 128 | |
| 129 | 129 | return false; |
| 130 | 130 | } |