@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | $this->files->makeDirectory($routesPath, 0755, true); |
37 | 37 | } |
38 | 38 | |
39 | - $stub = $this->files->get(__DIR__.'/stubs/admin.stub'); |
|
39 | + $stub = $this->files->get(__DIR__ . '/stubs/admin.stub'); |
|
40 | 40 | |
41 | - $this->files->put($routesPath.'/admin.php', $stub); |
|
41 | + $this->files->put($routesPath . '/admin.php', $stub); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | private function addServiceProvider() |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | $this->files->makeDirectory($exceptionsPath, 0755, true); |
66 | 66 | } |
67 | 67 | |
68 | - $stub = $this->files->get(__DIR__.'/stubs/Handler.stub'); |
|
68 | + $stub = $this->files->get(__DIR__ . '/stubs/Handler.stub'); |
|
69 | 69 | |
70 | - $this->files->put($exceptionsPath.'/Handler.php', $stub); |
|
70 | + $this->files->put($exceptionsPath . '/Handler.php', $stub); |
|
71 | 71 | } |
72 | 72 | } |
@@ -14,20 +14,20 @@ |
||
14 | 14 | public function handle() |
15 | 15 | { |
16 | 16 | $this->info('Starting to scan block views directory...'); |
17 | - collect(File::files(resource_path('views/admin/blocks')))->each(function ($viewFile) { |
|
17 | + collect(File::files(resource_path('views/admin/blocks')))->each(function($viewFile) { |
|
18 | 18 | $blockName = $viewFile->getBasename('.blade.php'); |
19 | 19 | |
20 | - $vueBlockTemplate = view('admin.blocks.'.$blockName, ['renderForBlocks' => true])->render(); |
|
20 | + $vueBlockTemplate = view('admin.blocks.' . $blockName, ['renderForBlocks' => true])->render(); |
|
21 | 21 | |
22 | 22 | $vueBlockContent = view('twill::blocks.builder', [ |
23 | 23 | 'render' => $this->sanitize($vueBlockTemplate), |
24 | 24 | ])->render(); |
25 | 25 | |
26 | - $vueBlockPath = resource_path('assets/js/blocks/').'Block'.title_case($blockName).'.vue'; |
|
26 | + $vueBlockPath = resource_path('assets/js/blocks/') . 'Block' . title_case($blockName) . '.vue'; |
|
27 | 27 | |
28 | 28 | File::put($vueBlockPath, $vueBlockContent); |
29 | 29 | |
30 | - $this->info('Block '.title_case($blockName).' generated successfully'); |
|
30 | + $this->info('Block ' . title_case($blockName) . ' generated successfully'); |
|
31 | 31 | }); |
32 | 32 | |
33 | 33 | $this->info('All blocks have been generated!'); |
@@ -78,16 +78,16 @@ discard block |
||
78 | 78 | $className = "Create{$tableClassName}Tables"; |
79 | 79 | |
80 | 80 | if (!class_exists($className)) { |
81 | - $migrationName = 'create_'.$table.'_tables'; |
|
81 | + $migrationName = 'create_' . $table . '_tables'; |
|
82 | 82 | |
83 | - $migrationPath = $this->laravel->databasePath().'/migrations'; |
|
83 | + $migrationPath = $this->laravel->databasePath() . '/migrations'; |
|
84 | 84 | |
85 | 85 | $fullPath = $this->laravel['migration.creator']->create($migrationName, $migrationPath); |
86 | 86 | |
87 | 87 | $stub = str_replace( |
88 | 88 | ['{{table}}', '{{singularTableName}}', '{{tableClassName}}'], |
89 | 89 | [$table, Str::singular($table), $tableClassName], |
90 | - $this->files->get(__DIR__.'/stubs/migration.stub') |
|
90 | + $this->files->get(__DIR__ . '/stubs/migration.stub') |
|
91 | 91 | ); |
92 | 92 | |
93 | 93 | $this->files->put($fullPath, $stub); |
@@ -107,11 +107,11 @@ discard block |
||
107 | 107 | $this->files->makeDirectory(app_path('Models/Translations')); |
108 | 108 | } |
109 | 109 | |
110 | - $modelTranslationClassName = $modelName.'Translation'; |
|
110 | + $modelTranslationClassName = $modelName . 'Translation'; |
|
111 | 111 | |
112 | - $stub = str_replace('{{modelTranslationClassName}}', $modelTranslationClassName, $this->files->get(__DIR__.'/stubs/model_translation.stub')); |
|
112 | + $stub = str_replace('{{modelTranslationClassName}}', $modelTranslationClassName, $this->files->get(__DIR__ . '/stubs/model_translation.stub')); |
|
113 | 113 | |
114 | - $this->files->put(app_path('Models/Translations/'.$modelTranslationClassName.'.php'), $stub); |
|
114 | + $this->files->put(app_path('Models/Translations/' . $modelTranslationClassName . '.php'), $stub); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | if ($sluggable) { |
@@ -119,11 +119,11 @@ discard block |
||
119 | 119 | $this->files->makeDirectory(app_path('Models/Slugs')); |
120 | 120 | } |
121 | 121 | |
122 | - $modelSlugClassName = $modelName.'Slug'; |
|
122 | + $modelSlugClassName = $modelName . 'Slug'; |
|
123 | 123 | |
124 | - $stub = str_replace(['{{modelSlugClassName}}', '{{modelName}}'], [$modelSlugClassName, Str::snake($modelName)], $this->files->get(__DIR__.'/stubs/model_slug.stub')); |
|
124 | + $stub = str_replace(['{{modelSlugClassName}}', '{{modelName}}'], [$modelSlugClassName, Str::snake($modelName)], $this->files->get(__DIR__ . '/stubs/model_slug.stub')); |
|
125 | 125 | |
126 | - $this->files->put(app_path('Models/Slugs/'.$modelSlugClassName.'.php'), $stub); |
|
126 | + $this->files->put(app_path('Models/Slugs/' . $modelSlugClassName . '.php'), $stub); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | if ($revisionable) { |
@@ -131,11 +131,11 @@ discard block |
||
131 | 131 | $this->files->makeDirectory(app_path('Models/Revisions')); |
132 | 132 | } |
133 | 133 | |
134 | - $modelRevisionClassName = $modelName.'Revision'; |
|
134 | + $modelRevisionClassName = $modelName . 'Revision'; |
|
135 | 135 | |
136 | - $stub = str_replace(['{{modelRevisionClassName}}', '{{modelName}}'], [$modelRevisionClassName, Str::snake($modelName)], $this->files->get(__DIR__.'/stubs/model_revision.stub')); |
|
136 | + $stub = str_replace(['{{modelRevisionClassName}}', '{{modelName}}'], [$modelRevisionClassName, Str::snake($modelName)], $this->files->get(__DIR__ . '/stubs/model_revision.stub')); |
|
137 | 137 | |
138 | - $this->files->put(app_path('Models/Revisions/'.$modelRevisionClassName.'.php'), $stub); |
|
138 | + $this->files->put(app_path('Models/Revisions/' . $modelRevisionClassName . '.php'), $stub); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | $modelClassName = $modelName; |
@@ -148,9 +148,9 @@ discard block |
||
148 | 148 | } |
149 | 149 | } |
150 | 150 | |
151 | - $activeModelTraitsString = empty($activeModelTraits) ? '' : 'use '.rtrim(implode(', ', $activeModelTraits), ', ').';'; |
|
151 | + $activeModelTraitsString = empty($activeModelTraits) ? '' : 'use ' . rtrim(implode(', ', $activeModelTraits), ', ') . ';'; |
|
152 | 152 | |
153 | - $activeModelTraitsImports = empty($activeModelTraits) ? '' : "use A17\Twill\Models\Behaviors\\".implode(";\nuse A17\Twill\Models\Behaviors\\", $activeModelTraits).';'; |
|
153 | + $activeModelTraitsImports = empty($activeModelTraits) ? '' : "use A17\Twill\Models\Behaviors\\" . implode(";\nuse A17\Twill\Models\Behaviors\\", $activeModelTraits) . ';'; |
|
154 | 154 | |
155 | 155 | $activeModelImplements = $sortable ? 'implements Sortable' : ''; |
156 | 156 | |
@@ -158,9 +158,9 @@ discard block |
||
158 | 158 | $activeModelTraitsImports .= "\nuse A17\Twill\Models\Behaviors\Sortable;"; |
159 | 159 | } |
160 | 160 | |
161 | - $stub = str_replace(['{{modelClassName}}', '{{modelTraits}}', '{{modelImports}}', '{{modelImplements}}'], [$modelClassName, $activeModelTraitsString, $activeModelTraitsImports, $activeModelImplements], $this->files->get(__DIR__.'/stubs/model.stub')); |
|
161 | + $stub = str_replace(['{{modelClassName}}', '{{modelTraits}}', '{{modelImports}}', '{{modelImplements}}'], [$modelClassName, $activeModelTraitsString, $activeModelTraitsImports, $activeModelImplements], $this->files->get(__DIR__ . '/stubs/model.stub')); |
|
162 | 162 | |
163 | - $this->files->put(app_path('Models/'.$modelClassName.'.php'), $stub); |
|
163 | + $this->files->put(app_path('Models/' . $modelClassName . '.php'), $stub); |
|
164 | 164 | |
165 | 165 | $this->info('Models created successfully! Fill your fillables!'); |
166 | 166 | } |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | $this->files->makeDirectory(app_path('Repositories')); |
172 | 172 | } |
173 | 173 | |
174 | - $repositoryClassName = $modelName.'Repository'; |
|
174 | + $repositoryClassName = $modelName . 'Repository'; |
|
175 | 175 | |
176 | 176 | $activeRepositoryTraits = []; |
177 | 177 | |
@@ -181,13 +181,13 @@ discard block |
||
181 | 181 | } |
182 | 182 | } |
183 | 183 | |
184 | - $activeRepositoryTraitsString = empty($activeRepositoryTraits) ? '' : 'use '.(empty($activeRepositoryTraits) ? '' : rtrim(implode(', ', $activeRepositoryTraits), ', ').';'); |
|
184 | + $activeRepositoryTraitsString = empty($activeRepositoryTraits) ? '' : 'use ' . (empty($activeRepositoryTraits) ? '' : rtrim(implode(', ', $activeRepositoryTraits), ', ') . ';'); |
|
185 | 185 | |
186 | - $activeRepositoryTraitsImports = empty($activeRepositoryTraits) ? '' : "use A17\Twill\Repositories\Behaviors\\".implode(";\nuse A17\Twill\Repositories\Behaviors\\", $activeRepositoryTraits).';'; |
|
186 | + $activeRepositoryTraitsImports = empty($activeRepositoryTraits) ? '' : "use A17\Twill\Repositories\Behaviors\\" . implode(";\nuse A17\Twill\Repositories\Behaviors\\", $activeRepositoryTraits) . ';'; |
|
187 | 187 | |
188 | - $stub = str_replace(['{{repositoryClassName}}', '{{modelName}}', '{{repositoryTraits}}', '{{repositoryImports}}'], [$repositoryClassName, $modelName, $activeRepositoryTraitsString, $activeRepositoryTraitsImports], $this->files->get(__DIR__.'/stubs/repository.stub')); |
|
188 | + $stub = str_replace(['{{repositoryClassName}}', '{{modelName}}', '{{repositoryTraits}}', '{{repositoryImports}}'], [$repositoryClassName, $modelName, $activeRepositoryTraitsString, $activeRepositoryTraitsImports], $this->files->get(__DIR__ . '/stubs/repository.stub')); |
|
189 | 189 | |
190 | - $this->files->put(app_path('Repositories/'.$repositoryClassName.'.php'), $stub); |
|
190 | + $this->files->put(app_path('Repositories/' . $repositoryClassName . '.php'), $stub); |
|
191 | 191 | |
192 | 192 | $this->info('Repository created successfully! Control all the things!'); |
193 | 193 | } |
@@ -198,15 +198,15 @@ discard block |
||
198 | 198 | $this->files->makeDirectory(app_path('Http/Controllers/Admin')); |
199 | 199 | } |
200 | 200 | |
201 | - $controllerClassName = $modelName.'Controller'; |
|
201 | + $controllerClassName = $modelName . 'Controller'; |
|
202 | 202 | |
203 | 203 | $stub = str_replace( |
204 | 204 | ['{{moduleName}}', '{{controllerClassName}}'], |
205 | 205 | [$moduleName, $controllerClassName], |
206 | - $this->files->get(__DIR__.'/stubs/controller.stub') |
|
206 | + $this->files->get(__DIR__ . '/stubs/controller.stub') |
|
207 | 207 | ); |
208 | 208 | |
209 | - $this->files->put(app_path('Http/Controllers/Admin/'.$controllerClassName.'.php'), $stub); |
|
209 | + $this->files->put(app_path('Http/Controllers/Admin/' . $controllerClassName . '.php'), $stub); |
|
210 | 210 | |
211 | 211 | $this->info('Controller created successfully! Define your index/browser/form endpoints options!'); |
212 | 212 | } |
@@ -217,18 +217,18 @@ discard block |
||
217 | 217 | $this->files->makeDirectory(app_path('Http/Requests/Admin'), 0755, true); |
218 | 218 | } |
219 | 219 | |
220 | - $requestClassName = $modelName.'Request'; |
|
220 | + $requestClassName = $modelName . 'Request'; |
|
221 | 221 | |
222 | - $stub = str_replace('{{requestClassName}}', $requestClassName, $this->files->get(__DIR__.'/stubs/request.stub')); |
|
222 | + $stub = str_replace('{{requestClassName}}', $requestClassName, $this->files->get(__DIR__ . '/stubs/request.stub')); |
|
223 | 223 | |
224 | - $this->files->put(app_path('Http/Requests/Admin/'.$requestClassName.'.php'), $stub); |
|
224 | + $this->files->put(app_path('Http/Requests/Admin/' . $requestClassName . '.php'), $stub); |
|
225 | 225 | |
226 | 226 | $this->info('Form request created successfully! Add some validation rules!'); |
227 | 227 | } |
228 | 228 | |
229 | 229 | private function createViews($moduleName = 'items', $translatable = false) |
230 | 230 | { |
231 | - $viewsPath = config('view.paths')[0].'/admin/'.$moduleName; |
|
231 | + $viewsPath = config('view.paths')[0] . '/admin/' . $moduleName; |
|
232 | 232 | |
233 | 233 | if (!$this->files->isDirectory($viewsPath)) { |
234 | 234 | $this->files->makeDirectory($viewsPath, 0755, true); |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | |
237 | 237 | $formView = $translatable ? 'form_translatable' : 'form'; |
238 | 238 | |
239 | - $this->files->put($viewsPath.'/form.blade.php', $this->files->get(__DIR__.'/stubs/'.$formView.'.blade.stub')); |
|
239 | + $this->files->put($viewsPath . '/form.blade.php', $this->files->get(__DIR__ . '/stubs/' . $formView . '.blade.stub')); |
|
240 | 240 | |
241 | 241 | $this->info('Form view created successfully! Include your form fields using @formField directives!'); |
242 | 242 | } |
@@ -28,7 +28,7 @@ |
||
28 | 28 | ]; |
29 | 29 | |
30 | 30 | foreach ($defaultMigrations as $migration) { |
31 | - $fullPath = database_path('migrations/'.$migration); |
|
31 | + $fullPath = database_path('migrations/' . $migration); |
|
32 | 32 | if (File::exists($fullPath)) { |
33 | 33 | File::delete($fullPath); |
34 | 34 | } |
@@ -16,20 +16,20 @@ |
||
16 | 16 | // TODO: document this and actually think about moving to queuable job after content type updates |
17 | 17 | public function handle() |
18 | 18 | { |
19 | - DB::table('mediables')->orderBy('id')->chunk(100, function ($attached_medias) { |
|
19 | + DB::table('mediables')->orderBy('id')->chunk(100, function($attached_medias) { |
|
20 | 20 | foreach ($attached_medias as $attached_media) { |
21 | 21 | $uuid = Media::withTrashed()->find($attached_media->media_id, ['uuid'])->uuid; |
22 | 22 | |
23 | - $lqip_width = config('lqip.'.$attached_media->mediable_type.'.'.$attached_media->role.'.'.$attached_media->crop); |
|
23 | + $lqip_width = config('lqip.' . $attached_media->mediable_type . '.' . $attached_media->role . '.' . $attached_media->crop); |
|
24 | 24 | |
25 | 25 | if ($lqip_width && (!$attached_media->lqip_data || $this->option('all'))) { |
26 | 26 | $url = ImageService::getLQIPUrl($uuid, [ |
27 | - 'rect' => $attached_media->crop_x.','.$attached_media->crop_y.','.$attached_media->crop_w.','.$attached_media->crop_h, |
|
27 | + 'rect' => $attached_media->crop_x . ',' . $attached_media->crop_y . ',' . $attached_media->crop_w . ',' . $attached_media->crop_h, |
|
28 | 28 | 'w' => $lqip_width, |
29 | 29 | ]); |
30 | 30 | |
31 | 31 | $data = file_get_contents($url); |
32 | - $dataUri = 'data:image/gif;base64,'.base64_encode($data); |
|
32 | + $dataUri = 'data:image/gif;base64,' . base64_encode($data); |
|
33 | 33 | |
34 | 34 | DB::table('mediables')->where('id', $attached_media->id)->update(['lqip_data' => $dataUri]); |
35 | 35 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | if ($isSubdomainAdmin || $isSubdirectoryAdmin) { |
79 | 79 | $view = view()->exists("admin.errors.$statusCode") ? "admin.errors.$statusCode" : "twill::errors.$statusCode"; |
80 | 80 | } else { |
81 | - $view = config('twill.frontend.views_path').".errors.{$statusCode}"; |
|
81 | + $view = config('twill.frontend.views_path') . ".errors.{$statusCode}"; |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | if (view()->exists($view)) { |
@@ -104,12 +104,12 @@ discard block |
||
104 | 104 | $handler = new \Whoops\Handler\PrettyPageHandler(); |
105 | 105 | |
106 | 106 | if (app()->environment('local', 'development')) { |
107 | - $handler->setEditor(function ($file, $line) { |
|
108 | - $translations = ['^'. |
|
107 | + $handler->setEditor(function($file, $line) { |
|
108 | + $translations = ['^' . |
|
109 | 109 | config('twill.debug.whoops_path_guest') => config('twill.debug.whoops_path_host'), |
110 | 110 | ]; |
111 | 111 | foreach ($translations as $from => $to) { |
112 | - $file = rawurlencode(preg_replace('#'.$from.'#', $to, $file, 1)); |
|
112 | + $file = rawurlencode(preg_replace('#' . $from . '#', $to, $file, 1)); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | return [ |
@@ -10,7 +10,7 @@ |
||
10 | 10 | public function toMail($notifiable) |
11 | 11 | { |
12 | 12 | return (new MailMessage())->markdown('twill::emails.html.email', [ |
13 | - 'url' => url('http://'.config('twill.admin_app_url').route('admin.password.reset.form', $this->token, false)), |
|
13 | + 'url' => url('http://' . config('twill.admin_app_url') . route('admin.password.reset.form', $this->token, false)), |
|
14 | 14 | 'actionText' => 'Reset password', |
15 | 15 | 'copy' => 'You are receiving this email because we received a password reset. If you did not request a password reset, no further action is required.', |
16 | 16 | ]); |
@@ -10,10 +10,10 @@ |
||
10 | 10 | public function toMail($notifiable) |
11 | 11 | { |
12 | 12 | return (new MailMessage())->markdown('twill::emails.html.email', [ |
13 | - 'url' => url('http://'.config('twill.admin_app_url').route('admin.password.reset.welcome.form', $this->token, false)), |
|
13 | + 'url' => url('http://' . config('twill.admin_app_url') . route('admin.password.reset.welcome.form', $this->token, false)), |
|
14 | 14 | 'actionText' => 'Choose your own password', |
15 | 15 | 'title' => 'Welcome', |
16 | - 'copy' => 'You are receiving this email because an account was created for you on '.config('app.name').'.', |
|
16 | + 'copy' => 'You are receiving this email because an account was created for you on ' . config('app.name') . '.', |
|
17 | 17 | ]); |
18 | 18 | } |
19 | 19 | } |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | |
14 | 14 | public function boot() |
15 | 15 | { |
16 | - Gate::before(function ($user, $ability) { |
|
16 | + Gate::before(function($user, $ability) { |
|
17 | 17 | if ($user->role === self::SUPERADMIN) { |
18 | 18 | return true; |
19 | 19 | } |
@@ -23,47 +23,47 @@ discard block |
||
23 | 23 | } |
24 | 24 | }); |
25 | 25 | |
26 | - Gate::define('list', function ($user) { |
|
26 | + Gate::define('list', function($user) { |
|
27 | 27 | return in_array($user->role_value, [UserRole::VIEWONLY, UserRole::PUBLISHER, UserRole::ADMIN]); |
28 | 28 | }); |
29 | 29 | |
30 | - Gate::define('edit', function ($user) { |
|
30 | + Gate::define('edit', function($user) { |
|
31 | 31 | return in_array($user->role_value, [UserRole::PUBLISHER, UserRole::ADMIN]); |
32 | 32 | }); |
33 | 33 | |
34 | - Gate::define('reorder', function ($user) { |
|
34 | + Gate::define('reorder', function($user) { |
|
35 | 35 | return in_array($user->role_value, [UserRole::PUBLISHER, UserRole::ADMIN]); |
36 | 36 | }); |
37 | 37 | |
38 | - Gate::define('publish', function ($user) { |
|
38 | + Gate::define('publish', function($user) { |
|
39 | 39 | return in_array($user->role_value, [UserRole::PUBLISHER, UserRole::ADMIN]); |
40 | 40 | }); |
41 | 41 | |
42 | - Gate::define('feature', function ($user) { |
|
42 | + Gate::define('feature', function($user) { |
|
43 | 43 | return in_array($user->role_value, [UserRole::PUBLISHER, UserRole::ADMIN]); |
44 | 44 | }); |
45 | 45 | |
46 | - Gate::define('delete', function ($user) { |
|
46 | + Gate::define('delete', function($user) { |
|
47 | 47 | return in_array($user->role_value, [UserRole::PUBLISHER, UserRole::ADMIN]); |
48 | 48 | }); |
49 | 49 | |
50 | - Gate::define('edit-user', function ($user, $editedUser) { |
|
50 | + Gate::define('edit-user', function($user, $editedUser) { |
|
51 | 51 | $editedUserObject = User::find($editedUser); |
52 | 52 | |
53 | 53 | return ($user->can('edit') || $user->id == $editedUser) && $editedUserObject->role !== self::SUPERADMIN; |
54 | 54 | }); |
55 | 55 | |
56 | - Gate::define('edit-user-role', function ($user) { |
|
56 | + Gate::define('edit-user-role', function($user) { |
|
57 | 57 | return in_array($user->role_value, [UserRole::ADMIN]); |
58 | 58 | }); |
59 | 59 | |
60 | - Gate::define('publish-user', function ($user) { |
|
60 | + Gate::define('publish-user', function($user) { |
|
61 | 61 | $editedUserObject = User::find(request('id')); |
62 | 62 | |
63 | 63 | return $user->can('publish') && $user->id !== $editedUserObject->id && $editedUserObject->role !== self::SUPERADMIN; |
64 | 64 | }); |
65 | 65 | |
66 | - Gate::define('impersonate', function ($user) { |
|
66 | + Gate::define('impersonate', function($user) { |
|
67 | 67 | return $user->role === self::SUPERADMIN; |
68 | 68 | }); |
69 | 69 | } |