@@ -17,7 +17,7 @@ |
||
17 | 17 | { |
18 | 18 | $this->registerPolicies(); |
19 | 19 | |
20 | - Auth::provider('chief-eloquent', function ($app, array $config) { |
|
20 | + Auth::provider('chief-eloquent', function($app, array $config) { |
|
21 | 21 | return new ChiefUserProvider($app['hash'], $config['model']); |
22 | 22 | }); |
23 | 23 | } |
@@ -12,12 +12,12 @@ |
||
12 | 12 | { |
13 | 13 | $optimizerChain = app(OptimizerChain::class); |
14 | 14 | |
15 | - collect($request->allFiles())->each(function ($file) use ($optimizerChain) { |
|
15 | + collect($request->allFiles())->each(function($file) use ($optimizerChain) { |
|
16 | 16 | if (is_array($file)) { |
17 | - collect($file)->each(function ($media) use ($optimizerChain) { |
|
17 | + collect($file)->each(function($media) use ($optimizerChain) { |
|
18 | 18 | $optimizerChain->optimize($media->getPathname()); |
19 | 19 | }); |
20 | - } else { |
|
20 | + }else { |
|
21 | 21 | $optimizerChain->optimize($file->getPathname()); |
22 | 22 | } |
23 | 23 | }); |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | { |
21 | 21 | View::composer([ |
22 | 22 | 'chief::manager._transitions.modals.archive-modal', |
23 | - ], function ($view) { |
|
23 | + ], function($view) { |
|
24 | 24 | $viewData = $view->getData(); |
25 | 25 | |
26 | 26 | $ignoredModel = (isset($viewData['model'])) |
@@ -77,10 +77,10 @@ discard block |
||
77 | 77 | Blade::component('chief::wireframes.rect', 'wireframe-rect'); |
78 | 78 | |
79 | 79 | /* Chief directives */ |
80 | - Blade::directive('fragments', function () { |
|
80 | + Blade::directive('fragments', function() { |
|
81 | 81 | return "<?php echo app(\Thinktomorrow\Chief\Fragments\FragmentsRenderer::class)->render(\$model, get_defined_vars()); ?>"; |
82 | 82 | }); |
83 | - Blade::directive('adminConfig', function ($expression = null) { |
|
83 | + Blade::directive('adminConfig', function($expression = null) { |
|
84 | 84 | if ($expression) { |
85 | 85 | $method = "get".ucfirst(str_replace("'", '', $expression)); |
86 | 86 | |
@@ -89,16 +89,16 @@ discard block |
||
89 | 89 | |
90 | 90 | return "<?php echo \$model->adminConfig(); ?>"; |
91 | 91 | }); |
92 | - Blade::directive('adminRoute', function ($expression) { |
|
92 | + Blade::directive('adminRoute', function($expression) { |
|
93 | 93 | return "<?php echo \$manager->route($expression); ?>"; |
94 | 94 | }); |
95 | - Blade::directive('adminCan', function ($expression) { |
|
95 | + Blade::directive('adminCan', function($expression) { |
|
96 | 96 | return "<?php if (\$manager->can($expression)) { ?>"; |
97 | 97 | }); |
98 | - Blade::directive('elseAdminCan', function () { |
|
98 | + Blade::directive('elseAdminCan', function() { |
|
99 | 99 | return "<?php } else { ?>"; |
100 | 100 | }); |
101 | - Blade::directive('endAdminCan', function () { |
|
101 | + Blade::directive('endAdminCan', function() { |
|
102 | 102 | return "<?php } ?>"; |
103 | 103 | }); |
104 | 104 | } |
@@ -63,17 +63,17 @@ discard block |
||
63 | 63 | (new $addonServiceProvider($this->app))->boot(); |
64 | 64 | } |
65 | 65 | |
66 | - $this->loadViewsFrom(__DIR__ . '/../../resources/views', 'chief'); |
|
67 | - $this->loadMigrationsFrom(__DIR__ . '/../../database/migrations'); |
|
68 | - $this->loadTranslationsFrom(__DIR__ . '/../../resources/lang', 'chief'); |
|
66 | + $this->loadViewsFrom(__DIR__.'/../../resources/views', 'chief'); |
|
67 | + $this->loadMigrationsFrom(__DIR__.'/../../database/migrations'); |
|
68 | + $this->loadTranslationsFrom(__DIR__.'/../../resources/lang', 'chief'); |
|
69 | 69 | |
70 | 70 | $this->publishes([ |
71 | - __DIR__ . '/../../config/chief.php' => config_path('chief.php'), |
|
72 | - __DIR__ . '/../../config/chief-settings.php' => config_path('chief-settings.php'), |
|
71 | + __DIR__.'/../../config/chief.php' => config_path('chief.php'), |
|
72 | + __DIR__.'/../../config/chief-settings.php' => config_path('chief-settings.php'), |
|
73 | 73 | ], 'chief-config'); |
74 | 74 | |
75 | 75 | $this->publishes([ |
76 | - __DIR__ . '/../../public/chief-assets' => public_path('/chief-assets'), |
|
76 | + __DIR__.'/../../public/chief-assets' => public_path('/chief-assets'), |
|
77 | 77 | ], 'chief-assets'); |
78 | 78 | |
79 | 79 | // Commands for both cli and web scripts |
@@ -120,11 +120,11 @@ discard block |
||
120 | 120 | |
121 | 121 | // Custom validator for requiring on translations only the fallback locale |
122 | 122 | // this is called in the validation as required-fallback-locale |
123 | - Validator::extendImplicit('requiredFallbackLocale', function ($attribute, $value) { |
|
123 | + Validator::extendImplicit('requiredFallbackLocale', function($attribute, $value) { |
|
124 | 124 | $fallbackLocale = config('app.fallback_locale'); |
125 | 125 | |
126 | - if (false !== strpos($attribute, 'trans.' . $fallbackLocale . '.')) { |
|
127 | - return ! ! trim($value); |
|
126 | + if (false !== strpos($attribute, 'trans.'.$fallbackLocale.'.')) { |
|
127 | + return !!trim($value); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | return true; |
@@ -138,37 +138,37 @@ discard block |
||
138 | 138 | public function register() |
139 | 139 | { |
140 | 140 | if ($this->app->runningInConsole()) { |
141 | - $this->callAfterResolving(Schedule::class, function (Schedule $schedule) { |
|
141 | + $this->callAfterResolving(Schedule::class, function(Schedule $schedule) { |
|
142 | 142 | $schedule->command('chief:sitemap')->dailyAt("01:00"); |
143 | 143 | }); |
144 | 144 | } |
145 | 145 | |
146 | - $this->mergeConfigFrom(__DIR__ . '/../../config/chief.php', 'chief'); |
|
147 | - $this->mergeConfigFrom(__DIR__ . '/../../config/chief-settings.php', 'chief-settings'); |
|
146 | + $this->mergeConfigFrom(__DIR__.'/../../config/chief.php', 'chief'); |
|
147 | + $this->mergeConfigFrom(__DIR__.'/../../config/chief-settings.php', 'chief-settings'); |
|
148 | 148 | |
149 | 149 | $this->setupEnvironmentProviders(); |
150 | 150 | |
151 | 151 | $this->app->when(SettingsController::class) |
152 | 152 | ->needs(SettingFields::class) |
153 | - ->give(function () { |
|
153 | + ->give(function() { |
|
154 | 154 | return new SettingFields(new Settings()); |
155 | 155 | }); |
156 | 156 | |
157 | - $this->app->singleton(Registry::class, function () { |
|
157 | + $this->app->singleton(Registry::class, function() { |
|
158 | 158 | return new Registry([], [], new TaggedKeys()); |
159 | 159 | }); |
160 | 160 | |
161 | 161 | // Global chief nav singleton |
162 | - $this->app->singleton(Nav::class, function () { |
|
162 | + $this->app->singleton(Nav::class, function() { |
|
163 | 163 | return new Nav(); |
164 | 164 | }); |
165 | 165 | |
166 | 166 | // Setup commands |
167 | - $this->app->bind(CreatePageCommand::class, function ($app) { |
|
167 | + $this->app->bind(CreatePageCommand::class, function($app) { |
|
168 | 168 | return new CreatePageCommand($app->make(FileManipulation::class), new SetupConfig(config('chief.setup', []))); |
169 | 169 | }); |
170 | 170 | |
171 | - $this->app->bind(CreateFragmentCommand::class, function ($app) { |
|
171 | + $this->app->bind(CreateFragmentCommand::class, function($app) { |
|
172 | 172 | return new CreateFragmentCommand($app->make(FileManipulation::class), new SetupConfig(config('chief.setup', []))); |
173 | 173 | }); |
174 | 174 | |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | */ |
206 | 206 | private function setupEnvironmentProviders(): void |
207 | 207 | { |
208 | - if (! $this->app->environment('production') && $services = config('app.providers-' . app()->environment(), false)) { |
|
208 | + if (!$this->app->environment('production') && $services = config('app.providers-'.app()->environment(), false)) { |
|
209 | 209 | foreach ($services as $service) { |
210 | 210 | $this->app->register($service); |
211 | 211 | } |
@@ -240,10 +240,10 @@ discard block |
||
240 | 240 | private function registerSquanto(): void |
241 | 241 | { |
242 | 242 | // Project specific squanto files |
243 | - $this->app['view']->addNamespace('squanto', __DIR__ . '/../../resources/views/vendor/squanto'); |
|
243 | + $this->app['view']->addNamespace('squanto', __DIR__.'/../../resources/views/vendor/squanto'); |
|
244 | 244 | |
245 | 245 | // Chief squanto defaults |
246 | - $this->app['view']->addNamespace('squanto', base_path() . '/resources/views/vendor/thinktomorrow/chief/vendor/squanto'); |
|
246 | + $this->app['view']->addNamespace('squanto', base_path().'/resources/views/vendor/thinktomorrow/chief/vendor/squanto'); |
|
247 | 247 | |
248 | 248 | // Use the chief routing |
249 | 249 | $this->app['config']['squanto.use_default_routes'] = false; |
@@ -24,9 +24,9 @@ |
||
24 | 24 | { |
25 | 25 | Event::listen(Login::class, LogSuccessfulLogin::class); |
26 | 26 | Event::listen(UserInvited::class, SendInvite::class); |
27 | - Event::listen(InviteAccepted::class, EnableUser::class . '@onAcceptingInvite'); |
|
27 | + Event::listen(InviteAccepted::class, EnableUser::class.'@onAcceptingInvite'); |
|
28 | 28 | |
29 | - Event::listen(ManagedModelCreated::class, CreateUrlForPage::class . '@onManagedModelCreated'); |
|
29 | + Event::listen(ManagedModelCreated::class, CreateUrlForPage::class.'@onManagedModelCreated'); |
|
30 | 30 | Event::listen(FragmentDetached::class, DeleteFragment::class.'@onFragmentDetached'); |
31 | 31 | Event::listen(FragmentDetached::class, UpdateFragmentMetadata::class.'@onFragmentDetached'); |
32 | 32 | Event::listen(FragmentAdded::class, UpdateFragmentMetadata::class.'@onFragmentAdded'); |
@@ -25,15 +25,15 @@ discard block |
||
25 | 25 | |
26 | 26 | private function loadOpenAdminRoutes(): void |
27 | 27 | { |
28 | - Route::group(['prefix' => config('chief.route.prefix', 'admin'), 'middleware' => ['web']], function () { |
|
29 | - $this->loadRoutesFrom(__DIR__ . '/../../routes/chief-open-routes.php'); |
|
28 | + Route::group(['prefix' => config('chief.route.prefix', 'admin'), 'middleware' => ['web']], function() { |
|
29 | + $this->loadRoutesFrom(__DIR__.'/../../routes/chief-open-routes.php'); |
|
30 | 30 | }); |
31 | 31 | } |
32 | 32 | |
33 | 33 | private function loadAdminRoutes(): void |
34 | 34 | { |
35 | - Route::group(['prefix' => config('chief.route.prefix', 'admin'), 'middleware' => ['web-chief', 'auth:chief']], function () { |
|
36 | - $this->loadRoutesFrom(__DIR__ . '/../../routes/chief-admin-routes.php'); |
|
35 | + Route::group(['prefix' => config('chief.route.prefix', 'admin'), 'middleware' => ['web-chief', 'auth:chief']], function() { |
|
36 | + $this->loadRoutesFrom(__DIR__.'/../../routes/chief-admin-routes.php'); |
|
37 | 37 | |
38 | 38 | // Add project specific chief routing... |
39 | 39 | $projectChiefRoutePath = config('chief.route.admin-filepath', null); |
@@ -53,10 +53,10 @@ discard block |
||
53 | 53 | return; |
54 | 54 | } |
55 | 55 | |
56 | - app()->booted(function () { |
|
56 | + app()->booted(function() { |
|
57 | 57 | $routeName = config('chief.route.name'); |
58 | 58 | |
59 | - Route::get('{slug?}', function ($slug = '/') { |
|
59 | + Route::get('{slug?}', function($slug = '/') { |
|
60 | 60 | return ChiefResponse::fromSlug($slug); |
61 | 61 | })->name($routeName) |
62 | 62 | ->where('slug', '(.*)?') |
@@ -21,11 +21,11 @@ discard block |
||
21 | 21 | { |
22 | 22 | // Custom validator for requiring on translations only the fallback locale |
23 | 23 | // this is called in the validation as required-fallback-locale |
24 | - Validator::extendImplicit('requiredFallbackLocale', function ($attribute, $value) { |
|
24 | + Validator::extendImplicit('requiredFallbackLocale', function($attribute, $value) { |
|
25 | 25 | $fallbackLocale = config('app.fallback_locale'); |
26 | 26 | |
27 | - if (false !== strpos($attribute, 'trans.' . $fallbackLocale . '.')) { |
|
28 | - return ! ! trim($value); |
|
27 | + if (false !== strpos($attribute, 'trans.'.$fallbackLocale.'.')) { |
|
28 | + return !!trim($value); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | return true; |
@@ -36,16 +36,16 @@ discard block |
||
36 | 36 | |
37 | 37 | private function bootMediaValidationRules(): void |
38 | 38 | { |
39 | - Validator::extendImplicit('filefield_required', FileFieldRequiredRule::class . '@validate'); |
|
40 | - Validator::extend('filefield_mimetypes', FileFieldMimetypesRule::class . '@validate'); |
|
41 | - Validator::extend('filefield_dimensions', FileFieldDimensionsRule::class . '@validate'); |
|
42 | - Validator::extend('filefield_min', FileFieldMinRule::class . '@validate'); |
|
43 | - Validator::extend('filefield_max', FileFieldMaxRule::class . '@validate'); |
|
44 | - |
|
45 | - Validator::extendImplicit('imagefield_required', ImageFieldRequiredRule::class . '@validate'); |
|
46 | - Validator::extend('imagefield_mimetypes', ImageFieldMimetypesRule::class . '@validate'); |
|
47 | - Validator::extend('imagefield_dimensions', ImageFieldDimensionsRule::class . '@validate'); |
|
48 | - Validator::extend('imagefield_max', ImageFieldMaxRule::class . '@validate'); |
|
49 | - Validator::extend('imagefield_min', ImageFieldMinRule::class . '@validate'); |
|
39 | + Validator::extendImplicit('filefield_required', FileFieldRequiredRule::class.'@validate'); |
|
40 | + Validator::extend('filefield_mimetypes', FileFieldMimetypesRule::class.'@validate'); |
|
41 | + Validator::extend('filefield_dimensions', FileFieldDimensionsRule::class.'@validate'); |
|
42 | + Validator::extend('filefield_min', FileFieldMinRule::class.'@validate'); |
|
43 | + Validator::extend('filefield_max', FileFieldMaxRule::class.'@validate'); |
|
44 | + |
|
45 | + Validator::extendImplicit('imagefield_required', ImageFieldRequiredRule::class.'@validate'); |
|
46 | + Validator::extend('imagefield_mimetypes', ImageFieldMimetypesRule::class.'@validate'); |
|
47 | + Validator::extend('imagefield_dimensions', ImageFieldDimensionsRule::class.'@validate'); |
|
48 | + Validator::extend('imagefield_max', ImageFieldMaxRule::class.'@validate'); |
|
49 | + Validator::extend('imagefield_min', ImageFieldMinRule::class.'@validate'); |
|
50 | 50 | } |
51 | 51 | } |
@@ -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->get('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,9 +18,9 @@ |
||
18 | 18 | |
19 | 19 | $onlineModels = UrlHelper::onlineModels(); |
20 | 20 | |
21 | - $links = $onlineModels->reject(function (Visitable $model) { |
|
22 | - return ! $model->url(); |
|
23 | - })->map(function ($model) { |
|
21 | + $links = $onlineModels->reject(function(Visitable $model) { |
|
22 | + return !$model->url(); |
|
23 | + })->map(function($model) { |
|
24 | 24 | $name = (method_exists($model, 'menuLabel') && $model->menuLabel()) ? $model->menuLabel() : (isset($model->title) ? $model->title : $model->url()); |
25 | 25 | |
26 | 26 | return [ |