@@ -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 | } |
@@ -24,10 +24,10 @@ |
||
24 | 24 | $options['scope'] = $request->scope; |
25 | 25 | } |
26 | 26 | |
27 | - $texts = Text::where(function ($q) use ($options) { |
|
27 | + $texts = Text::where(function($q) use ($options) { |
|
28 | 28 | foreach ($options as $k => $v) { |
29 | 29 | if ($k == 'keyword') { |
30 | - $q->where(function ($query) use ($v) { |
|
30 | + $q->where(function($query) use ($v) { |
|
31 | 31 | $query->where('key', 'LIKE', '%' . $v . '%')->orWhere('value', 'LIKE', '%' . $v . '%'); |
32 | 32 | }); |
33 | 33 | } else { |
@@ -28,16 +28,15 @@ |
||
28 | 28 | /** |
29 | 29 | * Create a new MultiLang instance. |
30 | 30 | * |
31 | - * @param string $environment |
|
32 | - * @param array $config |
|
33 | - * @param \Illuminate\Cache\CacheManager $cache |
|
34 | - * @param \Illuminate\Database\DatabaseManager $db |
|
35 | 31 | */ |
36 | 32 | public function __construct(array $data) |
37 | 33 | { |
38 | 34 | $this->data = $data; |
39 | 35 | } |
40 | 36 | |
37 | + /** |
|
38 | + * @param string $key |
|
39 | + */ |
|
41 | 40 | public function get($key = null, $default = null) |
42 | 41 | { |
43 | 42 | $array = $this->data; |
@@ -12,9 +12,6 @@ |
||
12 | 12 | |
13 | 13 | use Illuminate\Cache\CacheManager as Cache; |
14 | 14 | use Illuminate\Database\DatabaseManager as Database; |
15 | -use Illuminate\Http\Request; |
|
16 | -use Illuminate\Support\Collection; |
|
17 | -use InvalidArgumentException; |
|
18 | 15 | use Longman\LaravelMultiLang\Config; |
19 | 16 | |
20 | 17 | class Repository |
@@ -59,8 +59,7 @@ discard block |
||
59 | 59 | /** |
60 | 60 | * Create a new MultiLang instance. |
61 | 61 | * |
62 | - * @param string $environment |
|
63 | - * @param array $config |
|
62 | + * @param Config $config |
|
64 | 63 | * @param \Illuminate\Cache\CacheManager $cache |
65 | 64 | * @param \Illuminate\Database\DatabaseManager $db |
66 | 65 | */ |
@@ -149,6 +148,9 @@ discard block |
||
149 | 148 | } |
150 | 149 | |
151 | 150 | |
151 | + /** |
|
152 | + * @return string |
|
153 | + */ |
|
152 | 154 | protected function getTableName() |
153 | 155 | { |
154 | 156 | $table = $this->config->get('db.texts_table', 'texts'); |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | /** |
172 | 172 | * Get texts |
173 | 173 | * |
174 | - * @return array |
|
174 | + * @return string|null |
|
175 | 175 | */ |
176 | 176 | public function getRedirectUrl(Request $request) |
177 | 177 | { |
@@ -203,6 +203,9 @@ discard block |
||
203 | 203 | return null; |
204 | 204 | } |
205 | 205 | |
206 | + /** |
|
207 | + * @return string |
|
208 | + */ |
|
206 | 209 | public function detectLocale(Request $request) |
207 | 210 | { |
208 | 211 | $locale = $request->segment(1); |
@@ -48,11 +48,11 @@ discard block |
||
48 | 48 | ); |
49 | 49 | |
50 | 50 | // Register blade directives |
51 | - Blade::directive('t', function ($expression) { |
|
51 | + Blade::directive('t', function($expression) { |
|
52 | 52 | return "<?php echo e(t({$expression})); ?>"; |
53 | 53 | }); |
54 | 54 | |
55 | - $this->app['events']->listen('locale.changed', function ($locale) { |
|
55 | + $this->app['events']->listen('locale.changed', function($locale) { |
|
56 | 56 | $this->app['multilang']->setLocale($locale); |
57 | 57 | }); |
58 | 58 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | $route = $this->app['config']->get('multilang.text-route.route', 'texts'); |
73 | 73 | $controller = $this->app['config']->get('multilang.text-route.controller', '\Longman\LaravelMultiLang\Controllers\TextsController'); |
74 | 74 | foreach ($locales as $locale => $value) { |
75 | - Route::group(['prefix' => $locale], function ($router) use ($route, $controller) { |
|
75 | + Route::group(['prefix' => $locale], function($router) use ($route, $controller) { |
|
76 | 76 | $router->get( |
77 | 77 | $route, |
78 | 78 | $controller . '@index' |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | $configPath = __DIR__ . '/../config/config.php'; |
96 | 96 | $this->mergeConfigFrom($configPath, 'debugbar'); |
97 | 97 | |
98 | - $this->app->singleton('multilang', function ($app) { |
|
98 | + $this->app->singleton('multilang', function($app) { |
|
99 | 99 | $environment = $app->environment(); |
100 | 100 | $config = $app['config']->get('multilang'); |
101 | 101 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | ); |
108 | 108 | |
109 | 109 | if ($multilang->autoSaveIsAllowed()) { |
110 | - $app->terminating(function () use ($multilang) { |
|
110 | + $app->terminating(function() use ($multilang) { |
|
111 | 111 | return $multilang->saveTexts(); |
112 | 112 | }); |
113 | 113 | } |
@@ -118,13 +118,13 @@ discard block |
||
118 | 118 | $this->app->alias('multilang', 'Longman\LaravelMultiLang\MultiLang'); |
119 | 119 | |
120 | 120 | $this->app['command.multilang.migration'] = $this->app->share( |
121 | - function () { |
|
121 | + function() { |
|
122 | 122 | return new MigrationCommand(); |
123 | 123 | } |
124 | 124 | ); |
125 | 125 | |
126 | 126 | $this->app['command.multilang.texts'] = $this->app->share( |
127 | - function () { |
|
127 | + function() { |
|
128 | 128 | return new TextsCommand(); |
129 | 129 | } |
130 | 130 | ); |