@@ -21,13 +21,11 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @return void |
23 | 23 | */ |
24 | - public function up() |
|
25 | - { |
|
24 | + public function up() { |
|
26 | 25 | DB::beginTransaction(); |
27 | 26 | |
28 | 27 | // Create table for storing roles |
29 | - Schema::create('translation_identifiers', function (Blueprint $table) |
|
30 | - { |
|
28 | + Schema::create('translation_identifiers', function (Blueprint $table) { |
|
31 | 29 | $table->increments('id')->unique(); |
32 | 30 | $table->text('identifier'); |
33 | 31 | |
@@ -41,8 +39,7 @@ discard block |
||
41 | 39 | }); |
42 | 40 | |
43 | 41 | // Create table for storing roles |
44 | - Schema::create('translations', function (Blueprint $table) |
|
45 | - { |
|
42 | + Schema::create('translations', function (Blueprint $table) { |
|
46 | 43 | $table->integer('translation_identifier_id')->unsigned(); |
47 | 44 | $table->foreign('translation_identifier_id')->references('id')->on('translation_identifiers')->onDelete('no action')->onUpdate('no action'); |
48 | 45 | |
@@ -64,8 +61,7 @@ discard block |
||
64 | 61 | * |
65 | 62 | * @return void |
66 | 63 | */ |
67 | - public function down() |
|
68 | - { |
|
64 | + public function down() { |
|
69 | 65 | Schema::drop('translations'); |
70 | 66 | Schema::drop('translation_identifiers'); |
71 | 67 | } |
@@ -24,9 +24,9 @@ discard block |
||
24 | 24 | */ |
25 | 25 | public function register() |
26 | 26 | { |
27 | - $this->mergeConfigFrom(__DIR__.'/../config/translator.php', 'translator'); |
|
27 | + $this->mergeConfigFrom(__DIR__ . '/../config/translator.php', 'translator'); |
|
28 | 28 | |
29 | - $this->app->singleton('Translator', function () { |
|
29 | + $this->app->singleton('Translator', function() { |
|
30 | 30 | return new Translator(); |
31 | 31 | } |
32 | 32 | ); |
@@ -43,9 +43,9 @@ discard block |
||
43 | 43 | 'config' |
44 | 44 | ); |
45 | 45 | |
46 | - $this->loadMigrationsFrom(__DIR__.'/../migrations/'); |
|
47 | - $this->loadRoutesFrom(__DIR__.'/../resources/routes.php'); |
|
48 | - $this->loadViewsFrom(__DIR__.'/../resources/views', 'translator'); |
|
46 | + $this->loadMigrationsFrom(__DIR__ . '/../migrations/'); |
|
47 | + $this->loadRoutesFrom(__DIR__ . '/../resources/routes.php'); |
|
48 | + $this->loadViewsFrom(__DIR__ . '/../resources/views', 'translator'); |
|
49 | 49 | |
50 | 50 | if ($this->app->runningInConsole()) { |
51 | 51 | $this->commands([ |
@@ -22,8 +22,7 @@ discard block |
||
22 | 22 | /** |
23 | 23 | * Register any application services. |
24 | 24 | */ |
25 | - public function register() |
|
26 | - { |
|
25 | + public function register() { |
|
27 | 26 | $this->mergeConfigFrom(__DIR__.'/../config/translator.php', 'translator'); |
28 | 27 | |
29 | 28 | $this->app->singleton('Translator', function () { |
@@ -35,8 +34,7 @@ discard block |
||
35 | 34 | /** |
36 | 35 | * Bootstrap any application services. |
37 | 36 | */ |
38 | - public function boot() |
|
39 | - { |
|
37 | + public function boot() { |
|
40 | 38 | $this->publishes([ |
41 | 39 | __DIR__ . '/../config/translator.php' => config_path('translator.php'), |
42 | 40 | ], |
@@ -22,8 +22,7 @@ discard block |
||
22 | 22 | /** |
23 | 23 | * Bootstrap any application services. |
24 | 24 | */ |
25 | - public function boot() |
|
26 | - { |
|
25 | + public function boot() { |
|
27 | 26 | Blade::directive('translate', function ($expression) { |
28 | 27 | |
29 | 28 | $expression = $this->stripParentheses($expression); |
@@ -49,8 +48,7 @@ discard block |
||
49 | 48 | * @param string $expression |
50 | 49 | * @return string |
51 | 50 | */ |
52 | - public function stripParentheses($expression) |
|
53 | - { |
|
51 | + public function stripParentheses($expression) { |
|
54 | 52 | if (Str::startsWith($expression, '(')) { |
55 | 53 | $expression = substr($expression, 1, -1); |
56 | 54 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | $query = TranslationIdentifier::with('translations'); |
36 | 36 | |
37 | 37 | if ($locale != '') { |
38 | - $query = $query->whereDoesntHave('translations', function ($query) use ($locale) |
|
38 | + $query = $query->whereDoesntHave('translations', function($query) use ($locale) |
|
39 | 39 | { |
40 | 40 | $query->where('translations.locale', 'like', $locale); |
41 | 41 | } |
@@ -43,12 +43,12 @@ discard block |
||
43 | 43 | } |
44 | 44 | |
45 | 45 | if ($search != '') { |
46 | - $query = $query->where(function ($query) use ($search) { |
|
47 | - $query ->where('identifier', 'LIKE', '%'.$search.'%') |
|
48 | - ->orWhere('parameters', 'LIKE', '%'.$search.'%') |
|
49 | - ->orWhere('group', 'LIKE', '%'.$search.'%') |
|
50 | - ->orWhere('page_name', 'LIKE', '%'.$search.'%') |
|
51 | - ->orWhere('description','LIKE', '%'.$search.'%'); |
|
46 | + $query = $query->where(function($query) use ($search) { |
|
47 | + $query ->where('identifier', 'LIKE', '%' . $search . '%') |
|
48 | + ->orWhere('parameters', 'LIKE', '%' . $search . '%') |
|
49 | + ->orWhere('group', 'LIKE', '%' . $search . '%') |
|
50 | + ->orWhere('page_name', 'LIKE', '%' . $search . '%') |
|
51 | + ->orWhere('description', 'LIKE', '%' . $search . '%'); |
|
52 | 52 | }); |
53 | 53 | } |
54 | 54 | |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | * @param $state string 'enabled|disabled' |
169 | 169 | * @return \Illuminate\Http\RedirectResponse |
170 | 170 | */ |
171 | - public function changeLiveMode ($state) |
|
171 | + public function changeLiveMode($state) |
|
172 | 172 | { |
173 | 173 | if ($state == 'enable') { |
174 | 174 | session(['translation_live_mode' => true]); |
@@ -27,16 +27,14 @@ discard block |
||
27 | 27 | * |
28 | 28 | * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View |
29 | 29 | */ |
30 | - public function index() |
|
31 | - { |
|
30 | + public function index() { |
|
32 | 31 | $search = Input::get('search', ''); |
33 | 32 | $locale = Input::get('locale', ''); |
34 | 33 | |
35 | 34 | $query = TranslationIdentifier::with('translations'); |
36 | 35 | |
37 | 36 | if ($locale != '') { |
38 | - $query = $query->whereDoesntHave('translations', function ($query) use ($locale) |
|
39 | - { |
|
37 | + $query = $query->whereDoesntHave('translations', function ($query) use ($locale) { |
|
40 | 38 | $query->where('translations.locale', 'like', $locale); |
41 | 39 | } |
42 | 40 | ); |
@@ -73,8 +71,7 @@ discard block |
||
73 | 71 | * @param integer $id ID of the translation Identifier to edit |
74 | 72 | * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View |
75 | 73 | */ |
76 | - public function edit($id) |
|
77 | - { |
|
74 | + public function edit($id) { |
|
78 | 75 | $identifier = TranslationIdentifier::findOrFail($id); |
79 | 76 | |
80 | 77 | $available_locales = TranslatorFacade::getConfigValue('available_locales'); |
@@ -97,8 +94,7 @@ discard block |
||
97 | 94 | * @param Request $request Object with the values of the identifier |
98 | 95 | * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View |
99 | 96 | */ |
100 | - public function postEdit($id, Request $request) |
|
101 | - { |
|
97 | + public function postEdit($id, Request $request) { |
|
102 | 98 | TranslationIdentifier::findOrFail($id); |
103 | 99 | |
104 | 100 | foreach ($request->all() as $key => $value) { |
@@ -131,8 +127,7 @@ discard block |
||
131 | 127 | * @param Request $request Request with multiple values of identifiers to update |
132 | 128 | * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View |
133 | 129 | */ |
134 | - public function postIdentifier(Request $request) |
|
135 | - { |
|
130 | + public function postIdentifier(Request $request) { |
|
136 | 131 | /** @var TranslationIdentifier $translation_identifiers */ |
137 | 132 | $translation_identifiers = TranslationIdentifier::all()->whereIn('id', array_keys($request->all())); |
138 | 133 | |
@@ -159,8 +154,7 @@ discard block |
||
159 | 154 | * |
160 | 155 | * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View |
161 | 156 | */ |
162 | - public function test() |
|
163 | - { |
|
157 | + public function test() { |
|
164 | 158 | return view('translator::test'); |
165 | 159 | } |
166 | 160 | |
@@ -168,8 +162,7 @@ discard block |
||
168 | 162 | * @param $state string 'enabled|disabled' |
169 | 163 | * @return \Illuminate\Http\RedirectResponse |
170 | 164 | */ |
171 | - public function changeLiveMode ($state) |
|
172 | - { |
|
165 | + public function changeLiveMode ($state) { |
|
173 | 166 | if ($state == 'enable') { |
174 | 167 | session(['translation_live_mode' => true]); |
175 | 168 | } else { |