@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | $this->loadViewsFrom(__DIR__.'/../../resources/views', 'chief'); |
| 13 | 13 | |
| 14 | 14 | // Fragment components |
| 15 | - $this->app['view']->addNamespace('chief-fragments', __DIR__ . '/../../src/Fragments/resources'); |
|
| 15 | + $this->app['view']->addNamespace('chief-fragments', __DIR__.'/../../src/Fragments/resources'); |
|
| 16 | 16 | |
| 17 | 17 | Blade::componentNamespace('Thinktomorrow\\Chief\\App\\View\\Components', 'chief'); |
| 18 | 18 | |
@@ -37,19 +37,19 @@ discard block |
||
| 37 | 37 | Blade::component('chief-table::components.data', 'chief::table.data'); |
| 38 | 38 | |
| 39 | 39 | // Chief directives |
| 40 | - Blade::directive('adminRoute', function ($expression) { |
|
| 40 | + Blade::directive('adminRoute', function($expression) { |
|
| 41 | 41 | return "<?php echo \$manager->route({$expression}); ?>"; |
| 42 | 42 | }); |
| 43 | 43 | |
| 44 | - Blade::directive('adminCan', function ($expression) { |
|
| 44 | + Blade::directive('adminCan', function($expression) { |
|
| 45 | 45 | return "<?php if (isset(\$manager) && \$manager->can({$expression})) { ?>"; |
| 46 | 46 | }); |
| 47 | 47 | |
| 48 | - Blade::directive('elseAdminCan', function () { |
|
| 48 | + Blade::directive('elseAdminCan', function() { |
|
| 49 | 49 | return '<?php } else { ?>'; |
| 50 | 50 | }); |
| 51 | 51 | |
| 52 | - Blade::directive('endAdminCan', function () { |
|
| 52 | + Blade::directive('endAdminCan', function() { |
|
| 53 | 53 | return '<?php } ?>'; |
| 54 | 54 | }); |
| 55 | 55 | |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | */ |
| 78 | 78 | $this->bootFrontendEssentials(); |
| 79 | 79 | |
| 80 | - if (! $this->app->make(AdminEnvironment::class)->check(request())) { |
|
| 80 | + if (!$this->app->make(AdminEnvironment::class)->check(request())) { |
|
| 81 | 81 | return; |
| 82 | 82 | } |
| 83 | 83 | |
@@ -107,18 +107,18 @@ discard block |
||
| 107 | 107 | |
| 108 | 108 | public function register() |
| 109 | 109 | { |
| 110 | - $this->mergeConfigFrom(__DIR__ . '/../../config/chief.php', 'chief'); |
|
| 111 | - $this->mergeConfigFrom(__DIR__ . '/../../config/chief-settings.php', 'chief-settings'); |
|
| 110 | + $this->mergeConfigFrom(__DIR__.'/../../config/chief.php', 'chief'); |
|
| 111 | + $this->mergeConfigFrom(__DIR__.'/../../config/chief-settings.php', 'chief-settings'); |
|
| 112 | 112 | |
| 113 | 113 | if ($this->app->runningInConsole()) { |
| 114 | 114 | (new ConsoleServiceProvider($this->app))->register(); |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - $this->app->singleton(Registry::class, function () { |
|
| 117 | + $this->app->singleton(Registry::class, function() { |
|
| 118 | 118 | return new Registry([]); |
| 119 | 119 | }); |
| 120 | 120 | |
| 121 | - $this->app->singleton(Settings::class, function () { |
|
| 121 | + $this->app->singleton(Settings::class, function() { |
|
| 122 | 122 | return new Settings(); |
| 123 | 123 | }); |
| 124 | 124 | |
@@ -129,12 +129,12 @@ discard block |
||
| 129 | 129 | if ($this->app->make(AdminEnvironment::class)->check(request())) { |
| 130 | 130 | $this->app->when(SettingsController::class) |
| 131 | 131 | ->needs(SettingFields::class) |
| 132 | - ->give(function () { |
|
| 132 | + ->give(function() { |
|
| 133 | 133 | return new SettingFields(new Settings()); |
| 134 | 134 | }); |
| 135 | 135 | |
| 136 | 136 | // Global chief nav singleton |
| 137 | - $this->app->singleton(Nav::class, function () { |
|
| 137 | + $this->app->singleton(Nav::class, function() { |
|
| 138 | 138 | return new Nav(); |
| 139 | 139 | }); |
| 140 | 140 | |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | 'role' => \Thinktomorrow\Chief\Admin\Authorization\Role::class, |
| 169 | 169 | ]; |
| 170 | 170 | |
| 171 | - Auth::provider('chief-eloquent', function ($app, array $config) { |
|
| 171 | + Auth::provider('chief-eloquent', function($app, array $config) { |
|
| 172 | 172 | return new ChiefUserProvider($app['hash'], $config['model']); |
| 173 | 173 | }); |
| 174 | 174 | } |
@@ -176,10 +176,10 @@ discard block |
||
| 176 | 176 | private function bootChiefSquanto(): void |
| 177 | 177 | { |
| 178 | 178 | // Project specific squanto files |
| 179 | - $this->app['view']->addNamespace('squanto', __DIR__ . '/../../resources/views/vendor/squanto'); |
|
| 179 | + $this->app['view']->addNamespace('squanto', __DIR__.'/../../resources/views/vendor/squanto'); |
|
| 180 | 180 | |
| 181 | 181 | // Chief squanto defaults |
| 182 | - $this->app['view']->addNamespace('squanto', base_path() . '/resources/views/vendor/thinktomorrow/chief/vendor/squanto'); |
|
| 182 | + $this->app['view']->addNamespace('squanto', base_path().'/resources/views/vendor/thinktomorrow/chief/vendor/squanto'); |
|
| 183 | 183 | |
| 184 | 184 | // Use the chief routing |
| 185 | 185 | $this->app['config']['squanto.use_default_routes'] = false; |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | // User events |
| 191 | 191 | Event::listen(Login::class, LogSuccessfulLogin::class); |
| 192 | 192 | Event::listen(UserInvited::class, SendInvite::class); |
| 193 | - Event::listen(InviteAccepted::class, EnableUser::class . '@onAcceptingInvite'); |
|
| 193 | + Event::listen(InviteAccepted::class, EnableUser::class.'@onAcceptingInvite'); |
|
| 194 | 194 | |
| 195 | 195 | // Managed model events |
| 196 | 196 | Event::listen(ManagedModelCreated::class, [CreateUrlForPage::class, 'onManagedModelCreated']); |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | |
| 237 | 237 | Relation::morphMap(['fragmentmodel' => FragmentModel::class]); |
| 238 | 238 | |
| 239 | - Blade::directive('fragments', function () { |
|
| 239 | + Blade::directive('fragments', function() { |
|
| 240 | 240 | 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()); ?>'; |
| 241 | 241 | }); |
| 242 | 242 | } |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | $this->authorize('create-page'); |
| 33 | 33 | |
| 34 | 34 | $menuitem = new MenuItem(); |
| 35 | - $menuitem->type = MenuItem::TYPE_INTERNAL; // Default menu type |
|
| 35 | + $menuitem->type = MenuItem::TYPE_INTERNAL; // Default menu type |
|
| 36 | 36 | $menuitem->menu_type = $menutype; |
| 37 | 37 | |
| 38 | 38 | $menuitems = $this->prepareMenuItemsForAdminSelect->prepare( |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | ->performedOn($menu) |
| 58 | 58 | ->log('created'); |
| 59 | 59 | |
| 60 | - return redirect()->route('chief.back.menus.show', $menu->menu_type)->with('messages.success', $menu->label . ' is aangemaakt'); |
|
| 60 | + return redirect()->route('chief.back.menus.show', $menu->menu_type)->with('messages.success', $menu->label.' is aangemaakt'); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | /** |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | ->performedOn($menu) |
| 96 | 96 | ->log('updated'); |
| 97 | 97 | |
| 98 | - return redirect()->route('chief.back.menus.show', $menu->menu_type)->with('messages.success', $menu->label . ' is aangepast'); |
|
| 98 | + return redirect()->route('chief.back.menus.show', $menu->menu_type)->with('messages.success', $menu->label.' is aangepast'); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | public function destroy($id) |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | ->log('deleted'); |
| 113 | 113 | |
| 114 | 114 | return redirect()->route('chief.back.menus.show', $menuItem->menuType())->with('messages.warning', $message); |
| 115 | - } else { |
|
| 115 | + }else { |
|
| 116 | 116 | return redirect()->back()->with('messages.warning', 'Je menu item is niet verwijderd. Probeer opnieuw'); |
| 117 | 117 | } |
| 118 | 118 | } |
@@ -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), |
@@ -48,9 +48,9 @@ discard block |
||
| 48 | 48 | continue; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - $rules['trans.' . $locale . '.label'] = 'required'; |
|
| 52 | - if ($this->request->get('trans.' . $locale . '.url') != null) { |
|
| 53 | - $rules['trans.' . $locale . '.url'] = 'url'; |
|
| 51 | + $rules['trans.'.$locale.'.label'] = 'required'; |
|
| 52 | + if ($this->request->get('trans.'.$locale.'.url') != null) { |
|
| 53 | + $rules['trans.'.$locale.'.url'] = 'url'; |
|
| 54 | 54 | } |
| 55 | 55 | } |
| 56 | 56 | |
@@ -62,8 +62,8 @@ discard block |
||
| 62 | 62 | $attributes = []; |
| 63 | 63 | |
| 64 | 64 | foreach (array_keys($this->request->all('trans')) as $locale) { |
| 65 | - $attributes['trans.' . $locale . '.label'] = $locale . ' label'; |
|
| 66 | - $attributes['trans.' . $locale . '.url'] = $locale . ' link'; |
|
| 65 | + $attributes['trans.'.$locale.'.label'] = $locale.' label'; |
|
| 66 | + $attributes['trans.'.$locale.'.url'] = $locale.' link'; |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | $attributes['owner_reference'] = 'Interne pagina'; |
@@ -94,8 +94,8 @@ discard block |
||
| 94 | 94 | |
| 95 | 95 | // Check if it is a relative |
| 96 | 96 | if ($this->isRelativeUrl($trans['url'])) { |
| 97 | - $data['trans'][$locale]['url'] = '/' . trim($trans['url'], '/'); |
|
| 98 | - } else { |
|
| 97 | + $data['trans'][$locale]['url'] = '/'.trim($trans['url'], '/'); |
|
| 98 | + }else { |
|
| 99 | 99 | $data['trans'][$locale]['url'] = Url::fromString($trans['url'])->secure()->get(); |
| 100 | 100 | } |
| 101 | 101 | |
@@ -112,6 +112,6 @@ discard block |
||
| 112 | 112 | // Check if passed url is not intended as a host instead of a relative path |
| 113 | 113 | $notIntentedAsRoot = (null == Root::fromString($url)->scheme() && false === strpos($url, '.')); |
| 114 | 114 | |
| 115 | - return ($notIntentedAsRoot && in_array($url, [$nakedUrl, '/' . $nakedUrl])); |
|
| 115 | + return ($notIntentedAsRoot && in_array($url, [$nakedUrl, '/'.$nakedUrl])); |
|
| 116 | 116 | } |
| 117 | 117 | } |
@@ -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 | |
@@ -24,19 +24,19 @@ |
||
| 24 | 24 | public function handle(): void |
| 25 | 25 | { |
| 26 | 26 | // CSV should consist of: locale - redirect url - target -url |
| 27 | - $this->loop($this->argument('file'), function ($row) { |
|
| 27 | + $this->loop($this->argument('file'), function($row) { |
|
| 28 | 28 | try { |
| 29 | 29 | $this->addRedirect->handle($row[0], $row[1], $row[2]); |
| 30 | - } catch(UrlRecordNotFound $e) { |
|
| 30 | + } catch (UrlRecordNotFound $e) { |
|
| 31 | 31 | $this->warn('No record found for targeturl ['.$row[2].'], locale ['.$row[0].']'); |
| 32 | 32 | |
| 33 | 33 | return; |
| 34 | - } catch(RedirectUrlAlreadyExists $e) { |
|
| 34 | + } catch (RedirectUrlAlreadyExists $e) { |
|
| 35 | 35 | $this->warn('Redirect url already exists as record ['.$row[1].'], locale ['.$row[0].']'); |
| 36 | 36 | |
| 37 | 37 | return; |
| 38 | 38 | } |
| 39 | - $this->info('Added '.$row[0].' redirect: ' . $row[1] . ' -> ' . $row[2]); |
|
| 39 | + $this->info('Added '.$row[0].' redirect: '.$row[1].' -> '.$row[2]); |
|
| 40 | 40 | }); |
| 41 | 41 | |
| 42 | 42 | $this->info('Finished adding redirects'); |