@@ -53,7 +53,7 @@ |
||
53 | 53 | $this->info('Migration successfully created!'); |
54 | 54 | } else { |
55 | 55 | $this->error( |
56 | - 'Couldn\'t create migration.'.PHP_EOL.' Check the write permissions |
|
56 | + 'Couldn\'t create migration.' . PHP_EOL . ' Check the write permissions |
|
57 | 57 | within the database/migrations directory.' |
58 | 58 | ); |
59 | 59 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | ); |
44 | 44 | |
45 | 45 | // Register blade directives |
46 | - Blade::directive('t', function ($expression) { |
|
46 | + Blade::directive('t', function($expression) { |
|
47 | 47 | return "<?php echo e(t({$expression})); ?>"; |
48 | 48 | }); |
49 | 49 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | $configPath = __DIR__ . '/../config/config.php'; |
60 | 60 | $this->mergeConfigFrom($configPath, 'debugbar'); |
61 | 61 | |
62 | - $this->app->singleton('multilang', function ($app) { |
|
62 | + $this->app->singleton('multilang', function($app) { |
|
63 | 63 | $locale = $app->getLocale(); |
64 | 64 | $environment = $app->environment(); |
65 | 65 | $config = $app['config']->get('multilang'); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $multilang->setLocale($locale); |
75 | 75 | |
76 | 76 | if ($multilang->autoSaveIsAllowed()) { |
77 | - $app->terminating(function () use ($multilang) { |
|
77 | + $app->terminating(function() use ($multilang) { |
|
78 | 78 | return $multilang->saveTexts(); |
79 | 79 | }); |
80 | 80 | } |
@@ -85,13 +85,13 @@ discard block |
||
85 | 85 | $this->app->alias('multilang', 'Longman\LaravelMultiLang\MultiLang'); |
86 | 86 | |
87 | 87 | $this->app['command.multilang.migration'] = $this->app->share( |
88 | - function () { |
|
88 | + function() { |
|
89 | 89 | return new MigrationCommand(); |
90 | 90 | } |
91 | 91 | ); |
92 | 92 | |
93 | 93 | $this->app['command.multilang.texts'] = $this->app->share( |
94 | - function () { |
|
94 | + function() { |
|
95 | 95 | return new TextsCommand(); |
96 | 96 | } |
97 | 97 | ); |
@@ -119,6 +119,9 @@ discard block |
||
119 | 119 | return $config; |
120 | 120 | } |
121 | 121 | |
122 | + /** |
|
123 | + * @param string $key |
|
124 | + */ |
|
122 | 125 | public function getConfig($key = null) |
123 | 126 | { |
124 | 127 | if ($key === null) { |
@@ -132,7 +135,6 @@ discard block |
||
132 | 135 | * Set locale and load texts |
133 | 136 | * |
134 | 137 | * @param string $lang |
135 | - * @param string $default_lang |
|
136 | 138 | * @param array $texts |
137 | 139 | * @return void |
138 | 140 | */ |
@@ -210,7 +212,7 @@ discard block |
||
210 | 212 | /** |
211 | 213 | * Get texts |
212 | 214 | * |
213 | - * @return array |
|
215 | + * @return string|null |
|
214 | 216 | */ |
215 | 217 | public function getRedirectUrl(Request $request) |
216 | 218 | { |
@@ -313,6 +315,9 @@ discard block |
||
313 | 315 | return $this; |
314 | 316 | } |
315 | 317 | |
318 | + /** |
|
319 | + * @param string|null $lang |
|
320 | + */ |
|
316 | 321 | public function loadTextsFromDatabase($lang) |
317 | 322 | { |
318 | 323 | $texts = $lang ? $this->db->table($this->getTableName()) |
@@ -333,6 +338,9 @@ discard block |
||
333 | 338 | return $texts; |
334 | 339 | } |
335 | 340 | |
341 | + /** |
|
342 | + * @param string $lang |
|
343 | + */ |
|
336 | 344 | public function setCacheName($lang) |
337 | 345 | { |
338 | 346 | $this->cache_name = $this->getConfig('texts_table') . '_' . $lang; |
@@ -245,7 +245,7 @@ |
||
245 | 245 | |
246 | 246 | public function detectLocale(Request $request) |
247 | 247 | { |
248 | - $locale = $request->segment(1); |
|
248 | + $locale = $request->segment(1); |
|
249 | 249 | $locales = $this->getConfig('locales'); |
250 | 250 | |
251 | 251 | if (isset($locales[$locale])) { |