@@ -25,14 +25,14 @@ |
||
25 | 25 | $links = Asset::with('media') |
26 | 26 | ->orderBy('created_at', 'DESC') |
27 | 27 | ->whereNotIn('id', $excluded) |
28 | - ->whereHas('media', function (Builder $query) use ($search) { |
|
28 | + ->whereHas('media', function(Builder $query) use ($search) { |
|
29 | 29 | $query->where('mime_type', 'LIKE', '%image%'); |
30 | - $query->where('name', 'LIKE', '%' . $search . '%'); |
|
30 | + $query->where('name', 'LIKE', '%'.$search.'%'); |
|
31 | 31 | }) |
32 | 32 | ->offset($offset) |
33 | 33 | ->limit($limit) |
34 | 34 | ->get() |
35 | - ->map(function ($asset) use ($conversion) { |
|
35 | + ->map(function($asset) use ($conversion) { |
|
36 | 36 | return [ |
37 | 37 | "id" => $asset->id, |
38 | 38 | "url" => $asset->url($conversion), |
@@ -18,17 +18,17 @@ |
||
18 | 18 | public function handle($request, Closure $next) |
19 | 19 | { |
20 | 20 | // Verifies a valid signature and still outside expiration period |
21 | - if (! $request->hasValidSignature()) { |
|
21 | + if (!$request->hasValidSignature()) { |
|
22 | 22 | return redirect()->route('invite.expired'); |
23 | 23 | } |
24 | 24 | |
25 | - if (! $invitation = Invitation::findByToken($request->token)) { |
|
25 | + if (!$invitation = Invitation::findByToken($request->token)) { |
|
26 | 26 | return redirect()->route('invite.expired'); |
27 | 27 | } |
28 | 28 | |
29 | 29 | if (in_array($invitation->getState(InvitationState::KEY), [InvitationState::accepted, InvitationState::revoked])) { |
30 | 30 | // We allow the user to pass if the invitee is already logged in. Otherwise the invite link cannot be reused. |
31 | - if (! auth()->guard('chief')->check() || ! auth()->guard('chief')->user()->is($invitation->invitee)) { |
|
31 | + if (!auth()->guard('chief')->check() || !auth()->guard('chief')->user()->is($invitation->invitee)) { |
|
32 | 32 | return redirect()->route('invite.expired'); |
33 | 33 | } |
34 | 34 | } |
@@ -62,12 +62,12 @@ discard block |
||
62 | 62 | |
63 | 63 | private function shouldRenderChiefException(Throwable $exception): bool |
64 | 64 | { |
65 | - return (Str::startsWith(request()->path(), 'admin/') && ! $exception instanceof AuthenticationException && ! $exception instanceof ValidationException); |
|
65 | + return (Str::startsWith(request()->path(), 'admin/') && !$exception instanceof AuthenticationException && !$exception instanceof ValidationException); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | protected function renderChiefException(\Illuminate\Http\Request $request, Throwable $exception) |
69 | 69 | { |
70 | - if (! config('app.debug')) { |
|
70 | + if (!config('app.debug')) { |
|
71 | 71 | if ($request->expectsJson()) { |
72 | 72 | return response()->json(['error' => 'Something went wrong.'], 404); |
73 | 73 | } |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | ], 401); |
102 | 102 | } |
103 | 103 | |
104 | - if (! empty($exception->guards()) && Arr::first($exception->guards()) == 'chief') { |
|
104 | + if (!empty($exception->guards()) && Arr::first($exception->guards()) == 'chief') { |
|
105 | 105 | return redirect()->guest(route('chief.back.login')); |
106 | 106 | } |
107 | 107 |
@@ -17,11 +17,11 @@ discard block |
||
17 | 17 | $firstname = null; |
18 | 18 | $lastname = null; |
19 | 19 | |
20 | - while (! $firstname) { |
|
20 | + while (!$firstname) { |
|
21 | 21 | $firstname = $this->ask('Firstname'); |
22 | 22 | } |
23 | 23 | |
24 | - while (! $lastname) { |
|
24 | + while (!$lastname) { |
|
25 | 25 | $lastname = $this->ask('Lastname'); |
26 | 26 | } |
27 | 27 | |
@@ -31,22 +31,22 @@ discard block |
||
31 | 31 | |
32 | 32 | if ($this->option('dev')) { |
33 | 33 | $role = 'developer'; |
34 | - } else { |
|
34 | + }else { |
|
35 | 35 | $role = 'admin'; |
36 | 36 | } |
37 | 37 | |
38 | 38 | $this->createUser($firstname, $lastname, $email, $password, [$role]); |
39 | 39 | |
40 | - $this->info($firstname . ' ' . $lastname . ' succesfully added as admin user.'); |
|
40 | + $this->info($firstname.' '.$lastname.' succesfully added as admin user.'); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | private function settingPermissionsAndRoles(): void |
44 | 44 | { |
45 | - AuthorizationDefaults::permissions()->each(function ($permissionName) { |
|
45 | + AuthorizationDefaults::permissions()->each(function($permissionName) { |
|
46 | 46 | Artisan::call('chief:permission', ['name' => $permissionName]); |
47 | 47 | }); |
48 | 48 | |
49 | - AuthorizationDefaults::roles()->each(function ($defaultPermissions, $roleName) { |
|
49 | + AuthorizationDefaults::roles()->each(function($defaultPermissions, $roleName) { |
|
50 | 50 | Artisan::call('chief:role', ['name' => $roleName, '--permissions' => implode(',', $defaultPermissions)]); |
51 | 51 | }); |
52 | 52 |
@@ -22,7 +22,7 @@ |
||
22 | 22 | { |
23 | 23 | $menuItems = MenuItem::all(); |
24 | 24 | |
25 | - $this->info(count($menuItems) . ' menuitems will be updated.'); |
|
25 | + $this->info(count($menuItems).' menuitems will be updated.'); |
|
26 | 26 | |
27 | 27 | foreach ($menuItems as $menuItem) { |
28 | 28 | $this->projectModelData->handleByMenuItem($menuItem); |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | $role->givePermissionTo($request->permission_names); |
39 | 39 | |
40 | 40 | return redirect()->route('chief.back.roles.index') |
41 | - ->with('messages.success', 'Rol ' . $role->name . ' is toegevoegd.'); |
|
41 | + ->with('messages.success', 'Rol '.$role->name.' is toegevoegd.'); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | $this->authorize('update-role'); |
73 | 73 | |
74 | 74 | $this->validate($request, [ |
75 | - 'name' => 'required|alpha_dash|unique:roles,name,' . $id, |
|
75 | + 'name' => 'required|alpha_dash|unique:roles,name,'.$id, |
|
76 | 76 | 'permission_names' => 'required|array', |
77 | 77 | 'permission_names.*' => 'required', // Avoid null array entry |
78 | 78 | ]); |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | $role->syncPermissions($request->permission_names); |
84 | 84 | |
85 | 85 | return redirect()->route('chief.back.roles.index') |
86 | - ->with('messages.success', 'Rol ' . $role->name . ' is aangepast.'); |
|
86 | + ->with('messages.success', 'Rol '.$role->name.' is aangepast.'); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | public function destroy($id) |
@@ -94,6 +94,6 @@ discard block |
||
94 | 94 | $role->delete(); |
95 | 95 | |
96 | 96 | return redirect()->route('chief.back.roles.index') |
97 | - ->with('messages.success', 'Rol ' . $role->name . ' is verwijderd.'); |
|
97 | + ->with('messages.success', 'Rol '.$role->name.' is verwijderd.'); |
|
98 | 98 | } |
99 | 99 | } |
@@ -38,10 +38,10 @@ discard block |
||
38 | 38 | return; |
39 | 39 | } |
40 | 40 | |
41 | - app()->booted(function () { |
|
41 | + app()->booted(function() { |
|
42 | 42 | $routeName = config('chief.route.name'); |
43 | 43 | |
44 | - Route::get('{slug?}', function ($slug = '/') { |
|
44 | + Route::get('{slug?}', function($slug = '/') { |
|
45 | 45 | return ChiefResponse::fromSlug($slug); |
46 | 46 | })->name($routeName) |
47 | 47 | ->where('slug', '(.*)?') |
@@ -51,15 +51,15 @@ discard block |
||
51 | 51 | |
52 | 52 | private function loadOpenAdminRoutes(): void |
53 | 53 | { |
54 | - Route::group(['prefix' => config('chief.route.prefix', 'admin'), 'middleware' => ['web']], function () { |
|
55 | - $this->loadRoutesFrom(__DIR__ . '/../../routes/chief-open-routes.php'); |
|
54 | + Route::group(['prefix' => config('chief.route.prefix', 'admin'), 'middleware' => ['web']], function() { |
|
55 | + $this->loadRoutesFrom(__DIR__.'/../../routes/chief-open-routes.php'); |
|
56 | 56 | }); |
57 | 57 | } |
58 | 58 | |
59 | 59 | private function loadAdminRoutes(): void |
60 | 60 | { |
61 | - Route::group(['prefix' => config('chief.route.prefix', 'admin'), 'middleware' => ['web-chief', 'auth:chief']], function () { |
|
62 | - $this->loadRoutesFrom(__DIR__ . '/../../routes/chief-admin-routes.php'); |
|
61 | + Route::group(['prefix' => config('chief.route.prefix', 'admin'), 'middleware' => ['web-chief', 'auth:chief']], function() { |
|
62 | + $this->loadRoutesFrom(__DIR__.'/../../routes/chief-admin-routes.php'); |
|
63 | 63 | |
64 | 64 | // Add project specific chief routing... |
65 | 65 | $projectChiefRoutePath = config('chief.route.admin-filepath', null); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | */ |
79 | 79 | $this->bootFrontendEssentials(); |
80 | 80 | |
81 | - if (! $this->app->make(AdminEnvironment::class)->check(request())) { |
|
81 | + if (!$this->app->make(AdminEnvironment::class)->check(request())) { |
|
82 | 82 | return; |
83 | 83 | } |
84 | 84 | |
@@ -108,18 +108,18 @@ discard block |
||
108 | 108 | |
109 | 109 | public function register() |
110 | 110 | { |
111 | - $this->mergeConfigFrom(__DIR__ . '/../../config/chief.php', 'chief'); |
|
112 | - $this->mergeConfigFrom(__DIR__ . '/../../config/chief-settings.php', 'chief-settings'); |
|
111 | + $this->mergeConfigFrom(__DIR__.'/../../config/chief.php', 'chief'); |
|
112 | + $this->mergeConfigFrom(__DIR__.'/../../config/chief-settings.php', 'chief-settings'); |
|
113 | 113 | |
114 | 114 | if ($this->app->runningInConsole()) { |
115 | 115 | (new ConsoleServiceProvider($this->app))->register(); |
116 | 116 | } |
117 | 117 | |
118 | - $this->app->singleton(Registry::class, function () { |
|
118 | + $this->app->singleton(Registry::class, function() { |
|
119 | 119 | return new Registry([]); |
120 | 120 | }); |
121 | 121 | |
122 | - $this->app->singleton(Settings::class, function () { |
|
122 | + $this->app->singleton(Settings::class, function() { |
|
123 | 123 | return new Settings(); |
124 | 124 | }); |
125 | 125 | |
@@ -130,12 +130,12 @@ discard block |
||
130 | 130 | if ($this->app->make(AdminEnvironment::class)->check(request())) { |
131 | 131 | $this->app->when(SettingsController::class) |
132 | 132 | ->needs(SettingFields::class) |
133 | - ->give(function () { |
|
133 | + ->give(function() { |
|
134 | 134 | return new SettingFields(new Settings()); |
135 | 135 | }); |
136 | 136 | |
137 | 137 | // Global chief nav singleton |
138 | - $this->app->singleton(Nav::class, function () { |
|
138 | + $this->app->singleton(Nav::class, function() { |
|
139 | 139 | return new Nav(); |
140 | 140 | }); |
141 | 141 | |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | 'role' => \Thinktomorrow\Chief\Admin\Authorization\Role::class, |
170 | 170 | ]; |
171 | 171 | |
172 | - Auth::provider('chief-eloquent', function ($app, array $config) { |
|
172 | + Auth::provider('chief-eloquent', function($app, array $config) { |
|
173 | 173 | return new ChiefUserProvider($app['hash'], $config['model']); |
174 | 174 | }); |
175 | 175 | } |
@@ -177,10 +177,10 @@ discard block |
||
177 | 177 | private function bootChiefSquanto(): void |
178 | 178 | { |
179 | 179 | // Project specific squanto files |
180 | - $this->app['view']->addNamespace('squanto', __DIR__ . '/../../resources/views/vendor/squanto'); |
|
180 | + $this->app['view']->addNamespace('squanto', __DIR__.'/../../resources/views/vendor/squanto'); |
|
181 | 181 | |
182 | 182 | // Chief squanto defaults |
183 | - $this->app['view']->addNamespace('squanto', base_path() . '/resources/views/vendor/thinktomorrow/chief/vendor/squanto'); |
|
183 | + $this->app['view']->addNamespace('squanto', base_path().'/resources/views/vendor/thinktomorrow/chief/vendor/squanto'); |
|
184 | 184 | |
185 | 185 | // Use the chief routing |
186 | 186 | $this->app['config']['squanto.use_default_routes'] = false; |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | // User events |
192 | 192 | Event::listen(Login::class, LogSuccessfulLogin::class); |
193 | 193 | Event::listen(UserInvited::class, SendInvite::class); |
194 | - Event::listen(InviteAccepted::class, EnableUser::class . '@onAcceptingInvite'); |
|
194 | + Event::listen(InviteAccepted::class, EnableUser::class.'@onAcceptingInvite'); |
|
195 | 195 | |
196 | 196 | // Managed model events |
197 | 197 | Event::listen(ManagedModelCreated::class, [CreateUrlForPage::class, 'onManagedModelCreated']); |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | Relation::morphMap(['chiefuser' => User::class]); |
240 | 240 | Relation::morphMap(['menuitem' => MenuItem::class]); |
241 | 241 | |
242 | - Blade::directive('fragments', function () { |
|
242 | + Blade::directive('fragments', function() { |
|
243 | 243 | return '<?php echo app(\\Thinktomorrow\\Chief\\Fragments\\FragmentsRenderer::class)->render($model instanceof \Thinktomorrow\Chief\Shared\Concerns\Nestable\Tree\NestedNode ? $model->getModel() : $model, get_defined_vars()); ?>'; |
244 | 244 | }); |
245 | 245 | } |
@@ -49,9 +49,9 @@ discard block |
||
49 | 49 | continue; |
50 | 50 | } |
51 | 51 | |
52 | - $rules['trans.' . $locale . '.label'] = 'required'; |
|
53 | - if ($this->request->get('trans.' . $locale . '.url') != null) { |
|
54 | - $rules['trans.' . $locale . '.url'] = 'url'; |
|
52 | + $rules['trans.'.$locale.'.label'] = 'required'; |
|
53 | + if ($this->request->get('trans.'.$locale.'.url') != null) { |
|
54 | + $rules['trans.'.$locale.'.url'] = 'url'; |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | $attributes = []; |
64 | 64 | |
65 | 65 | foreach (array_keys($this->request->all('trans')) as $locale) { |
66 | - $attributes['trans.' . $locale . '.label'] = $locale . ' label'; |
|
67 | - $attributes['trans.' . $locale . '.url'] = $locale . ' link'; |
|
66 | + $attributes['trans.'.$locale.'.label'] = $locale.' label'; |
|
67 | + $attributes['trans.'.$locale.'.url'] = $locale.' link'; |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | $attributes['owner_reference'] = 'Interne pagina'; |
@@ -95,10 +95,10 @@ discard block |
||
95 | 95 | |
96 | 96 | // Check if it is a relative |
97 | 97 | if ($this->isRelativeUrl($trans['url'])) { |
98 | - $data['trans'][$locale]['url'] = '/' . trim($trans['url'], '/'); |
|
98 | + $data['trans'][$locale]['url'] = '/'.trim($trans['url'], '/'); |
|
99 | 99 | } elseif (Str::startsWith($trans['url'], ['mailto:', 'tel:', 'https://', 'http://'])) { |
100 | 100 | $data['trans'][$locale]['url'] = $trans['url']; |
101 | - } else { |
|
101 | + }else { |
|
102 | 102 | $data['trans'][$locale]['url'] = Url::fromString($trans['url'])->secure()->get(); |
103 | 103 | } |
104 | 104 | |
@@ -115,6 +115,6 @@ discard block |
||
115 | 115 | // Check if passed url is not intended as a host instead of a relative path |
116 | 116 | $notIntentedAsRoot = (null == Root::fromString($url)->getScheme() && false === strpos($url, '.')); |
117 | 117 | |
118 | - return ($notIntentedAsRoot && in_array($url, [$nakedUrl, '/' . $nakedUrl])); |
|
118 | + return ($notIntentedAsRoot && in_array($url, [$nakedUrl, '/'.$nakedUrl])); |
|
119 | 119 | } |
120 | 120 | } |