@@ -6,6 +6,6 @@ |
||
6 | 6 | { |
7 | 7 | protected function rememberForever(string $key, $value) |
8 | 8 | { |
9 | - return cache()->rememberForever('repository.' . static::class . '.' . $key, $value); |
|
9 | + return cache()->rememberForever('repository.'.static::class.'.'.$key, $value); |
|
10 | 10 | } |
11 | 11 | } |
@@ -10,25 +10,25 @@ |
||
10 | 10 | { |
11 | 11 | public function register() |
12 | 12 | { |
13 | - Menu::macro('front', function () { |
|
13 | + Menu::macro('front', function() { |
|
14 | 14 | return Menu::new()->setActiveFromRequest(locale()); |
15 | 15 | }); |
16 | 16 | |
17 | - Menu::macro('main', function () { |
|
17 | + Menu::macro('main', function() { |
|
18 | 18 | return Menu::front() |
19 | 19 | ->addClass('nav navbar-nav') |
20 | 20 | ->url('/', 'Home'); |
21 | 21 | }); |
22 | 22 | |
23 | - Menu::macro('language', function () { |
|
24 | - return locales()->reduce(function (Menu $menu, string $locale) { |
|
23 | + Menu::macro('language', function() { |
|
24 | + return locales()->reduce(function(Menu $menu, string $locale) { |
|
25 | 25 | $menu->url($locale, $locale); |
26 | 26 | }, Menu::front()); |
27 | 27 | }); |
28 | 28 | |
29 | - Menu::macro('articleSiblings', function (Article $article) { |
|
29 | + Menu::macro('articleSiblings', function(Article $article) { |
|
30 | 30 | return app(ArticleRepository::class)->getSiblings($article) |
31 | - ->reduce(function (Menu $menu, Article $article) { |
|
31 | + ->reduce(function(Menu $menu, Article $article) { |
|
32 | 32 | return $menu->url($article->fullUrl, $article->name); |
33 | 33 | }, Menu::front()); |
34 | 34 | }); |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | { |
35 | 35 | return Cache::rememberForever( |
36 | 36 | "article.findByTechnicalName.{$technicalName}", |
37 | - function () use ($technicalName): Article { |
|
37 | + function() use ($technicalName): Article { |
|
38 | 38 | $article = static::where('technical_name', $technicalName)->first(); |
39 | 39 | |
40 | 40 | if ($article === null) { |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | { |
51 | 51 | return Cache::rememberForever( |
52 | 52 | "article.getWithTechnicalNameLike.{$technicalName}", |
53 | - function () use ($technicalName): Collection { |
|
53 | + function() use ($technicalName): Collection { |
|
54 | 54 | return static::where('technical_name', 'like', "{$technicalName}.%") |
55 | 55 | ->orderBy('order_column') |
56 | 56 | ->get(); |
@@ -89,14 +89,14 @@ discard block |
||
89 | 89 | $localeSegment = ''; |
90 | 90 | |
91 | 91 | if (locales()->count() > 1) { |
92 | - $localeSegment = "/" . locale(); |
|
92 | + $localeSegment = "/".locale(); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | if ($this->technical_name === SpecialArticle::HOME) { |
96 | 96 | return $localeSegment; |
97 | 97 | } |
98 | 98 | |
99 | - $parentUrl = $this->hasParentArticle() ? $this->parentArticle->url . '/' : ''; |
|
99 | + $parentUrl = $this->hasParentArticle() ? $this->parentArticle->url.'/' : ''; |
|
100 | 100 | |
101 | 101 | return "{$localeSegment}/{$parentUrl}{$this->url}"; |
102 | 102 | } |
@@ -2,24 +2,24 @@ discard block |
||
2 | 2 | |
3 | 3 | Route::demoAccess('/demo'); |
4 | 4 | |
5 | -Route::get('coming-soon', function () { |
|
5 | +Route::get('coming-soon', function() { |
|
6 | 6 | return view('temp/index'); |
7 | 7 | }); |
8 | 8 | |
9 | -Route::group(['namespace' => 'Back', 'prefix' => 'blender'], function () { |
|
9 | +Route::group(['namespace' => 'Back', 'prefix' => 'blender'], function() { |
|
10 | 10 | |
11 | 11 | require __DIR__.'/back_auth.php'; |
12 | 12 | |
13 | - Route::group(['middleware' => 'auth'], function () { |
|
13 | + Route::group(['middleware' => 'auth'], function() { |
|
14 | 14 | require __DIR__.'/back.php'; |
15 | 15 | }); |
16 | 16 | }); |
17 | 17 | |
18 | -Route::group(['namespace' => 'Front', 'middleware' => ['demoMode', 'rememberLocale']], function () { |
|
18 | +Route::group(['namespace' => 'Front', 'middleware' => ['demoMode', 'rememberLocale']], function() { |
|
19 | 19 | |
20 | 20 | $multiLingual = count(config('app.locales')) > 1; |
21 | 21 | |
22 | - Route::group($multiLingual ? ['prefix' => locale()] : [], function () { |
|
22 | + Route::group($multiLingual ? ['prefix' => locale()] : [], function() { |
|
23 | 23 | try { |
24 | 24 | require __DIR__.'/front_auth.php'; |
25 | 25 | require __DIR__.'/front.php'; |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | }); |
30 | 30 | |
31 | 31 | if ($multiLingual) { |
32 | - Route::get('/', function () { |
|
32 | + Route::get('/', function() { |
|
33 | 33 | return redirect(locale()); |
34 | 34 | }); |
35 | 35 | } |
@@ -17,6 +17,6 @@ |
||
17 | 17 | */ |
18 | 18 | public function handle($request, Closure $next) |
19 | 19 | { |
20 | - return $next($request)->withCookie('locale', app()->getLocale(), 60 * 24 * 365 * 5); |
|
20 | + return $next($request)->withCookie('locale', app()->getLocale(), 60 * 24 * 365 * 5); |
|
21 | 21 | } |
22 | 22 | } |
@@ -32,7 +32,7 @@ |
||
32 | 32 | public static function findByNameOrCreate(string $name, TagType $type): Tag |
33 | 33 | { |
34 | 34 | $existing = self::nonDraft()->get() |
35 | - ->first(function (int $id, Tag $tag) use ($name, $type) { |
|
35 | + ->first(function(int $id, Tag $tag) use ($name, $type) { |
|
36 | 36 | return $tag->translate('name', content_locale()) === $name && $tag->type === (string) $type; |
37 | 37 | }); |
38 | 38 |
@@ -20,9 +20,9 @@ |
||
20 | 20 | |
21 | 21 | public function renderMetaTags(): string |
22 | 22 | { |
23 | - return $this->seo()->filter(function ($value, $key) { |
|
23 | + return $this->seo()->filter(function($value, $key) { |
|
24 | 24 | return starts_with($key, 'meta_'); |
25 | - })->map(function ($value, $key): string { |
|
25 | + })->map(function($value, $key): string { |
|
26 | 26 | $key = substr($key, 5); |
27 | 27 | $attribute = starts_with($key, 'og:') ? 'property' : 'name'; |
28 | 28 | return "<meta {$attribute}=\"{$key}\" content=\"{$value}\">"; |
@@ -11,15 +11,15 @@ discard block |
||
11 | 11 | protected function updateSeoValues() |
12 | 12 | { |
13 | 13 | collect($this->request->all()) |
14 | - ->filter(function ($value, $fieldName) { |
|
14 | + ->filter(function($value, $fieldName) { |
|
15 | 15 | // Filter out everything that starts with 'translated_<locale>_seo_' |
16 | 16 | return Regex::match('/^translated_([a-z][a-z])_seo_/', $fieldName)->hasMatch(); |
17 | 17 | }) |
18 | - ->map(function ($value, $fieldName) { |
|
18 | + ->map(function($value, $fieldName) { |
|
19 | 19 | |
20 | 20 | // Replace 'translated_<locale>_seo_<attribute>' with '<locale>_<attribute>' |
21 | - $localeAndAttribute = Regex::replace('/translated_([a-z][a-z])_seo_/', function (MatchResult $matchResult) { |
|
22 | - return $matchResult->group(1) . '_'; |
|
21 | + $localeAndAttribute = Regex::replace('/translated_([a-z][a-z])_seo_/', function(MatchResult $matchResult) { |
|
22 | + return $matchResult->group(1).'_'; |
|
23 | 23 | }, $fieldName)->result(); |
24 | 24 | |
25 | 25 | $localeAndAttribute = explode('_', $localeAndAttribute, 2); |
@@ -31,12 +31,12 @@ discard block |
||
31 | 31 | ]; |
32 | 32 | }) |
33 | 33 | ->groupBy('locale') |
34 | - ->map(function (Collection $valuesInLocale) { |
|
35 | - return $valuesInLocale->mapToAssoc(function ($values) { |
|
34 | + ->map(function(Collection $valuesInLocale) { |
|
35 | + return $valuesInLocale->mapToAssoc(function($values) { |
|
36 | 36 | return [$values['attribute'], $values['value']]; |
37 | 37 | }); |
38 | 38 | }) |
39 | - ->each(function ($values, $locale) { |
|
39 | + ->each(function($values, $locale) { |
|
40 | 40 | $this->model->setTranslation('seo_values', $locale, $values); |
41 | 41 | }); |
42 | 42 | } |
@@ -49,8 +49,7 @@ |
||
49 | 49 | 'meta_og:type' => 'website', |
50 | 50 | 'meta_og:description' => (string) string($this->text)->tease(155), |
51 | 51 | 'meta_og:image' => $this->hasMedia('images') ? |
52 | - url($this->getFirstMediaUrl('images')) : |
|
53 | - url('/images/og-image.png'), |
|
52 | + url($this->getFirstMediaUrl('images')) : url('/images/og-image.png'), |
|
54 | 53 | ]; |
55 | 54 | } |
56 | 55 | } |