@@ -25,8 +25,8 @@ |
||
25 | 25 | |
26 | 26 | public function index() |
27 | 27 | { |
28 | - $tags = Tag::get()->reduce(function (Collection $carry, Tag $tag) { |
|
29 | - if (! $carry->has($tag->type)) { |
|
28 | + $tags = Tag::get()->reduce(function(Collection $carry, Tag $tag) { |
|
29 | + if (!$carry->has($tag->type)) { |
|
30 | 30 | $carry->put($tag->type, new Collection()); |
31 | 31 | } |
32 | 32 |
@@ -10,7 +10,7 @@ |
||
10 | 10 | { |
11 | 11 | public function getRedirectsFor(Request $request): array |
12 | 12 | { |
13 | - return Redirect::getAll()->flatMap(function ($redirect) { |
|
13 | + return Redirect::getAll()->flatMap(function($redirect) { |
|
14 | 14 | return [$redirect->old_url => $redirect->new_url]; |
15 | 15 | })->toArray(); |
16 | 16 | } |
@@ -38,10 +38,10 @@ |
||
38 | 38 | public function edit(int $id) |
39 | 39 | { |
40 | 40 | $parentMenuItems = ArticleRepository::getTopLevel() |
41 | - ->filter(function (Article $article) { |
|
41 | + ->filter(function(Article $article) { |
|
42 | 42 | return $article->technical_name != SpecialArticle::HOME; |
43 | 43 | }) |
44 | - ->reject(function (Article $article) use ($id) { |
|
44 | + ->reject(function(Article $article) use ($id) { |
|
45 | 45 | return $article->id === $id; |
46 | 46 | }) |
47 | 47 | ->pluck('name', 'id') |
@@ -9,29 +9,29 @@ |
||
9 | 9 | { |
10 | 10 | public function register() |
11 | 11 | { |
12 | - Menu::macro('front', function () { |
|
12 | + Menu::macro('front', function() { |
|
13 | 13 | return Menu::new()->setActiveFromRequest(locale()); |
14 | 14 | }); |
15 | 15 | |
16 | - Menu::macro('main', function () { |
|
16 | + Menu::macro('main', function() { |
|
17 | 17 | return Menu::front() |
18 | 18 | ->addClass('nav__list') |
19 | 19 | ->url('/', 'Home'); |
20 | 20 | }); |
21 | 21 | |
22 | - Menu::macro('language', function () { |
|
23 | - return Menu::build(locales(), function (Menu $menu, string $locale) { |
|
22 | + Menu::macro('language', function() { |
|
23 | + return Menu::build(locales(), function(Menu $menu, string $locale) { |
|
24 | 24 | return $menu->url($locale, strtoupper($locale)); |
25 | 25 | })->setActiveFromRequest(); |
26 | 26 | }); |
27 | 27 | |
28 | - Menu::macro('articleSiblings', function (Article $article) { |
|
29 | - return $article->siblings->reduce(function (Menu $menu, Article $article) { |
|
28 | + Menu::macro('articleSiblings', function(Article $article) { |
|
29 | + return $article->siblings->reduce(function(Menu $menu, Article $article) { |
|
30 | 30 | return $menu->url($article->fullUrl, $article->name); |
31 | 31 | }, Menu::front()); |
32 | 32 | }); |
33 | 33 | |
34 | - Menu::macro('article', function ($article) { |
|
34 | + Menu::macro('article', function($article) { |
|
35 | 35 | $article = $article instanceof Article ? $article : article($article); |
36 | 36 | |
37 | 37 | return $this->url($article->url, $article->name); |
@@ -30,10 +30,10 @@ |
||
30 | 30 | { |
31 | 31 | return Cache::rememberForever( |
32 | 32 | "article.specialArticle.{$specialArticle}", |
33 | - function () use ($specialArticle) { |
|
33 | + function() use ($specialArticle) { |
|
34 | 34 | $article = Article::where('technical_name', $specialArticle)->first(); |
35 | 35 | |
36 | - if (! $article) { |
|
36 | + if (!$article) { |
|
37 | 37 | throw new Exception("There is no article with technical_name `{$specialArticle}`"); |
38 | 38 | } |
39 | 39 |
@@ -4,7 +4,6 @@ |
||
4 | 4 | |
5 | 5 | use App\Models\Article; |
6 | 6 | use Illuminate\Support\Collection; |
7 | -use App\Models\Enums\SpecialArticle; |
|
8 | 7 | use Illuminate\Support\Facades\Cache; |
9 | 8 | |
10 | 9 | class ArticleRepository |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | public function isSpecialArticle($specialArticleName = ''): bool |
43 | 43 | { |
44 | 44 | if ($specialArticleName === '') { |
45 | - return ! empty($this->technical_name); |
|
45 | + return !empty($this->technical_name); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | return $this->technical_name === $specialArticleName; |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | public function getFirstChildAttribute(): Article |
62 | 62 | { |
63 | - if (! $this->hasChildren()) { |
|
63 | + if (!$this->hasChildren()) { |
|
64 | 64 | throw new Exception("Article `{$this->id}` doesn't have any children."); |
65 | 65 | } |
66 | 66 | |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | |
82 | 82 | public function hasParent(): bool |
83 | 83 | { |
84 | - return ! is_null($this->parent); |
|
84 | + return !is_null($this->parent); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | public function getUrlAttribute(): string |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | */ |
37 | 37 | function current_front_user() |
38 | 38 | { |
39 | - if (! auth()->guard('front')->check()) { |
|
39 | + if (!auth()->guard('front')->check()) { |
|
40 | 40 | return; |
41 | 41 | } |
42 | 42 | |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | */ |
49 | 49 | function current_back_user() |
50 | 50 | { |
51 | - if (! auth()->guard('back')->check()) { |
|
51 | + if (!auth()->guard('back')->check()) { |
|
52 | 52 | return; |
53 | 53 | } |
54 | 54 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | |
80 | 80 | function fragment_image($name, $conversion = 'thumb'): string |
81 | 81 | { |
82 | - if (! str_contains($name, '.')) { |
|
82 | + if (!str_contains($name, '.')) { |
|
83 | 83 | return $name; |
84 | 84 | } |
85 | 85 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | ->where('key', $key) |
91 | 91 | ->first(); |
92 | 92 | |
93 | - if (! $fragment) { |
|
93 | + if (!$fragment) { |
|
94 | 94 | return $name; |
95 | 95 | } |
96 | 96 | |
@@ -110,15 +110,13 @@ discard block |
||
110 | 110 | function login_url(): string |
111 | 111 | { |
112 | 112 | return request()->isFront() ? |
113 | - action('Front\Auth\LoginController@showLoginForm') : |
|
114 | - action('Back\Auth\LoginController@showLoginForm'); |
|
113 | + action('Front\Auth\LoginController@showLoginForm') : action('Back\Auth\LoginController@showLoginForm'); |
|
115 | 114 | } |
116 | 115 | |
117 | 116 | function logout_url(): string |
118 | 117 | { |
119 | 118 | return request()->isFront() ? |
120 | - action('Front\Auth\LoginController@logout') : |
|
121 | - action('Back\Auth\LoginController@logout'); |
|
119 | + action('Front\Auth\LoginController@logout') : action('Back\Auth\LoginController@logout'); |
|
122 | 120 | } |
123 | 121 | |
124 | 122 | function roman_year(int $year = null): string |
@@ -179,11 +177,11 @@ discard block |
||
179 | 177 | */ |
180 | 178 | function validate($fields, $rules): bool |
181 | 179 | { |
182 | - if (! is_array($fields)) { |
|
180 | + if (!is_array($fields)) { |
|
183 | 181 | $fields = ['default' => $fields]; |
184 | 182 | } |
185 | 183 | |
186 | - if (! is_array($rules)) { |
|
184 | + if (!is_array($rules)) { |
|
187 | 185 | $rules = ['default' => $rules]; |
188 | 186 | } |
189 | 187 |